简体   繁体   中英

How to assign string item with empty string instead of null in DevExpress Grid

I need to set the string item value to "empty string" and not to null by pressing DEL when editing a devexpress grid.

On the event getDisplayText of your column you can add

Procedure <youtview>.YourColumnGetDisplayText(Sender: TcxCustomGridTableItem; ARecord: TcxCustomGridRecord; var AText: string);
begin
 if AText = '' then
   AText := 'empty string';
end;

It's been a couple of years since I've seen Delphi, but there are events triggered on each item within a devexpress grid. Identify the 'OnKeyUp' event or similar, and add a method to identify the key pressed. If it is the DEL key, set the text value to ''.

The Delete key is VK_DELETE. Here is a list of other virtual keys for Delphi as well: http://delphi.about.com/od/objectpascalide/l/blvkc.htm

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM