summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsekelsenmat <sekelsenmat@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-07-11 13:55:35 +0000
committersekelsenmat <sekelsenmat@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-07-11 13:55:35 +0000
commit7a841349c07792dfd92886cc033139210e3b5f4c (patch)
treeaf769740d812ed691dd2a9962004d36a6f76928d
parente46f903dbd1d219adb13aafacaa7cfc797f46367 (diff)
downloadfpGUI-7a841349c07792dfd92886cc033139210e3b5f4c.tar.xz
Improved multihandle prototype
-rw-r--r--prototypes/newmultihandle/examples/helloworld.lpi15
-rw-r--r--prototypes/newmultihandle/gui_button.inc6
-rw-r--r--prototypes/newmultihandle/gui_widget.inc21
3 files changed, 29 insertions, 13 deletions
diff --git a/prototypes/newmultihandle/examples/helloworld.lpi b/prototypes/newmultihandle/examples/helloworld.lpi
index 3460a864..64d1a555 100644
--- a/prototypes/newmultihandle/examples/helloworld.lpi
+++ b/prototypes/newmultihandle/examples/helloworld.lpi
@@ -65,8 +65,8 @@
<Unit3>
<Filename Value="..\gui_widget.inc"/>
<IsPartOfProject Value="True"/>
- <CursorPos X="1" Y="24"/>
- <TopLine Value="11"/>
+ <CursorPos X="51" Y="20"/>
+ <TopLine Value="12"/>
<EditorIndex Value="4"/>
<UsageCount Value="21"/>
<Loaded Value="True"/>
@@ -74,8 +74,8 @@
<Unit4>
<Filename Value="..\gui_button.inc"/>
<IsPartOfProject Value="True"/>
- <CursorPos X="1" Y="40"/>
- <TopLine Value="32"/>
+ <CursorPos X="9" Y="49"/>
+ <TopLine Value="34"/>
<EditorIndex Value="5"/>
<UsageCount Value="21"/>
<Loaded Value="True"/>
@@ -105,7 +105,12 @@
<Loaded Value="True"/>
</Unit7>
</Units>
- <JumpHistory Count="0" HistoryIndex="-1"/>
+ <JumpHistory Count="1" HistoryIndex="0">
+ <Position1>
+ <Filename Value="..\gui_button.inc"/>
+ <Caret Line="51" Column="32" TopLine="32"/>
+ </Position1>
+ </JumpHistory>
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
diff --git a/prototypes/newmultihandle/gui_button.inc b/prototypes/newmultihandle/gui_button.inc
index a8e4a2c8..34378971 100644
--- a/prototypes/newmultihandle/gui_button.inc
+++ b/prototypes/newmultihandle/gui_button.inc
@@ -27,6 +27,8 @@ constructor TFButton.Create(ACaption: string; AParent: TFCustomWindow);
begin
Create(AParent);
+ DrawBackground := False;
+
Text := ACaption;
end;
@@ -35,8 +37,6 @@ var
r: TRect;
tw: integer;
begin
- inherited EvPaint();
-
Canvas.SetColor(colBlue);
r.Left := 0;
r.Top := 0;
@@ -50,6 +50,8 @@ begin
r.Right := Width + 1;
r.Bottom := Height + 1;
Canvas.FillRect(r);
+
+ inherited EvPaint();
end;
procedure TFButton.EvMouseReleased(AButton: TMouseButton;
diff --git a/prototypes/newmultihandle/gui_widget.inc b/prototypes/newmultihandle/gui_widget.inc
index f0e0399d..241c8636 100644
--- a/prototypes/newmultihandle/gui_widget.inc
+++ b/prototypes/newmultihandle/gui_widget.inc
@@ -2,6 +2,8 @@
type
TFWidget = class(TFWindow)
+ protected
+ DrawBackground: Boolean;
public
constructor Create(AParent: TFCustomWindow); virtual;
procedure EvPaint; override;
@@ -14,6 +16,10 @@ begin
if (AParent = nil) then inherited Create(nil, [woWindow])
else inherited Create(AParent, [woChildWindow]);
+ { Inherited components should set this to False,
+ or the background will override their painting }
+ DrawBackground := True;
+
SetClientSize(Size(125, 125));
end;
@@ -21,12 +27,15 @@ procedure TFWidget.EvPaint;
var
r: TRect;
begin
- Canvas.SetColor(colLtGray);
- r.Left := 0;
- r.Top := 0;
- r.Right := Width;
- r.Bottom := Height;
- Canvas.FillRect(r);
+ if DrawBackground then
+ begin
+ Canvas.SetColor(colLtGray);
+ r.Left := 0;
+ r.Top := 0;
+ r.Right := Width;
+ r.Bottom := Height;
+ Canvas.FillRect(r);
+ end;
inherited EvPaint();
end;