summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/gui/menutest/menutest.lpr8
-rw-r--r--src/corelib/gdi/fpgfx_package.lpk2
-rw-r--r--src/corelib/x11/fpgfx_package.lpk2
-rw-r--r--src/gui/fpgui_package.lpk10
-rw-r--r--src/gui/gui_form.pas34
-rw-r--r--src/gui/gui_menu.pas19
-rw-r--r--src/gui/gui_trackbar.pas7
7 files changed, 67 insertions, 15 deletions
diff --git a/examples/gui/menutest/menutest.lpr b/examples/gui/menutest/menutest.lpr
index 2c0bf843..cac4e8e7 100644
--- a/examples/gui/menutest/menutest.lpr
+++ b/examples/gui/menutest/menutest.lpr
@@ -9,7 +9,8 @@ uses
Classes,
fpgfx,
gui_form,
- gui_menu;
+ gui_menu,
+ gui_edit;
type
TMainForm = class(TfpgForm)
@@ -19,11 +20,13 @@ type
FEditSubMenu: TfpgPopupMenu;
FEditSelectSubMenu: TfpgPopupMenu;
FHelpSubMenu: TfpgPopupMenu;
+ edit1: TfpgEdit;
procedure miExitClicked(Sender: TObject);
public
constructor Create(AOwner: TComponent); override;
end;
+
{ TMainForm }
procedure TMainForm.miExitClicked(Sender: TObject);
@@ -75,6 +78,9 @@ begin
FMenuBar.AddMenuItem('&Disabled', nil).Enabled := False;
FMenuBar.AddMenuItem('&Help', nil).SubMenu := FHelpSubMenu;
+
+ edit1 := TfpgEdit.Create(self);
+ edit1.SetPosition(10, 70, 100, 24);
end;
diff --git a/src/corelib/gdi/fpgfx_package.lpk b/src/corelib/gdi/fpgfx_package.lpk
index 66963c07..8b6d510d 100644
--- a/src/corelib/gdi/fpgfx_package.lpk
+++ b/src/corelib/gdi/fpgfx_package.lpk
@@ -10,7 +10,7 @@
<SearchPaths>
<IncludeFiles Value="..\"/>
<OtherUnitFiles Value="..\;..\..\gui\"/>
- <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
+ <UnitOutputDirectory Value="..\..\..\lib\"/>
</SearchPaths>
<CodeGeneration>
<Optimizations>
diff --git a/src/corelib/x11/fpgfx_package.lpk b/src/corelib/x11/fpgfx_package.lpk
index 222667ee..887a3443 100644
--- a/src/corelib/x11/fpgfx_package.lpk
+++ b/src/corelib/x11/fpgfx_package.lpk
@@ -8,7 +8,7 @@
<SearchPaths>
<IncludeFiles Value="../"/>
<OtherUnitFiles Value="../;../../gui/"/>
- <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
+ <UnitOutputDirectory Value="../../../lib/"/>
</SearchPaths>
<CodeGeneration>
<Optimizations>
diff --git a/src/gui/fpgui_package.lpk b/src/gui/fpgui_package.lpk
index f6cab529..d6f2e0ae 100644
--- a/src/gui/fpgui_package.lpk
+++ b/src/gui/fpgui_package.lpk
@@ -6,7 +6,7 @@
<CompilerOptions>
<Version Value="5"/>
<SearchPaths>
- <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
+ <UnitOutputDirectory Value="../../lib/"/>
</SearchPaths>
<CodeGeneration>
<Generate Value="Faster"/>
@@ -106,12 +106,12 @@
</Files>
<RequiredPkgs Count="2">
<Item1>
- <PackageName Value="fpgfx_package"/>
- <MinVersion Minor="5" Valid="True"/>
- </Item1>
- <Item2>
<PackageName Value="FCL"/>
<MinVersion Major="1" Valid="True"/>
+ </Item1>
+ <Item2>
+ <PackageName Value="fpgfx_package"/>
+ <MinVersion Minor="5" Valid="True"/>
</Item2>
</RequiredPkgs>
<UsageOptions>
diff --git a/src/gui/gui_form.pas b/src/gui/gui_form.pas
index 10de2a44..d4fb9ace 100644
--- a/src/gui/gui_form.pas
+++ b/src/gui/gui_form.pas
@@ -41,6 +41,7 @@ type
procedure HandleClose; virtual;
procedure HandleHide; override;
procedure HandleShow; override;
+ procedure HandleKeyPress(var keycode: word; var shiftstate: TShiftState; var consumed: boolean); override;
procedure AfterConstruction; override;
procedure BeforeDestruction; override;
public
@@ -72,7 +73,14 @@ function WidgetParentForm(wg: TfpgWidget): TfpgForm;
implementation
uses
- fpgfx;
+ fpgfx,
+ gui_menu;
+
+type
+ // to access protected methods
+ TfpgMenuBarFriend = class(TfpgMenuBar)
+ end;
+
function WidgetParentForm(wg: TfpgWidget): TfpgForm;
var
@@ -226,6 +234,30 @@ begin
FOnShow(self);
end;
+procedure TfpgForm.HandleKeyPress(var keycode: word;
+ var shiftstate: TShiftState; var consumed: boolean);
+var
+ i: integer;
+ wg: TfpgWidget;
+begin
+// writeln(Classname, '.Keypress');
+ // find the TfpgMenuBar
+ if not consumed then
+ begin
+ for i := 0 to ComponentCount-1 do
+ begin
+ wg := TfpgWidget(Components[i]);
+ if (wg <> nil) and (wg <> self) and (wg is TfpgMenuBar) then
+ begin
+ TfpgMenuBarFriend(wg).HandleKeyPress(keycode, shiftstate, consumed);
+ Break; //==>
+ end;
+ end;
+ end; { if }
+
+ inherited HandleKeyPress(keycode, shiftstate, consumed);
+end;
+
procedure TfpgForm.AfterConstruction;
begin
inherited AfterConstruction;
diff --git a/src/gui/gui_menu.pas b/src/gui/gui_menu.pas
index c34d40a9..74ab2d6f 100644
--- a/src/gui/gui_menu.pas
+++ b/src/gui/gui_menu.pas
@@ -365,7 +365,26 @@ end;
procedure TfpgMenuBar.HandleKeyPress(var keycode: word;
var shiftstate: TShiftState; var consumed: boolean);
+var
+ s: string;
+ i: integer;
begin
+// writeln(Classname, '.Keypress');
+ s := KeycodeToText(keycode, shiftstate);
+// writeln('s: ', s);
+ // handle MenuBar (Alt+?) shortcuts only - for now!
+ if (length(s) = 5) and (copy(s, 1, 4) = 'Alt+') then
+ begin
+ s := KeycodeToText(keycode, []);
+ i := SearchItemByAccel(s);
+ if i <> -1 then
+ begin
+ consumed := True;
+// writeln('Selected ', VisibleItem(i).Text);
+ FFocusItem := i;
+ DoSelect;
+ end;
+ end;
inherited HandleKeyPress(keycode, shiftstate, consumed);
end;
diff --git a/src/gui/gui_trackbar.pas b/src/gui/gui_trackbar.pas
index 1ff04486..39d8ffe3 100644
--- a/src/gui/gui_trackbar.pas
+++ b/src/gui/gui_trackbar.pas
@@ -22,8 +22,7 @@ uses
SysUtils,
gfxbase,
fpgfx,
- gfx_widget,
- gui_scrollbar;
+ gfx_widget;
type
TTrackBarChange = procedure(Sender: TObject; APosition: integer) of object;
@@ -75,11 +74,8 @@ type
FSliderPos: TfpgCoord;
FSliderLength: TfpgCoord;
FSliderDragging: boolean;
- FStartBtnPressed,
- FEndBtnPressed: Boolean;
FSliderDragPos: TfpgCoord;
FSliderDragStart: TfpgCoord;
- FActiveButtonRect: TfpgRect;
FMousePosition: TPoint;
FOnChange: TTrackBarChange;
FFont: TfpgFont;
@@ -281,7 +277,6 @@ end;
procedure TfpgTrackBarExtra.HandleLMouseUp(x, y: integer; shiftstate: TShiftState);
var
- p: integer;
linepos: double;
drawwidth: integer;
OldPos: integer;