summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-04-25 10:20:06 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-04-25 10:20:06 +0000
commit5240a28f21b2c802dca8d5612516f52ce7d69a98 (patch)
treefabbe7b459188fcfa33a327b4ea394919871d042 /examples
parent67e5a768cf77c8ae50e0e6b7160821e118d702d6 (diff)
downloadfpGUI-5240a28f21b2c802dca8d5612516f52ce7d69a98.tar.xz
* Updated some widgets to handle the Keypad Enter key as well.
* Updated the UI Designer so F11 works switching between Properties Editor and Form Designer. * Updated the UI Designer so that New Form and Size or Position dialog accepts values when Enter is pressed.
Diffstat (limited to 'examples')
-rw-r--r--examples/apps/uidesigner/newformdesigner.pas6
-rw-r--r--examples/apps/uidesigner/uidesigner.lpr2
-rw-r--r--examples/apps/uidesigner/vfddesigner.pas35
-rw-r--r--examples/apps/uidesigner/vfdfile.pas2
-rw-r--r--examples/apps/uidesigner/vfdforms.pas45
-rw-r--r--examples/apps/uidesigner/vfdmain.pas2
-rw-r--r--examples/apps/uidesigner/vfdwidgetclass.pas2
-rw-r--r--examples/apps/uidesigner/vfdwidgets.pas2
8 files changed, 57 insertions, 39 deletions
diff --git a/examples/apps/uidesigner/newformdesigner.pas b/examples/apps/uidesigner/newformdesigner.pas
index 4bd4c4c6..175e4fa6 100644
--- a/examples/apps/uidesigner/newformdesigner.pas
+++ b/examples/apps/uidesigner/newformdesigner.pas
@@ -635,11 +635,13 @@ end;
procedure TfrmProperties.HandleKeyPress(var keycode: word; var shiftstate: TShiftState; var consumed: boolean);
begin
- if (keycode = keyEnter) or (keycode = keyF11) then
+ if keycode = keyF11 then
begin
if maindsgn.selectedform <> nil then
+ begin
maindsgn.selectedform.Form.SetFocus;
-// GfxActivateWindow(maindsgn.selectedform.Form.WinHandle);
+ maindsgn.selectedform.Form.ActivateWindow;
+ end;
consumed := True;
end
else
diff --git a/examples/apps/uidesigner/uidesigner.lpr b/examples/apps/uidesigner/uidesigner.lpr
index d39cac22..4b4c371f 100644
--- a/examples/apps/uidesigner/uidesigner.lpr
+++ b/examples/apps/uidesigner/uidesigner.lpr
@@ -1,7 +1,7 @@
{
fpGUI - Free Pascal GUI Library
- Copyright (C) 2006 - 2007 See the file AUTHORS.txt, included in this
+ Copyright (C) 2006 - 2008 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
See the file COPYING.modifiedLGPL, included in this distribution,
diff --git a/examples/apps/uidesigner/vfddesigner.pas b/examples/apps/uidesigner/vfddesigner.pas
index 1ab14a5d..6eb79b9b 100644
--- a/examples/apps/uidesigner/vfddesigner.pas
+++ b/examples/apps/uidesigner/vfddesigner.pas
@@ -778,20 +778,24 @@ begin
SelectNextWidget(True); // tab forward
end;
- keyF1: ShowMessage('ENTER, F11: switch to Properties' + LineEnding +
+ keyF1:
+ ShowMessage('F11: switch to Properties' + LineEnding +
'TAB, SHIFT+TAB: select next widget' + LineEnding +
- 'F2: edit widget order' + LineEnding +
- 'F4: edit items' + LineEnding
- , 'Small help');
+ 'F2: edit widget order' + LineEnding {+
+ 'F4: edit items' + LineEnding}, 'Small help');
- keyF2: EditWidgetOrder;
+ keyF2:
+ EditWidgetOrder;
- //KEY_F4: if PropertyForm.btnEdit.Visible then PropertyForm.btnEdit.Click;
+ //keyF4:
+ //if frmProperties.btnEdit.Visible then
+ //frmProperties.btnEdit.Click;
- keyF11,
- keyEnter:
- frmProperties.SetFocus;
-// GfxActivateWindow(frmProperties.WinHandle);
+ keyF11:
+ begin
+ frmProperties.SetFocus;
+ frmProperties.ActivateWindow;
+ end;
else
consumed := False;
end;
@@ -1132,8 +1136,7 @@ end;
procedure TFormDesigner.OnPropPosEdit(Sender: TObject);
var
frm: TEditPositionForm;
- btn: TfpgButton;
- ax,
+ ax: TfpgCoord;
ay: TfpgCoord;
wg: TfpgWidget;
n: integer;
@@ -1168,14 +1171,8 @@ begin
if wg = nil then
wg := Form;
- btn := TfpgButton(Sender);
frm := TEditPositionForm.Create(nil);
- btn.WindowToScreen(btn, pt);
-// GfxGetAbsolutePosition(btn.WinHandle, btn.Width, 0, ax, ay);
- ax := pt.X;
- ay := pt.Y;
- frm.Left := ax;
- frm.Top := ay;
+
if Sender = frmProperties.btnLeft then
begin
frm.lbPos.Text := 'Left:';
diff --git a/examples/apps/uidesigner/vfdfile.pas b/examples/apps/uidesigner/vfdfile.pas
index 8c6ab122..15e23d75 100644
--- a/examples/apps/uidesigner/vfdfile.pas
+++ b/examples/apps/uidesigner/vfdfile.pas
@@ -1,7 +1,7 @@
{
fpGUI - Free Pascal GUI Library
- Copyright (C) 2006 - 2007 See the file AUTHORS.txt, included in this
+ Copyright (C) 2006 - 2008 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
See the file COPYING.modifiedLGPL, included in this distribution,
diff --git a/examples/apps/uidesigner/vfdforms.pas b/examples/apps/uidesigner/vfdforms.pas
index 61b33b29..508b64bf 100644
--- a/examples/apps/uidesigner/vfdforms.pas
+++ b/examples/apps/uidesigner/vfdforms.pas
@@ -1,7 +1,7 @@
{
fpGUI - Free Pascal GUI Library
- Copyright (C) 2006 - 2007 See the file AUTHORS.txt, included in this
+ Copyright (C) 2006 - 2008 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
See the file COPYING.modifiedLGPL, included in this distribution,
@@ -49,7 +49,7 @@ type
l2: TfpgLabel;
edClass: TfpgEdit;
edName: TfpgEdit;
- btnOK,
+ btnOK: TfpgButton;
btnCancel: TfpgButton;
procedure AfterCreate; override;
procedure OnButtonClick(Sender: TObject);
@@ -57,10 +57,13 @@ type
TNewFormForm = class(TVFDDialog)
+ private
+ procedure OnedNameKeyPressed(Sender: TObject; var KeyCode: word;
+ var ShiftState: TShiftState; var Consumed: boolean);
public
l1: TfpgLabel;
edName: TfpgEdit;
- btnOK,
+ btnOK: TfpgButton;
btnCancel: TfpgButton;
procedure AfterCreate; override;
procedure OnButtonClick(Sender: TObject);
@@ -68,10 +71,13 @@ type
TEditPositionForm = class(TVFDDialog)
+ private
+ procedure edPosKeyPressed(Sender: TObject; var KeyCode: word;
+ var ShiftState: TShiftState; var Consumed: boolean);
public
lbPos: TfpgLabel;
edPos: TfpgEdit;
- btnOK,
+ btnOK: TfpgButton;
btnCancel: TfpgButton;
procedure AfterCreate; override;
procedure OnButtonClick(Sender: TObject);
@@ -134,7 +140,8 @@ implementation
uses
vfdmain,
fpgfx,
- gui_iniutils;
+ gui_iniutils,
+ gfx_constants;
{ TPaletteForm }
@@ -198,6 +205,13 @@ end;
{ TNewFormForm }
+procedure TNewFormForm.OnedNameKeyPressed(Sender: TObject; var KeyCode: word;
+ var ShiftState: TShiftState; var Consumed: boolean);
+begin
+ if (KeyCode = keyEnter) or (KeyCode = keyPEnter) then
+ btnOK.Click;
+end;
+
procedure TNewFormForm.AfterCreate;
begin
inherited AfterCreate;
@@ -208,8 +222,9 @@ begin
l1 := CreateLabel(self, 8, 8, 'Form name:');
edName := CreateEdit(self, 8, 28, 180, 0);
edName.Text := 'frm';
- btnOK := CreateButton(self, 196, 8, 80, 'OK', @OnButtonClick);
- btnCancel := CreateButton(self, 196, 36, 80, 'Cancel', @OnButtonClick);
+ edName.OnKeyPress := @OnedNameKeyPressed;
+ btnOK := CreateButton(self, 196, 8, 80, rsOK, @OnButtonClick);
+ btnCancel := CreateButton(self, 196, 36, 80, rsCancel, @OnButtonClick);
end;
procedure TNewFormForm.OnButtonClick(Sender: TObject);
@@ -222,6 +237,13 @@ end;
{ TEditPositionForm }
+procedure TEditPositionForm.edPosKeyPressed(Sender: TObject; var KeyCode: word;
+ var ShiftState: TShiftState; var Consumed: boolean);
+begin
+ if (KeyCode = keyEnter) or (KeyCode = keyPEnter) then
+ btnOK.Click;
+end;
+
procedure TEditPositionForm.AfterCreate;
begin
inherited AfterCreate;
@@ -233,12 +255,9 @@ begin
lbPos := CreateLabel(self, 8, 8, 'Pos: ');
edPos := CreateEdit(self, 8, 28, 80, 0);
- btnOK := CreateButton(self, 100, 8, 75, 'OK', @OnButtonClick);
- btnCancel := CreateButton(self, 100, 36, 75, 'Cancel', @OnButtonClick);
- btnOK.ImageName := 'stdimg.ok';
- btnOK.ShowImage := True;
- btnCancel.ImageName := 'stdimg.cancel';
- btnCancel.ShowImage := True;
+ edPos.OnKeyPress := @edPosKeyPressed;
+ btnOK := CreateButton(self, 98, 8, 80, rsOK, @OnButtonClick);
+ btnCancel := CreateButton(self, 98, 36, 80, rsCancel, @OnButtonClick);
end;
procedure TEditPositionForm.OnButtonClick(Sender: TObject);
diff --git a/examples/apps/uidesigner/vfdmain.pas b/examples/apps/uidesigner/vfdmain.pas
index 1b139e61..53145c6d 100644
--- a/examples/apps/uidesigner/vfdmain.pas
+++ b/examples/apps/uidesigner/vfdmain.pas
@@ -1,7 +1,7 @@
{
fpGUI - Free Pascal GUI Library
- Copyright (C) 2006 - 2007 See the file AUTHORS.txt, included in this
+ Copyright (C) 2006 - 2008 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
See the file COPYING.modifiedLGPL, included in this distribution,
diff --git a/examples/apps/uidesigner/vfdwidgetclass.pas b/examples/apps/uidesigner/vfdwidgetclass.pas
index e1b57f50..19308b35 100644
--- a/examples/apps/uidesigner/vfdwidgetclass.pas
+++ b/examples/apps/uidesigner/vfdwidgetclass.pas
@@ -1,7 +1,7 @@
{
fpGUI - Free Pascal GUI Library
- Copyright (C) 2006 - 2007 See the file AUTHORS.txt, included in this
+ Copyright (C) 2006 - 2008 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
See the file COPYING.modifiedLGPL, included in this distribution,
diff --git a/examples/apps/uidesigner/vfdwidgets.pas b/examples/apps/uidesigner/vfdwidgets.pas
index ac415fe3..73088160 100644
--- a/examples/apps/uidesigner/vfdwidgets.pas
+++ b/examples/apps/uidesigner/vfdwidgets.pas
@@ -1,7 +1,7 @@
{
fpGUI - Free Pascal GUI Library
- Copyright (C) 2006 - 2007 See the file AUTHORS.txt, included in this
+ Copyright (C) 2006 - 2008 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
See the file COPYING.modifiedLGPL, included in this distribution,