[Lazarus] @DBLookupControls users: call for test

Marcos Douglas md at delfire.net
Mon Dec 12 19:11:49 CET 2011


On Mon, Dec 12, 2011 at 2:35 PM, Marcos Douglas <md at delfire.net> wrote:
> On Mon, Dec 12, 2011 at 2:16 PM, Luiz Americo Pereira Camara
> <luizmed at oi.com.br> wrote:
>>
>> On 12/12/2011 14:25, Marcos Douglas wrote:
>>>
>>> I think I wrote better in bug tracker:
>>> 1. Define properties AutoComplete and AutoDropDown to True;
>>> 2. Type a new value (the DropDown will open) that not exists in DataSet (list);
>>> 3. If you type ENTER the combo will clear, because no value on list
>>> was found (OK);
>>> 4. Repeat 0000002. Now if you type [Down] to select a item (use the
>>> keyboard and don't type ENTER), but after type a new value that not
>>> exists in DataSet list and ENTER. The ComboBox is not cleaned.
>>>
>>> Attention in:
>>> + AutoComplete and AutroDropDown;
>>> + Item #4: When the dropdown open, just click down (selecting a item)
>>> but don't close it; after, type something that do not exists in list
>>> and press ENTER. You see the Text typed still there.
>>
>>
>> Still cannot reproduce.
>>
>> Can you create a sample project and add to the bugtracker?
>
> Yes, I will... later.

Well, the componente do not clean[1] itself (sorry about that) but the
bug still exists, but otherwise.

[1]  I had a EditingDoneEvent like this:
procedure TFooHelper.ComboEditingDoneCallback(Sender: TObject);
var
  cbx: TDBLookupComboBox;
begin
  if Sender is TDBLookupComboBox then
  begin
    cbx := TDBLookupComboBox(Sender);
    if VarIsNull(cbx.KeyValue) then
      cbx.Text := '';
  end;
end;

Well, I took your exemple here http://bugs.freepascal.org/view.php?id=20841
Please, copy paste the code below:

object DBLookupComboBox3: TDBLookupComboBox
  Left = 96
  Height = 21
  Top = 416
  Width = 179
  AutoComplete = True
  AutoDropDown = True
  DataField = 'MasterId'
  DataSource = LookupDatasource
  KeyField = 'Id'
  ListField = 'NAME'
  ListFieldIndex = 0
  ListSource = MasterDatasource
  LookupCache = False
  TabOrder = 6
end

Implements the EditingDoneEvent like this:
procedure TFooHelper.DBLookupComboBox3EditingDone(Sender: TObject);
var
  cbx: TDBLookupComboBox;
begin
  cbx := TDBLookupComboBox(Sender);
  ShowMessage(VarToStr(cbx.KeyValue));    ///<<<<<<<<<   see here
end;

So, even the component do not clean itself, if I type a value that not
exists in list the KeyValue would be NULL, don't?

Marcos Douglas




More information about the Lazarus mailing list