TCustomDBComboBox descendents do not call "EditingDone" on CloseUp when style set to DropDownList
Original Reporter info from Mantis: TWhyman
-
Reporter name: Tony Whyman
Original Reporter info from Mantis: TWhyman
- Reporter name: Tony Whyman
Description:
When a TCustomDBComboBox descendent (e.g. TDBComboBox) style is set of DropDownList, and when the drop down list closes, the DataSet is not updated and hence the corresponding Field's OnChange event is not called.
This is different from the control's behaviour when the style is simply "DropDown" when the DataSet is updated and the corresponding Field's OnChange event is called.
Additional information:
The problem seems to be due to the "ReadOnly" property being redefined by TCustomDBComboBox and having different semantics from TDBComboBox.ReadOnly.
TDBComboBox.CloseUp looks at its ReadOnly property and does not call EditingDone if it is true. ReadOnly is always set to true when the style is DropDownList.
However, the TCustomDBComboBox ReadOnly property is a different property and reflects whether the corresponding Field is or is not Read Only. It is also the property visible in the Object Inspector.
Because the CloseUp Method is called in the context of TDBComboBox, ReadOnly is always true for a DropDownList and hence EditingDone is not called and the dataset not updated.
The solution is simple enough. "CloseUp" is virtual and should be overridden by
TCustomDBComboBox so that EditingDone is called when its ReadOnly property is false.
See attached patch.