Lazarus

Programming => Databases => Topic started by: 99Percent on August 25, 2010, 01:53:35 am

Title: DBLookUpComboBox KeyValue
Post by: 99Percent on August 25, 2010, 01:53:35 am
the current LCL's TDBLookUpComboBox does not have KeyValue property. This is very unfortunate and I think very badly needed. I am considering taking the time to implement it myself, but before I would like to know if there are any (open source) third party components which have a more advanced DBLookUpComboBox

Another deficiency is no way to limit to the lookup items. A user can fill the text box with useless characters that don't specify any record of the listsource.
Title: Re: DBLookUpComboBox KeyValue
Post by: paolopeg on August 26, 2010, 10:08:02 pm
You're searching 4

DBLookupComboBox1.Field.Value

In fact the key_field value is the real datafield associated to the component! So you need only to look at the current value in the query/table.

If u want the listfield just look at

DBLookupComboBox1.Caption

Bye
Title: Re: DBLookUpComboBox KeyValue
Post by: 99Percent on August 27, 2010, 09:08:08 pm
Thanks.

I forgot to mention that I want to use the DBLookUpCombo Box without a datasource, using the listsource only.
Title: Re: DBLookUpComboBox KeyValue
Post by: juanparati on November 07, 2010, 08:01:46 pm
You can get the index field (or other field) directly from the source table.

Example:

Code: [Select]
myTable.RecNo := myDBCombo.ItemIndex + 1;

indexvalue := myTable.FieldByName(myDBCombo.KeyField).Value;

 8-)
Title: Re: DBLookUpComboBox KeyValue
Post by: 99Percent on November 08, 2010, 03:34:45 am
Thanks but DBLookUpComboBox.KeyValue seems to be implemented in the lastest SVN versions. I will try it soon.
Title: Re: DBLookUpComboBox KeyValue
Post by: danilo666 on November 10, 2010, 11:53:21 am
How I update the version of lazarus with dblookupcombobox.keyvalue when have.
Title: Re: DBLookUpComboBox KeyValue
Post by: danilo666 on November 11, 2010, 11:01:12 am
Thank's Juan Parati, I tested your code and worked perfect
TinyPortal © 2005-2018