You've already forked lazarus-ccr
RxDBLookupCombo - new event OnChangeData
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3736 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -152,6 +152,7 @@ type
|
|||||||
{ TRxCustomDBLookupCombo }
|
{ TRxCustomDBLookupCombo }
|
||||||
TRxCustomDBLookupCombo = class (TCustomControl)
|
TRxCustomDBLookupCombo = class (TCustomControl)
|
||||||
private
|
private
|
||||||
|
FOnChangeData: TNotifyEvent;
|
||||||
//
|
//
|
||||||
FStopClick:boolean;
|
FStopClick:boolean;
|
||||||
//FDataLink:TFieldDataLink;
|
//FDataLink:TFieldDataLink;
|
||||||
@ -257,6 +258,7 @@ type
|
|||||||
procedure DoSetBounds(ALeft, ATop, AWidth, AHeight: Integer); override;
|
procedure DoSetBounds(ALeft, ATop, AWidth, AHeight: Integer); override;
|
||||||
procedure DoPositionButton; virtual;
|
procedure DoPositionButton; virtual;
|
||||||
procedure DoChange; virtual;
|
procedure DoChange; virtual;
|
||||||
|
procedure DoChangeData; virtual;
|
||||||
procedure DoButtonClick(Sender: TObject); virtual;
|
procedure DoButtonClick(Sender: TObject); virtual;
|
||||||
Procedure Loaded; override;
|
Procedure Loaded; override;
|
||||||
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||||
@ -282,6 +284,7 @@ type
|
|||||||
property NumGlyphs : Integer read GetNumGlyphs write SetNumGlyphs;
|
property NumGlyphs : Integer read GetNumGlyphs write SetNumGlyphs;
|
||||||
property OnButtonClick : TNotifyEvent read FOnButtonClick write FOnButtonClick;
|
property OnButtonClick : TNotifyEvent read FOnButtonClick write FOnButtonClick;
|
||||||
property OnChange : TNotifyEvent read FOnChange write FOnChange;
|
property OnChange : TNotifyEvent read FOnChange write FOnChange;
|
||||||
|
property OnChangeData : TNotifyEvent read FOnChangeData write FOnChangeData;
|
||||||
property ReadOnly:boolean read FReadOnly write SetReadOnly;
|
property ReadOnly:boolean read FReadOnly write SetReadOnly;
|
||||||
property EmptyValue: string read FEmptyValue write SetEmptyValue stored StoreEmpty;
|
property EmptyValue: string read FEmptyValue write SetEmptyValue stored StoreEmpty;
|
||||||
property EmptyItemColor: TColor read FEmptyItemColor write SetEmptyItemColor default clWindow;
|
property EmptyItemColor: TColor read FEmptyItemColor write SetEmptyItemColor default clWindow;
|
||||||
@ -342,6 +345,7 @@ type
|
|||||||
property NumGlyphs;
|
property NumGlyphs;
|
||||||
Property OnButtonClick;
|
Property OnButtonClick;
|
||||||
property OnChange;
|
property OnChange;
|
||||||
|
property OnChangeData;
|
||||||
property OnClick;
|
property OnClick;
|
||||||
property OnClosePopup;
|
property OnClosePopup;
|
||||||
property OnDblClick;
|
property OnDblClick;
|
||||||
@ -1146,9 +1150,10 @@ end;
|
|||||||
procedure TRxCustomDBLookupCombo.NeedUpdateData;
|
procedure TRxCustomDBLookupCombo.NeedUpdateData;
|
||||||
begin
|
begin
|
||||||
if FLookupDataLink.Active and Assigned(FDataField) then
|
if FLookupDataLink.Active and Assigned(FDataField) then
|
||||||
begin ;
|
begin
|
||||||
if FKeyField.IsNull then FDataField.Clear
|
if FKeyField.IsNull then FDataField.Clear
|
||||||
else FDataField.AsString:=FKeyField.AsString
|
else FDataField.AsString:=FKeyField.AsString;
|
||||||
|
DoChangeData;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1259,6 +1264,7 @@ begin
|
|||||||
UpdateKeyValue;
|
UpdateKeyValue;
|
||||||
if Assigned(FOnSelect) then
|
if Assigned(FOnSelect) then
|
||||||
FOnSelect(Self);
|
FOnSelect(Self);
|
||||||
|
DoChangeData;
|
||||||
Key:=0;
|
Key:=0;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -1351,6 +1357,12 @@ begin
|
|||||||
FOnChange(Self);
|
FOnChange(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TRxCustomDBLookupCombo.DoChangeData;
|
||||||
|
begin
|
||||||
|
if Assigned(FOnChangeData) then
|
||||||
|
FOnChangeData(Self)
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TRxCustomDBLookupCombo.DoButtonClick(Sender: TObject);
|
procedure TRxCustomDBLookupCombo.DoButtonClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if (not FReadOnly) and (not FStopClick) then//We can do something if and only if that's not ReadOnly field...
|
if (not FReadOnly) and (not FStopClick) then//We can do something if and only if that's not ReadOnly field...
|
||||||
@ -1532,7 +1544,10 @@ begin
|
|||||||
if (Value <> FValue) then
|
if (Value <> FValue) then
|
||||||
begin
|
begin
|
||||||
if FListActive and not ReadOnly and (FDataLink.DataSource <> nil) and FDataLink.Edit then
|
if FListActive and not ReadOnly and (FDataLink.DataSource <> nil) and FDataLink.Edit then
|
||||||
FDataField.AsString := Value
|
begin
|
||||||
|
FDataField.AsString := Value;
|
||||||
|
DoChangeData;
|
||||||
|
end
|
||||||
else
|
else
|
||||||
SetValueKey(Value);
|
SetValueKey(Value);
|
||||||
if Assigned(FOnSelect) then
|
if Assigned(FOnSelect) then
|
||||||
|
Reference in New Issue
Block a user