Recent

Author Topic: DBLookupComboBox NullValueKey doesn't trigger OnChange  (Read 734 times)

bpranoto

  • Full Member
  • ***
  • Posts: 183
DBLookupComboBox NullValueKey doesn't trigger OnChange
« on: April 07, 2023, 06:24:32 am »
I have a DBLookupComboBox with style csDropDownList and define Del as NullValueKey.

A complete small demo project is attached, compile and run the demo. If you press del to clear the combobox, the OnChange event should be triggered and make the EditNote control disabled. Unfortunatley, it is not the case.

Is this a bug or I miss some thing?

Thank you

Zvoni

  • Hero Member
  • *****
  • Posts: 3226
Re: DBLookupComboBox NullValueKey doesn't trigger OnChange
« Reply #1 on: April 07, 2023, 07:40:43 am »
IIRC, OnChange fires if the TEdit-Part of the combobox changes
Try OnClick

btw: why are you using a DBLookupcombo if you allow the user to clear the combobox?
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

bpranoto

  • Full Member
  • ***
  • Posts: 183
Re: DBLookupComboBox NullValueKey doesn't trigger OnChange
« Reply #2 on: April 07, 2023, 07:50:26 am »
IIRC, OnChange fires if the TEdit-Part of the combobox changes
That's why I think it's a bug, it obviously changes the TEdit part.

Quote
Try OnClick
It also doesn't work

Quote
btw: why are you using a DBLookupcombo if you allow the user to clear the combobox?
Because sometimes a field is optional, can be filled or left empty

bpranoto

  • Full Member
  • ***
  • Posts: 183
Re: DBLookupComboBox NullValueKey doesn't trigger OnChange
« Reply #3 on: April 07, 2023, 08:01:10 am »
The solution workaround is by using the OnChange event of the field.

However, I still think coding the onChange event of the TDBLookupComboBox should work as well.
« Last Edit: April 07, 2023, 08:10:03 am by bpranoto »

 

TinyPortal © 2005-2018