Topic: Removing the First Empty Entry in Drop-Down Box in Grid

Hello,

I was wondering if there is a way to remove the first empty entry in the drop-down box when editing a cell that is in a column with relationship to a different table (foreign key)?

Similar to the ComboBox component which one can change "FirstEmptyItem" to true or false - in this case, I would like it to be false.

I am currently using .dbListFields method. However, even when I tried generating the grid using the friendly UI, my table fields are set to 'Not null' with a default value, I still get a blank entry at the top.

Additionally it would also be great if when editing the cell, the drop-down selection will be on the already set value - is there a way to do that also?

As always, thank you in advance for any help!

Re: Removing the First Empty Entry in Drop-Down Box in Grid

1. I don't know about such a possibility and the class is not available in the script.
2. I tried it on my program, by default the value in the cell is selected in the list.
If you want to specify a value by default, use the 'OnAplyEditText' event.
For example, ' if (ACol = 1) and (Value <> '3') then Value := '3' ; ' .
Moreover, for a cell with a list, for 'Value' you need to specify the row number in the drop-down list.
Numbering from 0 where 0 is an empty line. For other fields, this will be the text value in the cell.