diff options
author | Graeme Geldenhuys <graemeg@gmail.com> | 2015-03-18 09:34:22 +0000 |
---|---|---|
committer | Graeme Geldenhuys <graemeg@gmail.com> | 2015-03-18 09:34:22 +0000 |
commit | d72f3b73f6f55e77eb69cdf55b5771edaa1d0b15 (patch) | |
tree | 54c7fb8f4eef63a8223e863a7335dfcf71f8981a | |
parent | a45679b6f5801ff460878e1df1092e5243d6eaa6 (diff) | |
download | fpGUI-d72f3b73f6f55e77eb69cdf55b5771edaa1d0b15.tar.xz |
Two new form helper functions added to fpgApplication
- GetFormByClassName()
- GetFormByName()
-rw-r--r-- | src/corelib/fpg_base.pas | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/corelib/fpg_base.pas b/src/corelib/fpg_base.pas index 4138dad9..d2d2e868 100644 --- a/src/corelib/fpg_base.pas +++ b/src/corelib/fpg_base.pas @@ -567,6 +567,8 @@ type function PrevModalForm: TfpgWindowBase; function RemoveWindowFromModalStack(AForm: TfpgWindowBase): Integer; procedure CreateForm(InstanceClass: TComponentClass; out Reference); + function GetFormByClassName(const AClassName: string): TfpgWindowBase; + function GetFormByName(const AName: string): TfpgWindowBase; function GetScreenWidth: TfpgCoord; virtual; abstract; function GetScreenHeight: TfpgCoord; virtual; abstract; function GetScreenPixelColor(APos: TPoint): TfpgColor; virtual; abstract; @@ -2500,6 +2502,36 @@ begin end; end; +function TfpgApplicationBase.GetFormByClassName(const AClassName: string): TfpgWindowBase; +var + i: integer; +begin + Result := nil; + for i := 0 to FormCount-1 do + begin + if Forms[i].ClassName = AClassName then + begin + Result := Forms[i]; + break; + end; + end; +end; + +function TfpgApplicationBase.GetFormByName(const AName: string): TfpgWindowBase; +var + i: integer; +begin + Result := nil; + for i := 0 to FormCount-1 do + begin + if Forms[i].Name = AName then + begin + Result := Forms[i]; + break; + end; + end; +end; + procedure TfpgApplicationBase.Terminate; var i: integer; |