From ba71677f7c36cb7336040616a26ea57624357b13 Mon Sep 17 00:00:00 2001 From: alexs75 Date: Fri, 23 Apr 2010 20:37:06 +0000 Subject: [PATCH] new event in RxLockupEdit - OnClosePopup git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1204 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/rx/rxlookup.pas | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/components/rx/rxlookup.pas b/components/rx/rxlookup.pas index f12b48270..05208f04e 100644 --- a/components/rx/rxlookup.pas +++ b/components/rx/rxlookup.pas @@ -47,6 +47,8 @@ type TRxCustomDBLookupCombo = class; TRxCustomDBLookupEdit = class; + TClosePopup = procedure(Sender: TObject; SearchResult:boolean) of object; + {For deciding, what we need to show in combobox in case we cannot find curvalue in lookup table.} TRxDBValueVariant = (rxufNone, rxufLastSuccessful, rxufOriginal); @@ -86,6 +88,7 @@ type // FLookupDataLink:TLookupSourceLink; FLocateObject:TLocateObject; + FOnClosePopup: TClosePopup; // FRxPopUpForm:TPopUpForm; @@ -112,11 +115,12 @@ type procedure DoButtonClick (Sender: TObject); override; function GetDefaultGlyphName: String; override; procedure KeyDown(var Key: Word; Shift: TShiftState); override; - procedure OnClosePopup(AResult:boolean);virtual; + procedure InternalClosePopup(AResult:boolean);virtual; // procedure LookupDataSetChanged(Sender: TObject); virtual; procedure ListLinkActiveChanged(Sender: TObject); virtual; // + property OnClosePopup:TClosePopup read FOnClosePopup write FOnClosePopup; property DropDownCount: Integer read GetDropDownCount write SetDropDownCount default 8; property DropDownWidth: Integer read GetDropDownWidth write SetDropDownWidth default 0; property LookupDisplay: string read FLookupDisplay write SetLookupDisplay; @@ -138,6 +142,7 @@ type property LookupField; property LookupSource; property PopUpFormOptions; + property OnClosePopup; end; { TRxCustomDBLookupCombo } @@ -489,15 +494,15 @@ begin FLocateObject.Locate(FLookupField, FValue, true, false); - FRxPopUpForm:=ShowRxDBPopUpForm(Self, FLookupDataLink.DataSet, @OnClosePopup, - FPopUpFormOptions, FLookupDisplay, LookupDisplayIndex, 0 {ButtonWidth}, Font); +(* FRxPopUpForm:=ShowRxDBPopUpForm(Self, FLookupDataLink.DataSet, @OnClosePopup, + FPopUpFormOptions, FLookupDisplay, LookupDisplayIndex, 0 {ButtonWidth}, Font);*) - FRxPopUpForm:=ShowRxDBPopUpForm(Self, FLookupDataLink.DataSet, @OnClosePopup, + FRxPopUpForm:=ShowRxDBPopUpForm(Self, FLookupDataLink.DataSet, @InternalClosePopup, FPopUpFormOptions, FLookupDisplay, LookupDisplayIndex, 0 {ButtonWidth}, Font); {$IFDEF LINUX} TempF:=FRxPopUpForm; if FRxPopUpForm.ShowModal = mrOk then - OnClosePopup(true); + InternalClosePopup(true); TempF.Free; FRxPopUpForm:=nil {$ENDIF} @@ -557,9 +562,10 @@ begin end; end; -procedure TRxCustomDBLookupEdit.OnClosePopup(AResult: boolean); +procedure TRxCustomDBLookupEdit.InternalClosePopup(AResult: boolean); begin - + if Assigned(FOnClosePopup) then + FOnClosePopup(Self, AResult); end; procedure TRxCustomDBLookupEdit.LookupDataSetChanged(Sender: TObject);