new event in RxLockupEdit - OnClosePopup

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1204 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2010-04-23 20:37:06 +00:00
parent d402565a9a
commit ba71677f7c

View File

@@ -47,6 +47,8 @@ type
TRxCustomDBLookupCombo = class; TRxCustomDBLookupCombo = class;
TRxCustomDBLookupEdit = 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.} {For deciding, what we need to show in combobox in case we cannot find curvalue in lookup table.}
TRxDBValueVariant = (rxufNone, rxufLastSuccessful, rxufOriginal); TRxDBValueVariant = (rxufNone, rxufLastSuccessful, rxufOriginal);
@@ -86,6 +88,7 @@ type
// //
FLookupDataLink:TLookupSourceLink; FLookupDataLink:TLookupSourceLink;
FLocateObject:TLocateObject; FLocateObject:TLocateObject;
FOnClosePopup: TClosePopup;
// //
FRxPopUpForm:TPopUpForm; FRxPopUpForm:TPopUpForm;
@@ -112,11 +115,12 @@ type
procedure DoButtonClick (Sender: TObject); override; procedure DoButtonClick (Sender: TObject); override;
function GetDefaultGlyphName: String; override; function GetDefaultGlyphName: String; override;
procedure KeyDown(var Key: Word; Shift: TShiftState); 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 LookupDataSetChanged(Sender: TObject); virtual;
procedure ListLinkActiveChanged(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 DropDownCount: Integer read GetDropDownCount write SetDropDownCount default 8;
property DropDownWidth: Integer read GetDropDownWidth write SetDropDownWidth default 0; property DropDownWidth: Integer read GetDropDownWidth write SetDropDownWidth default 0;
property LookupDisplay: string read FLookupDisplay write SetLookupDisplay; property LookupDisplay: string read FLookupDisplay write SetLookupDisplay;
@@ -138,6 +142,7 @@ type
property LookupField; property LookupField;
property LookupSource; property LookupSource;
property PopUpFormOptions; property PopUpFormOptions;
property OnClosePopup;
end; end;
{ TRxCustomDBLookupCombo } { TRxCustomDBLookupCombo }
@@ -489,15 +494,15 @@ begin
FLocateObject.Locate(FLookupField, FValue, true, false); FLocateObject.Locate(FLookupField, FValue, true, false);
FRxPopUpForm:=ShowRxDBPopUpForm(Self, FLookupDataLink.DataSet, @OnClosePopup, (* FRxPopUpForm:=ShowRxDBPopUpForm(Self, FLookupDataLink.DataSet, @OnClosePopup,
FPopUpFormOptions, FLookupDisplay, LookupDisplayIndex, 0 {ButtonWidth}, Font); FPopUpFormOptions, FLookupDisplay, LookupDisplayIndex, 0 {ButtonWidth}, Font);*)
FRxPopUpForm:=ShowRxDBPopUpForm(Self, FLookupDataLink.DataSet, @OnClosePopup, FRxPopUpForm:=ShowRxDBPopUpForm(Self, FLookupDataLink.DataSet, @InternalClosePopup,
FPopUpFormOptions, FLookupDisplay, LookupDisplayIndex, 0 {ButtonWidth}, Font); FPopUpFormOptions, FLookupDisplay, LookupDisplayIndex, 0 {ButtonWidth}, Font);
{$IFDEF LINUX} {$IFDEF LINUX}
TempF:=FRxPopUpForm; TempF:=FRxPopUpForm;
if FRxPopUpForm.ShowModal = mrOk then if FRxPopUpForm.ShowModal = mrOk then
OnClosePopup(true); InternalClosePopup(true);
TempF.Free; TempF.Free;
FRxPopUpForm:=nil FRxPopUpForm:=nil
{$ENDIF} {$ENDIF}
@@ -557,9 +562,10 @@ begin
end; end;
end; end;
procedure TRxCustomDBLookupEdit.OnClosePopup(AResult: boolean); procedure TRxCustomDBLookupEdit.InternalClosePopup(AResult: boolean);
begin begin
if Assigned(FOnClosePopup) then
FOnClosePopup(Self, AResult);
end; end;
procedure TRxCustomDBLookupEdit.LookupDataSetChanged(Sender: TObject); procedure TRxCustomDBLookupEdit.LookupDataSetChanged(Sender: TObject);