summaryrefslogtreecommitdiff
path: root/examples/gfx
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-07-09 09:27:11 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-07-09 09:27:11 +0000
commit507c84feef852c0b9763a1b1ca11232fb6c4b1a6 (patch)
treea282ec12727da2051b2c497f11370aaed6d6698f /examples/gfx
parent96846dc934af9cd251e4b038dd276c55431e2a15 (diff)
downloadfpGUI-507c84feef852c0b9763a1b1ca11232fb6c4b1a6.tar.xz
GFX: Changed TFCustomWindow to descend from TComponent.
EventTest: extended the example a bit to test a few more things.
Diffstat (limited to 'examples/gfx')
-rw-r--r--examples/gfx/eventtest/eventtest.pas12
1 files changed, 9 insertions, 3 deletions
diff --git a/examples/gfx/eventtest/eventtest.pas b/examples/gfx/eventtest/eventtest.pas
index 4fb7593a..6a049fac 100644
--- a/examples/gfx/eventtest/eventtest.pas
+++ b/examples/gfx/eventtest/eventtest.pas
@@ -43,6 +43,7 @@ type
procedure Move(Sender: TObject);
procedure Resize(Sender: TObject);
private
+ FMoveEventCount: integer;
function ShiftStateToStr(Shift: TShiftState): String;
function MouseState(AShift: TShiftState; const AMousePos: TPoint): String;
public
@@ -56,6 +57,7 @@ begin
Title := 'fpGFX Event Test example';
SetClientSize(Size(500, 100));
+ FMoveEventCount := 0;
OnFocusIn := @FocusIn;
OnFocusOut := @FocusOut;
@@ -119,7 +121,7 @@ begin
Result := '[X=' + IntToStr(AMousePos.x) + ' Y=' + IntToStr(AMousePos.y);
if Length(ShiftStateStr) > 0 then
Result := Result + ' ' + ShiftStateStr;
- Result := Result + ']';
+ Result := Result + '] ';
end;
@@ -193,7 +195,9 @@ end;
procedure TMainWindow.MouseMove(Sender: TObject; AShift: TShiftState;
const AMousePos: TPoint);
begin
- WriteLn(MouseState(AShift, AMousePos), 'Mouse moved');
+ Inc(FMoveEventCount);
+ if (FMoveEventCount mod 10) = 0 then
+ WriteLn(MouseState(AShift, AMousePos), 'Mouse moved (every 10th event printed)');
end;
@@ -207,10 +211,12 @@ end;
procedure TMainWindow.Paint(Sender: TObject; const ARect: TRect);
begin
+ writeln('Paint event');
with Canvas do
begin
SetColor(colWhite);
- FillRect(ARect);
+ FillRect(Rect(0, 0, Width, Height));
+
SetColor(colBlack);
TextOut(Point(0, 0), 'Event test');
TextOut(Point(0, FontCellHeight),