diff options
-rw-r--r-- | examples/apps/uidesigner/newformdesigner.pas | 6 | ||||
-rw-r--r-- | examples/apps/uidesigner/uidesigner.lpr | 2 | ||||
-rw-r--r-- | examples/apps/uidesigner/vfddesigner.pas | 35 | ||||
-rw-r--r-- | examples/apps/uidesigner/vfdfile.pas | 2 | ||||
-rw-r--r-- | examples/apps/uidesigner/vfdforms.pas | 45 | ||||
-rw-r--r-- | examples/apps/uidesigner/vfdmain.pas | 2 | ||||
-rw-r--r-- | examples/apps/uidesigner/vfdwidgetclass.pas | 2 | ||||
-rw-r--r-- | examples/apps/uidesigner/vfdwidgets.pas | 2 | ||||
-rw-r--r-- | src/gui/gui_button.pas | 4 | ||||
-rw-r--r-- | src/gui/gui_checkbox.pas | 2 | ||||
-rw-r--r-- | src/gui/gui_editcombo.pas | 2 | ||||
-rw-r--r-- | src/gui/gui_listbox.pas | 2 | ||||
-rw-r--r-- | src/gui/gui_memo.pas | 2 |
13 files changed, 63 insertions, 45 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, diff --git a/src/gui/gui_button.pas b/src/gui/gui_button.pas index d6ae9b94..3e8a229d 100644 --- a/src/gui/gui_button.pas +++ b/src/gui/gui_button.pas @@ -400,7 +400,7 @@ end; procedure TfpgButton.HandleKeyPress(var keycode: word; var shiftstate: TShiftState; var consumed: boolean); begin - if (keycode = keyReturn) or (keycode = keySpace) then + if (keycode = keyReturn) or (keycode = keySpace) or (keycode = keyPEnter) then begin DoPush; Consumed := True; @@ -411,7 +411,7 @@ end; procedure TfpgButton.HandleKeyRelease(var keycode: word; var shiftstate: TShiftState; var consumed: boolean); begin - if (keycode = keyReturn) or (keycode = keySpace) then + if (keycode = keyReturn) or (keycode = keySpace) or (keycode = keyPEnter) then begin DoRelease(1, 1); // fake co-ordinates to it executes the Click Consumed := True; diff --git a/src/gui/gui_checkbox.pas b/src/gui/gui_checkbox.pas index 0ccf2c02..708759ea 100644 --- a/src/gui/gui_checkbox.pas +++ b/src/gui/gui_checkbox.pas @@ -179,7 +179,7 @@ end; procedure TfpgCheckBox.HandleKeyRelease(var keycode: word; var shiftstate: TShiftState; var consumed: boolean); begin - if (keycode = keySpace) or (keycode = keyReturn) then + if (keycode = keySpace) or (keycode = keyReturn) or (keycode = keyPEnter) then begin consumed := True; Checked := not FChecked; diff --git a/src/gui/gui_editcombo.pas b/src/gui/gui_editcombo.pas index 8d428e29..a9c32cc9 100644 --- a/src/gui/gui_editcombo.pas +++ b/src/gui/gui_editcombo.pas @@ -510,7 +510,7 @@ begin hasChanged := True; end; - keyReturn: + keyReturn, keyPEnter: begin if FSelectedItem > -1 then SetText(Items[FSelectedItem]) diff --git a/src/gui/gui_listbox.pas b/src/gui/gui_listbox.pas index 1b6ef3be..415e8db3 100644 --- a/src/gui/gui_listbox.pas +++ b/src/gui/gui_listbox.pas @@ -471,7 +471,7 @@ begin FocusItem := ItemCount; end; - keyReturn: + keyReturn, keyPEnter: begin if FocusItem > 0 then DoSelect; diff --git a/src/gui/gui_memo.pas b/src/gui/gui_memo.pas index 14caa6c3..e606c85a 100644 --- a/src/gui/gui_memo.pas +++ b/src/gui/gui_memo.pas @@ -1046,7 +1046,7 @@ begin consumed := True; case keycode of - keyReturn: + keyReturn, keyPEnter: begin ls := UTF8Copy(FLines[FCursorline - 1], 1, FCursorPos); ls2 := UTF8Copy(FLines[FCursorline - 1], FCursorPos + 1, UTF8Length(FLines[FCursorline - 1])); |