Gabor Boros wrote:
<div class="moz-text-flowed" style="font-family: -moz-fixed">Hi,

In Delphi I use TDBLookupComboBox for select a row from a table.
I only use three properties for this.  ListSource, ListField, KeyField.
And I can read the KeyField's value from the KeyValue property.
I want to use this component for same task but not working for me.
The result is an empty combobox. How can I do the above thing in Lazarus? My problem is a bug in TDBLookupComboBox?

Gabor

Lazarus is not Delphi! It may often behave in a similar way however it cannot use the VCL code because this is copyright of Embarcadero. When I wrote the DB lookup list-box and combo-box for Lazarus I rather assumed that developers would connect them to a data source, data field like you do with other DB controls. It is now obvious that some developers just like to use the lookup functionality without actually using the visual controls in the way intended.

Owing to the excellent and far sighted way that I implemented this, the lookup functionality is encapsulated in the TDBLookup class that you can find declared in DbCtrls. This enabled me to inherit TDBLookupComboBox from TDBComboBox and TDBLookupListBox from TDBListBox (which is not the clunky way it is done in the VCL ). You can therefore add a TDBLookup as a field to whatever TStrings container component that you happen to be writing to make a TDBLookupWhateverYouLike.

Less far sighted, I had refractored out the KeyField property in order to simplify the code.

Gabor and Alex might wish to look at the code for TDBLookup to see if they can use this class in their projects. It would be a more elegant solution rather than using the visual controls in a way which was not intended.

I am busy with other things at the moment but by popular demand I will revisit the code to reinstate the KeyField property if someone else does not get a patch into SVN sooner.

regards
Leslie Kaye
[email protected]


</div>



--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to