Recent

Author Topic: DBLookupListBox shows selected item even KeyValue not exist in the LookupList  (Read 2851 times)

rb

  • Newbie
  • Posts: 3
Hey there,

there is a little strange behavior of DBLookupListBox (DBLLB) which i can not solve.
If scroll in the Datasource, then in DBLLB LookupList always the matching dataset is selected. this working well.  But if the Datasource/Datafield contains a NULL or other value which not is in the ListSource, then DBLLB still shows the last selected Item.
In this case there should be no value selected in DBLLB.
How can i solve this? or is it bug and need to be reported?

Attached a little demo.

Thanks

derek.john.evans

  • Guest
You demo works on Windows XP (FreePascal 3.0.0 rc1/Lazarus 1.5)

I needed to take out the DBLookupListBox1.ClearSelection; (which I assume is an attempted fix)

Try adding a NULL option to your lookup list:
Code: [Select]
    CreateDataSet;
    Append;
    Fields[0].Value := NULL;
    Fields[1].Value := '(NULL)';   
    // Rest of the lookup options.
« Last Edit: September 26, 2015, 01:52:12 pm by Geepster »

rb

  • Newbie
  • Posts: 3
Thanks to check this out.

Actually this issue is here on MacOSX Yosemite, fpc 2.6.4/Lazarus 1.4.0.

Can there be a different behavior between WIN and OSX DBLLB which maybe only OSX related?

derek.john.evans

  • Guest
Actually this issue is here on MacOSX Yosemite, fpc 2.6.4/Lazarus 1.4.0.
Can there be a different behavior between WIN and OSX DBLLB which maybe only OSX related?

Its possible. i just checked Windows XP FPC 2.6.2/Lazarus 1.4.0, and it works.

Maybe something todo with OnChange events for a TListBox on the Mac. But, you would have to ask someone using the latest versions on Mac to know if its been fixed.
« Last Edit: September 26, 2015, 03:18:26 pm by Geepster »