Subject Re: [IBO] TIB_LookupCombo to allow selecting
Author Helen Borrie
At 01:15 PM 09-11-01 +0000, you wrote:
>OK, pressing DEL seems to work... but it isn't the obvious way of
>selecting <none> for me. It would be more self-explaining for the end
>user if there was an 'empty' line in the combobox-list that he could
>Any ideas how to accomplish this?

Since TIB_LookupCombo is a double-data-aware control, the drop-down list represents one data set and the editbox points to a column in another. If you want the dropdown list to show some kind of "null" value, you'll need to have a dummy row in the lookup table to represent it (e.g. a description like '<null>' with an absurd key like -9999). Then intercept a value of -9999 in the keysource key in your BeforePost event and force-clear it...or let it post as -9999 and have a trigger that intercepts a value of -9999 and sets it to null...

A TIB_ComboBox links the currently selected value (selected in the edit box) from a non-data-aware list to a dataset column. So if you want to include choices that are not stored in the database, use a combobox, not a lookupcombo.

If, however, you want to stick with the lookup combo and don't want to go the "dummy" route, include a small button somewhere (or add a context menu option) that the user can click to set the column (in the parent dataset) to null before posting it....

Oh, and if I had my way, my children would get their allowances stopped for putting formal foreign key dependencies on lookup relationships. This is one place where I DEFINITELY want to look after this with my own triggers! This is one issue on which my dear friend Geoff and I have been known to draw blood. <g>


All for Open and Open for All
InterBase Developer Initiative ยท