diff options
author | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-12-11 14:00:07 +0000 |
---|---|---|
committer | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-12-11 14:00:07 +0000 |
commit | 0b4c2973e23e04ad6c46f403fbb149485c128c9c (patch) | |
tree | 78317828b9fb145b7fe54501ad7fecf2095640df /src/corelib | |
parent | 4b4a2c266b7dd8f9e2cfac06f3009942f3b05dd0 (diff) | |
download | fpGUI-0b4c2973e23e04ad6c46f403fbb149485c128c9c.tar.xz |
* Fixed TfpgApplication to call CheckSynchronize in the application loop so multithreaded applications will work.
* TfpgApplication now inherits from TComponent so it can act as a container for other components like Forms.
* Implemented CreateForm in TfpgApplication.
* Fixed the default Height of TfpgComboBox to look at the specified Font instead of a hardcoded value.
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/fpgfx.pas | 3 | ||||
-rw-r--r-- | src/corelib/gfx_widget.pas | 6 | ||||
-rw-r--r-- | src/corelib/gfxbase.pas | 17 |
3 files changed, 22 insertions, 4 deletions
diff --git a/src/corelib/fpgfx.pas b/src/corelib/fpgfx.pas index d86897fa..eabce751 100644 --- a/src/corelib/fpgfx.pas +++ b/src/corelib/fpgfx.pas @@ -744,6 +744,9 @@ end; procedure TfpgApplication.WaitWindowMessage(atimeoutms: integer); begin + if IsMultiThread then + CheckSynchronize; // execute the to-be synchronized method + DoWaitWindowMessage(fpgClosestTimer(now, atimeoutms)); fpgDeliverMessages; fpgCheckTimers; diff --git a/src/corelib/gfx_widget.pas b/src/corelib/gfx_widget.pas index 5c195d60..d881bd1a 100644 --- a/src/corelib/gfx_widget.pas +++ b/src/corelib/gfx_widget.pas @@ -196,6 +196,8 @@ end; constructor TfpgWidget.Create(AOwner: TComponent); begin + { TODO -oGraeme -cRelease Blocker : ComponentState is read-only. I'm + exploiting a FPC <= 2.2.0 bug. I need to fix this! } Include(ComponentState, csLoading); FOnScreen := False; FVisible := True; @@ -207,7 +209,6 @@ begin FAnchors := [anLeft, anTop]; FAlign := alNone; FHint := ''; -// OnKeyPress := nil; if (AOwner <> nil) and (AOwner is TfpgWidget) then Parent := TfpgWidget(AOwner) @@ -223,11 +224,10 @@ begin // parent has already been shown. if (Parent <> nil) and (Parent.HasHandle) then begin -// writeln('about to call InternalHandleShow'); InternalHandleShow; end; - Exclude(ComponentState, csLoading); + Loaded; // remove csLoading from ComponentState end; destructor TfpgWidget.Destroy; diff --git a/src/corelib/gfxbase.pas b/src/corelib/gfxbase.pas index b584ce33..32cbe8f9 100644 --- a/src/corelib/gfxbase.pas +++ b/src/corelib/gfxbase.pas @@ -372,7 +372,7 @@ type { TfpgApplicationBase } - TfpgApplicationBase = class(TObject) + TfpgApplicationBase = class(TComponent) private FMainForm: TfpgWindowBase; FTerminated: boolean; @@ -387,10 +387,14 @@ type procedure PushModalForm(AForm: TfpgWindowBase); procedure PopModalForm; function PrevModalForm: TfpgWindowBase; + procedure CreateForm(AFormClass: TComponentClass; var AForm: TfpgWindowBase); property IsInitialized: boolean read FIsInitialized; property TopModalForm: TfpgWindowBase read GetTopModalForm; property MainForm: TfpgWindowBase read FMainForm write FMainForm; property Terminated: boolean read FTerminated write FTerminated; + { TODO : Implement these two properties in the near future. } +// property FormCount... +// property Forms[]... end; @@ -1641,5 +1645,16 @@ begin Result := TfpgWindowBase(FModalFormStack.Items[FModalFormStack.Count-2]); end; +procedure TfpgApplicationBase.CreateForm(AFormClass: TComponentClass; + var AForm: TfpgWindowBase); +begin + try + AForm := TfpgWindowBase(AFormClass.Create(self)); + except + AForm := nil; + raise; + end; +end; + end. |