diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-03-18 15:43:21 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-03-18 15:59:20 +0200 |
commit | 7f9e2ed81597f0c0013dfef60315198edf3c5477 (patch) | |
tree | 6f20f81f12c8dc7a1a48eb5499c4b9242dc4a692 /src | |
parent | fbd4bf0c305a4d086ba8c3cc650ba68437197f09 (diff) | |
download | fpGUI-7f9e2ed81597f0c0013dfef60315198edf3c5477.tar.xz |
Setting MouseCursor at design time now works correctly under X11.
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/fpg_base.pas | 6 | ||||
-rw-r--r-- | src/corelib/fpg_widget.pas | 23 | ||||
-rw-r--r-- | src/corelib/x11/fpg_x11.pas | 7 |
3 files changed, 26 insertions, 10 deletions
diff --git a/src/corelib/fpg_base.pas b/src/corelib/fpg_base.pas index b51d0aa7..1b840f8c 100644 --- a/src/corelib/fpg_base.pas +++ b/src/corelib/fpg_base.pas @@ -415,6 +415,7 @@ type FCanvas: TfpgCanvasBase; FSizeIsDirty: Boolean; FPosIsDirty: Boolean; + FMouseCursorIsDirty: Boolean; function HandleIsValid: boolean; virtual; abstract; procedure DoUpdateWindowPosition; virtual; abstract; procedure DoAllocateWindowHandle(AParent: TfpgWindowBase); virtual; abstract; @@ -1029,6 +1030,8 @@ end; procedure TfpgWindowBase.AllocateWindowHandle; begin DoAllocateWindowHandle(FParent); + if FMouseCursorIsDirty then + DoSetMouseCursor; end; procedure TfpgWindowBase.ReleaseWindowHandle; @@ -1124,6 +1127,7 @@ constructor TfpgWindowBase.Create(AOwner: TComponent); begin inherited Create(AOwner); FMouseCursor := mcDefault; + FMouseCursorIsDirty := False; FPosIsDirty := True; FSizeIsDirty := True; FMaxWidth := 0; @@ -1566,6 +1570,8 @@ end; procedure TfpgCanvasBase.SetFont(AFont: TfpgFontBase); begin + if AFont = nil then + exit; FFont := AFont; DoSetFontRes(AFont.FFontRes); end; diff --git a/src/corelib/fpg_widget.pas b/src/corelib/fpg_widget.pas index 322a6217..f0daec81 100644 --- a/src/corelib/fpg_widget.pas +++ b/src/corelib/fpg_widget.pas @@ -132,6 +132,7 @@ type public constructor Create(AOwner: TComponent); override; destructor Destroy; override; + procedure AfterConstruction; override; function GetClientRect: TfpgRect; virtual; function GetBoundsRect: TfpgRect; virtual; function InDesigner: boolean; @@ -420,15 +421,6 @@ begin FWindowType := wtChild; FShowHint := Parent.ShowHint; end; - - // This is for components that are created at runtime, after it's - // parent has already been shown. - if (Parent <> nil) and (Parent.HasHandle) then - begin - InternalHandleShow; - end; - - Loaded; // remove csLoading from ComponentState end; destructor TfpgWidget.Destroy; @@ -440,6 +432,19 @@ begin inherited; end; +procedure TfpgWidget.AfterConstruction; +begin + inherited AfterConstruction; + // This is for components that are created at runtime, after it's + // parent has already been shown. + if (Parent <> nil) and (Parent.HasHandle) then + begin + HandleShow; + end; + + Loaded; // remove csLoading from ComponentState +end; + procedure TfpgWidget.MsgKeyChar(var msg: TfpgMessageRec); var lChar: TfpgChar; diff --git a/src/corelib/x11/fpg_x11.pas b/src/corelib/x11/fpg_x11.pas index d65ae3b3..30aab57c 100644 --- a/src/corelib/x11/fpg_x11.pas +++ b/src/corelib/x11/fpg_x11.pas @@ -1620,8 +1620,11 @@ var shape: integer; begin if not HasHandle then + begin + FMouseCursorIsDirty := True; Exit; //==> - + end; + case FMouseCursor of mcSizeEW: shape := XC_sb_h_double_arrow; mcSizeNS: shape := XC_sb_v_double_arrow; @@ -1641,6 +1644,8 @@ begin xc := XCreateFontCursor(xapplication.Display, shape); XDefineCursor(xapplication.Display, FWinHandle, xc); XFreeCursor(xapplication.Display, xc); + + FMouseCursorIsDirty := False; end; procedure TfpgX11Window.DoSetWindowTitle(const ATitle: string); |