From b8361291866dd913fb5a6169ff2a570018a4ba22 Mon Sep 17 00:00:00 2001 From: vincents Date: Fri, 4 Jul 2008 08:54:57 +0000 Subject: [PATCH] fpgui widget set: allow components to be visible at runtime from Graeme (issue #11606) git-svn-id: trunk@15669 - --- lcl/interfaces/fpgui/fpguiwsprivate.pp | 1 - lcl/interfaces/fpgui/fpguiwsstdctrls.pp | 55 +++++++++++++++++++++++-- 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/lcl/interfaces/fpgui/fpguiwsprivate.pp b/lcl/interfaces/fpgui/fpguiwsprivate.pp index c564c18c55..d74c7ac64e 100644 --- a/lcl/interfaces/fpgui/fpguiwsprivate.pp +++ b/lcl/interfaces/fpgui/fpguiwsprivate.pp @@ -590,7 +590,6 @@ begin {$IFDEF VerboseFPGUIPrivate} WriteLn('[TFPGUIPrivateButton.CreateWidget]'); {$ENDIF} - Widget := TfpgButton.Create(GetParentContainerWidget()); Widget.SetPosition(LCLObject.Left, LCLObject.Top, LCLObject.Width, LCLObject.Height); end; diff --git a/lcl/interfaces/fpgui/fpguiwsstdctrls.pp b/lcl/interfaces/fpgui/fpguiwsstdctrls.pp index 2ac1587762..36cc6844b4 100644 --- a/lcl/interfaces/fpgui/fpguiwsstdctrls.pp +++ b/lcl/interfaces/fpgui/fpguiwsstdctrls.pp @@ -86,6 +86,7 @@ type class function GetItems(const ACustomComboBox: TCustomComboBox): TStrings; override; // class procedure Sort(const ACustomComboBox: TCustomComboBox; AList: TStrings; IsSorted: boolean); override; + class procedure ShowHide(const AWinControl: TWinControl); override; end; { TFpGuiWSComboBox } @@ -135,6 +136,7 @@ type class procedure GetPreferredSize(const AWinControl: TWinControl; var PreferredWidth, PreferredHeight: integer); override;} // class procedure SetColor(const AWinControl: TWinControl); override; + class procedure ShowHide(const AWinControl: TWinControl); override; end; { TFpGuiWSCustomMemo } @@ -153,6 +155,7 @@ type class procedure SetWantReturns(const ACustomMemo: TCustomMemo; const NewWantReturns: boolean); override; class procedure SetWantTabs(const ACustomMemo: TCustomMemo; const NewWantTabs: boolean); override; class procedure SetWordWrap(const ACustomMemo: TCustomMemo; const NewWordWrap: boolean); override;} + class procedure ShowHide(const AWinControl: TWinControl); override; end; { TFpGuiWSEdit } @@ -187,9 +190,10 @@ type public class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override; class procedure DestroyHandle(const AWinControl: TWinControl); override; - + class procedure Invalidate(const AWinControl: TWinControl); override; class function GetText(const AWinControl: TWinControl; var AText: String): Boolean; override; class procedure SetText(const AWinControl: TWinControl; const AText: String); override; + class procedure ShowHide(const AWinControl: TWinControl); override; end; { TFpGuiWSCustomCheckBox } @@ -206,10 +210,9 @@ type class procedure SetShortCut(const ACustomCheckBox: TCustomCheckBox; const OldShortCut, NewShortCut: TShortCut); override; class procedure SetState(const ACustomCheckBox: TCustomCheckBox; const NewState: TCheckBoxState); override; - class function GetText(const AWinControl: TWinControl; var AText: String): Boolean; override; - class procedure SetText(const AWinControl: TWinControl; const AText: String); override; + class procedure ShowHide(const AWinControl: TWinControl); override; end; { TFpGuiWSCheckBox } @@ -245,6 +248,7 @@ type class function GetText(const AWinControl: TWinControl; var AText: String): Boolean; override; class procedure SetText(const AWinControl: TWinControl; const AText: String); override; + class procedure ShowHide(const AWinControl: TWinControl); override; end; { TFpGuiWSCustomStaticText } @@ -346,6 +350,13 @@ begin Result := FComboBox.Items; end; +class procedure TFpGuiWSCustomComboBox.ShowHide(const AWinControl: TWinControl + ); +begin + inherited ShowHide(AWinControl); + TFPGUIPrivateComboBox(AWinControl.Handle).Widget.Visible := AWinControl.Visible; +end; + { TFpGuiWSCustomEdit } {------------------------------------------------------------------------------ @@ -359,6 +370,12 @@ begin Result := TLCLIntfHandle(TFPGUIPrivateEdit.Create(AWinControl, AParams)); end; +class procedure TFpGuiWSCustomEdit.ShowHide(const AWinControl: TWinControl); +begin + inherited ShowHide(AWinControl); + TFPGUIPrivateEdit(AWinControl.Handle).Widget.Visible := AWinControl.Visible; +end; + { TFpGuiWSButton } {------------------------------------------------------------------------------ @@ -384,6 +401,12 @@ begin TFPGUIPrivateButton(AWinControl.Handle).SetText(AText); end; +class procedure TFpGuiWSButton.ShowHide(const AWinControl: TWinControl); +begin + inherited ShowHide(AWinControl); + TFPGUIPrivateButton(AWinControl.Handle).Widget.Visible := AWinControl.Visible; +end; + {------------------------------------------------------------------------------ Method: TFpGuiWSButton.CreateHandle Params: None @@ -404,6 +427,12 @@ begin AWinControl.Handle := 0; end; +class procedure TFpGuiWSButton.Invalidate(const AWinControl: TWinControl); +begin + inherited Invalidate(AWinControl); + TFPGUIPrivateButton(AWinControl.Handle).Widget.Invalidate; +end; + { TFpGuiWSCustomCheckBox } class function TFpGuiWSCustomCheckBox.RetrieveState( @@ -459,6 +488,13 @@ begin vCheckBox.Text := AText; end; +class procedure TFpGuiWSCustomCheckBox.ShowHide(const AWinControl: TWinControl + ); +begin + inherited ShowHide(AWinControl); + TFPGUIPrivateCheckBox(AWinControl.Handle).Widget.Visible := AWinControl.Visible; +end; + class function TFpGuiWSCustomCheckBox.CreateHandle( const AWinControl: TWinControl; const AParams: TCreateParams ): TLCLIntfHandle; @@ -529,6 +565,12 @@ begin vRadioButton.Text := AText; end; +class procedure TFpGuiWSRadioButton.ShowHide(const AWinControl: TWinControl); +begin + inherited ShowHide(AWinControl); + TFPGUIPrivateRadioButton(AWinControl.Handle).Widget.Visible := AWinControl.Visible; +end; + class function TFpGuiWSRadioButton.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; begin @@ -555,6 +597,13 @@ begin Result:=inherited GetStrings(ACustomMemo); end; +class procedure TFpGuiWSCustomMemo.ShowHide(const AWinControl: TWinControl); +begin + inherited ShowHide(AWinControl); + TFPGUIPrivateMemo(AWinControl.Handle).Widget.Visible := AWinControl.Visible; +end; + + initialization ////////////////////////////////////////////////////