|
| OnChange Event for TDBLookupComboBox | 
|
|---|
| How to make a new DBLookupComboBox-Component with OnChange-Event | Product: Delphi all versions | Category: Database-VCL | Skill Level:
 | Scoring:  | Last Update: 11/19/2002 | Search Keys: delphi delphi3000 article borland vcl code-snippet DBLookupComboBox OnChange Event | Times Scored: 7 | Visits: 6790 | Uploader: Alex Schlecht Company: | Reference: N/A | | | Question/Problem/Abstract:
DB-Aware Components like TDBEdit have an Event "OnChange". This Event is established in TCustomEdit.
Unfortunately in TDBLookupComboBox there is no OnChange-Event, because this component is not based on TCustomEdit but on TWinControl.
What to do if you want to have an OnChange event in a DBLookupComboBox? | Answer:
DB-Aware Components like TDBEdit have an Event "OnChange". This Event is established in TCustomEdit.
Unfortunately in TDBLookupComboBox there is no OnChange-Event, because this component is not based on TCustomEdit but on TWinControl.
What to do if you want to have an OnChange event in a DBLookupComboBox?
Well, let's build our own component with this event! It's easy because TDBLookupControl established an protected Procedure "KeyValueChanged". It will fired when the property "KeyValue" ist changed.
So we can overwrite this Event in our own Componentent and call a new Event "OnChang".
That's all :-)
Type
TMyDBLookupComboBox = class ( TDBLookupComboBox)
private
FOnChange: TNotifyEvent;
protected
procedure KeyValueChanged; override;
published
property OnChange : TNotifyEvent read FOnChange write FOnChange;
end;
implementation
procedure TMyDBLookupComboBox.KeyValueChanged;
begin
inherited;
if Assigned(FOnChange) then FOnChange(Self);
end;
|
|
|
| |
Sign up to consume product discounts for Bronze memberships !
|
|
| |
Community Ad of C.A. Longen |
|
| |
|
|
|