Skipping TDBGrid cells on condition
Posted on 2003-02-26
I have a TDBGrid that connects to a table in a database. The cells in the grid are editable and I have a column in this grid that is called 'Weight Units' which connects to the underlying field in the database and another column before it in the grid called Quantity.
I also have a drop-down TDBLookUpComboBox that looks-up a table in the DB and displays all the weight units e.g. KG, lb, Tons etc.
What I want is that if I enter a quantity in the cell under the Quantity column then the TDBLookUpComboBox will pop-up on the OnColExit event so that the user can choose a quantity. However, if the user enters '0' in the Quantity column then I don't want the TDBLookUpComboBox to pop up and simply skip to the next line in the grid for input. I have associated the TDBLookUpComboBox to the grid column 'Weight Units' and set both it and the datasource to be readonly if it detects that the quantity field is 0. I have also set the tabstop on the TDBLookUpComboBox to be false when this is the case.
However, I am still finding that the cursor stops on the TDBLookUpComboBox in the 'Weight Units' column even when the quantity field is 0.
Can anyone help or provide tips?