summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/apps/uidesigner/vfdwidgets.pas35
-rw-r--r--prototypes/fpgui2/tests/edittest.lpi9
-rw-r--r--prototypes/fpgui2/tests/edittest.lpr3
-rw-r--r--src/corelib/gfx_widget.pas5
-rw-r--r--src/gui/gui_button.pas1
-rw-r--r--src/gui/gui_checkbox.pas1
-rw-r--r--src/gui/gui_combobox.pas1
-rw-r--r--src/gui/gui_edit.pas1
-rw-r--r--src/gui/gui_grid.pas24
-rw-r--r--src/gui/gui_listbox.pas1
-rw-r--r--src/gui/gui_listview.pas1
-rw-r--r--src/gui/gui_memo.pas1
-rw-r--r--src/gui/gui_radiobutton.pas94
-rw-r--r--src/gui/gui_tab.pas1
-rw-r--r--src/gui/gui_trackbar.pas2
-rw-r--r--src/gui/gui_tree.pas1
16 files changed, 148 insertions, 33 deletions
diff --git a/examples/apps/uidesigner/vfdwidgets.pas b/examples/apps/uidesigner/vfdwidgets.pas
index 407f2b48..678de21a 100644
--- a/examples/apps/uidesigner/vfdwidgets.pas
+++ b/examples/apps/uidesigner/vfdwidgets.pas
@@ -234,6 +234,7 @@ begin
wc := TVFDWidgetClass.Create(TfpgEdit);
wc.NameBase := 'edtName';
// wc.AddProperty('Color', TPropertyColor, 'Text color');
+ wc.AddProperty('TabOrder', TPropertyInteger, 'The tab order');
wc.AddProperty('Text', TPropertyString, 'Initial text');
wc.AddProperty('FontDesc', TPropertyString, 'The font used for displaying the text');
wc.WidgetIconName := 'vfd.edit';
@@ -244,6 +245,7 @@ begin
wc.NameBase := 'memName';
wc.AddProperty('Lines', TPropertyStringList, '');
wc.AddProperty('FontDesc', TPropertyString, 'The font used for displaying the text');
+ wc.AddProperty('TabOrder', TPropertyInteger, 'The tab order');
wc.WidgetIconName := 'vfd.memo';
RegisterVFDWidget(wc);
@@ -260,33 +262,37 @@ begin
wc.AddProperty('ImageSpacing', TPropertyInteger, '');
wc.AddProperty('ModalResult', TPropertyInteger, '');
wc.AddProperty('ShowImage', TPropertyBoolean, 'Boolean value');
+ wc.AddProperty('TabOrder', TPropertyInteger, 'The tab order');
wc.WidgetIconName := 'vfd.button';
RegisterVFDWidget(wc);
// CheckBox
wc := TVFDWidgetClass.Create(TfpgCheckBox);
wc.NameBase := 'cbName';
- wc.AddProperty('Text', TPropertyString, 'Initial text');
- wc.AddProperty('FontDesc', TPropertyString, 'The font used for displaying the text');
wc.AddProperty('Checked', TPropertyBoolean, 'Boolean value');
+ wc.AddProperty('FontDesc', TPropertyString, 'The font used for displaying the text');
+ wc.AddProperty('TabOrder', TPropertyInteger, 'The tab order');
+ wc.AddProperty('Text', TPropertyString, 'Initial text');
wc.WidgetIconName := 'vfd.checkbox';
RegisterVFDWidget(wc);
// RadioButton
wc := TVFDWidgetClass.Create(TfpgRadioButton);
wc.NameBase := 'rbName';
- wc.AddProperty('Text', TPropertyString, 'Initial text');
+ wc.AddProperty('Checked', TPropertyBoolean, 'Boolean value');
wc.AddProperty('FontDesc', TPropertyString, 'The font used for displaying the text');
wc.AddProperty('GroupIndex', TPropertyInteger, '');
- wc.AddProperty('Checked', TPropertyBoolean, 'Boolean value');
+ wc.AddProperty('TabOrder', TPropertyInteger, 'The tab order');
+ wc.AddProperty('Text', TPropertyString, 'Initial text');
wc.WidgetIconName := 'vfd.radiobutton';
RegisterVFDWidget(wc);
// ComboBox
wc := TVFDWidgetClass.Create(TfpgComboBox);
wc.NameBase := 'cbName';
- wc.AddProperty('Items', TPropertyStringList, '');
wc.AddProperty('FontDesc', TPropertyString, 'The font used for displaying the text');
+ wc.AddProperty('Items', TPropertyStringList, '');
+ wc.AddProperty('TabOrder', TPropertyInteger, 'The tab order');
wc.WidgetIconName := 'vfd.combobox';
RegisterVFDWidget(wc);
@@ -294,16 +300,18 @@ begin
wc := TVFDWidgetClass.Create(TfpgCalendarCombo);
wc.NameBase := 'calName';
wc.AddProperty('FontDesc', TPropertyString, 'The font used for displaying the text');
+ wc.AddProperty('TabOrder', TPropertyInteger, 'The tab order');
wc.WidgetIconName := 'vfd.combodateedit';
RegisterVFDWidget(wc);
// ListBox
wc := TVFDWidgetClass.Create(TfpgListBox);
wc.NameBase := 'lstName';
+ wc.AddProperty('FontDesc', TPropertyString, 'The font used for displaying the text');
wc.AddProperty('HotTrack', TPropertyBoolean, '');
wc.AddProperty('Items', TPropertyStringList, '');
- wc.AddProperty('FontDesc', TPropertyString, 'The font used for displaying the text');
wc.AddProperty('PopupFrame', TPropertyBoolean, '');
+ wc.AddProperty('TabOrder', TPropertyInteger, 'The tab order');
wc.WidgetIconName := 'vfd.listbox';
RegisterVFDWidget(wc);
@@ -317,6 +325,7 @@ begin
wc.AddProperty('RowSelect', TPropertyBoolean, '');
wc.AddProperty('ShowHeader', TPropertyBoolean, '');
wc.AddProperty('ShowGrid', TPropertyBoolean, '');
+ wc.AddProperty('TabOrder', TPropertyInteger, 'The tab order');
wc.WidgetIconName := 'vfd.stringgrid';
RegisterVFDWidget(wc);
@@ -341,10 +350,11 @@ begin
// TrackBar
wc := TVFDWidgetClass.Create(TfpgTrackBar);
wc.NameBase := 'tbName';
- wc.AddProperty('Min', TPropertyInteger, '');
wc.AddProperty('Max', TPropertyInteger, '');
- wc.AddProperty('Position', TPropertyInteger, '');
+ wc.AddProperty('Min', TPropertyInteger, '');
wc.AddProperty('Orientation', TPropertyEnum, '');
+ wc.AddProperty('Position', TPropertyInteger, '');
+ wc.AddProperty('TabOrder', TPropertyInteger, 'The tab order');
wc.WidgetIconName := 'vfd.trackbar';
RegisterVFDWidget(wc);
@@ -353,18 +363,20 @@ begin
wc.NameBase := 'lvName';
wc.AddProperty('MultiSelect', TPropertyBoolean, '');
wc.AddProperty('ShowHeaders', TPropertyBoolean, '');
+ wc.AddProperty('TabOrder', TPropertyInteger, 'The tab order');
wc.WidgetIconName := 'vfd.listview';
RegisterVFDWidget(wc);
// Treeview
wc := TVFDWidgetClass.Create(TfpgTreeView);
wc.NameBase := 'tvName';
+ wc.AddProperty('DefaultColumnWidth',TPropertyInteger, '');
wc.AddProperty('FontDesc',TPropertyString, '');
- wc.AddProperty('ShowImages',TPropertyBoolean, 'Boolean value');
+ wc.AddProperty('ScrollWheelDelta', TPropertyInteger, 'Scroll amount with mouse wheel');
wc.AddProperty('ShowColumns',TPropertyBoolean, 'Boolean value');
- wc.AddProperty('DefaultColumnWidth',TPropertyInteger, '');
+ wc.AddProperty('ShowImages',TPropertyBoolean, 'Boolean value');
+ wc.AddProperty('TabOrder', TPropertyInteger, 'The tab order');
wc.AddProperty('TreeLineStyle', TPropertyEnum, '');
- wc.AddProperty('ScrollWheelDelta', TPropertyInteger, 'Scroll amount with mouse wheel');
wc.WidgetIconName := 'vfd.treeview';
RegisterVFDWidget(wc);
@@ -374,6 +386,7 @@ begin
wc.AddProperty('FixedTabWidth', TPropertyInteger, '');
wc.AddProperty('SortPages', TPropertyBoolean, 'Boolean value');
wc.AddProperty('Style', TPropertyEnum, '');
+ wc.AddProperty('TabOrder', TPropertyInteger, 'The tab order');
wc.AddProperty('TabPosition', TPropertyEnum, '');
wc.WidgetIconName := 'vfd.pagecontrol';
RegisterVFDWidget(wc);
diff --git a/prototypes/fpgui2/tests/edittest.lpi b/prototypes/fpgui2/tests/edittest.lpi
index 8b8c2d24..2879bbde 100644
--- a/prototypes/fpgui2/tests/edittest.lpi
+++ b/prototypes/fpgui2/tests/edittest.lpi
@@ -1,15 +1,15 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
- <PathDelim Value="\"/>
- <Version Value="5"/>
+ <PathDelim Value="/"/>
+ <Version Value="6"/>
<General>
<Flags>
<SaveOnlyProjectUnits Value="True"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
- <IconPath Value=".\"/>
+ <IconPath Value="./"/>
<TargetFileExt Value=""/>
</General>
<VersionInfo>
@@ -23,7 +23,7 @@
<RunParams>
<local>
<FormatVersion Value="1"/>
- <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
+ <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="1">
@@ -47,7 +47,6 @@
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
- <PathDelim Value="\"/>
<CodeGeneration>
<Generate Value="Faster"/>
</CodeGeneration>
diff --git a/prototypes/fpgui2/tests/edittest.lpr b/prototypes/fpgui2/tests/edittest.lpr
index aa0dddbf..dd407ad8 100644
--- a/prototypes/fpgui2/tests/edittest.lpr
+++ b/prototypes/fpgui2/tests/edittest.lpr
@@ -485,8 +485,11 @@ begin
checkbox2 := CreateCheckBox(self, 10, 285, 'Checkbox Two');
radiobtn1 := CreateRadioButton(self, 180, 265, 'Radio One');
+ radiobtn1.GroupIndex := 2;
radiobtn2 := CreateRadioButton(self, 180, 285, 'Radio Two');
+ radiobtn2.GroupIndex := 2;
radiobtn3 := CreateRadioButton(self, 180, 305, 'Radio Three');
+ radiobtn3.GroupIndex := 2;
radiobtn1.Checked := True;
trackbar1 := TfpgTrackBar.Create(self);
diff --git a/src/corelib/gfx_widget.pas b/src/corelib/gfx_widget.pas
index f4b5917b..0a665018 100644
--- a/src/corelib/gfx_widget.pas
+++ b/src/corelib/gfx_widget.pas
@@ -245,7 +245,10 @@ begin
FTextColor := clText1;
if (AOwner <> nil) and (AOwner is TfpgWidget) then
- Parent := TfpgWidget(AOwner)
+ begin
+ Parent := TfpgWidget(AOwner);
+ FTabOrder := AOwner.ComponentCount;
+ end
else
Parent := nil;
diff --git a/src/gui/gui_button.pas b/src/gui/gui_button.pas
index 21bc8b73..dfbf1606 100644
--- a/src/gui/gui_button.pas
+++ b/src/gui/gui_button.pas
@@ -95,6 +95,7 @@ type
property ImageSpacing: integer read FImageSpacing write SetImageSpacing default -1;
property ModalResult: integer read FModalResult write FModalResult default 0;
property ShowImage: Boolean read FShowImage write SetShowImage default True;
+ property TabOrder;
property Text: string read FText write SetText;
property TextColor;
property OnMouseExit;
diff --git a/src/gui/gui_checkbox.pas b/src/gui/gui_checkbox.pas
index 33a14fa0..9863ff05 100644
--- a/src/gui/gui_checkbox.pas
+++ b/src/gui/gui_checkbox.pas
@@ -57,6 +57,7 @@ type
property BackgroundColor;
property Checked: boolean read FChecked write SetChecked default False;
property FontDesc: string read GetFontDesc write SetFontDesc;
+ property TabOrder;
property Text: string read FText write SetText;
property TextColor;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
diff --git a/src/gui/gui_combobox.pas b/src/gui/gui_combobox.pas
index d12e6213..4c4ca9d5 100644
--- a/src/gui/gui_combobox.pas
+++ b/src/gui/gui_combobox.pas
@@ -112,6 +112,7 @@ type
property FontDesc;
property Height;
property Items;
+ property TabOrder;
property Text;
property TextColor;
property Width;
diff --git a/src/gui/gui_edit.pas b/src/gui/gui_edit.pas
index 01386b5e..77deecee 100644
--- a/src/gui/gui_edit.pas
+++ b/src/gui/gui_edit.pas
@@ -116,6 +116,7 @@ type
property HideSelection;
property MaxLength;
property PasswordMode;
+ property TabOrder;
property Text;
property TextColor;
property OnChange;
diff --git a/src/gui/gui_grid.pas b/src/gui/gui_grid.pas
index 36b71b06..e1a6b718 100644
--- a/src/gui/gui_grid.pas
+++ b/src/gui/gui_grid.pas
@@ -142,6 +142,7 @@ type
property Columns;
property FocusRow;
property ScrollBarStyle;
+ property TabOrder;
property OnRowChange;
property OnDoubleClick;
end;
@@ -190,27 +191,28 @@ type
TfpgStringGrid = class(TfpgCustomStringGrid)
published
+ property BackgroundColor;
+// property ColResizing;
+ property ColumnCount;
property Columns;
+ property ColumnWidth;
property DefaultColWidth;
property DefaultRowHeight;
- property FontDesc;
- property HeaderFontDesc;
- property BackgroundColor;
property FocusCol;
property FocusRow;
- property RowSelect;
- property ColumnCount;
+ property FontDesc;
+ property HeaderFontDesc;
+ property HeaderHeight;
property RowCount;
+ property RowSelect;
property ScrollBarStyle;
- property ShowHeader;
property ShowGrid;
- property HeaderHeight;
-// property ColResizing;
- property ColumnWidth;
- property OnFocusChange;
- property OnRowChange;
+ property ShowHeader;
+ property TabOrder;
property OnDoubleClick;
+ property OnFocusChange;
property OnKeyPress;
+ property OnRowChange;
end;
diff --git a/src/gui/gui_listbox.pas b/src/gui/gui_listbox.pas
index 97dd59d9..29cf50f7 100644
--- a/src/gui/gui_listbox.pas
+++ b/src/gui/gui_listbox.pas
@@ -124,6 +124,7 @@ type
property HotTrack;
property Items;
property PopupFrame;
+ property TabOrder;
property TextColor;
end;
diff --git a/src/gui/gui_listview.pas b/src/gui/gui_listview.pas
index 68b73d80..5c2a4b27 100644
--- a/src/gui/gui_listview.pas
+++ b/src/gui/gui_listview.pas
@@ -253,6 +253,7 @@ type
property HScrollBar: TfpgScrollBar read FHScrollBar;
property ItemHeight: Integer read GetItemHeight;
property ItemIndex: Integer read FItemIndex write SetItemIndex;
+ property TabOrder;
property OnColumnClick: TfpgLVColumnClickEvent read FOnColumnClick write SetOnColumnClick;
property OnPaintColumn: TfpgLVPaintColumnEvent read FOnPaintColumn write FOnPaintColumn;
property OnPaintItem: TfpgLVPaintItemEvent read FOnPaintItem write FOnPaintItem;
diff --git a/src/gui/gui_memo.pas b/src/gui/gui_memo.pas
index ec484d5b..99fa6211 100644
--- a/src/gui/gui_memo.pas
+++ b/src/gui/gui_memo.pas
@@ -112,6 +112,7 @@ type
property BackgroundColor default clBoxColor;
property FontDesc: string read GetFontDesc write SetFontDesc;
property Lines: TStringList read FLines;
+ property TabOrder;
property TextColor;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
end;
diff --git a/src/gui/gui_radiobutton.pas b/src/gui/gui_radiobutton.pas
index 8596530c..1bb2533d 100644
--- a/src/gui/gui_radiobutton.pas
+++ b/src/gui/gui_radiobutton.pas
@@ -49,7 +49,9 @@ type
procedure HandlePaint; override;
procedure HandleLMouseDown(x, y: integer; shiftstate: TShiftState); override;
procedure HandleLMouseUp(x, y: integer; shiftstate: TShiftState); override;
+ procedure HandleKeyPress(var keycode: word; var shiftstate: TShiftState; var consumed: boolean); override;
procedure HandleKeyRelease(var keycode: word; var shiftstate: TShiftState; var consumed: boolean); override;
+ function FindNeighbor(direction: TFocusSearchDirection): TfpgRadioButton;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
@@ -59,6 +61,7 @@ type
property Checked: boolean read FChecked write SetChecked default False;
property FontDesc: string read GetFontDesc write SetFontDesc;
property GroupIndex: integer read FGroupIndex write FGroupIndex;
+ property TabOrder;
property Text: string read FText write SetText;
property TextColor;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
@@ -109,6 +112,9 @@ begin
end; { if }
RePaint;
+
+ if Assigned(FOnChange) then
+ FOnChange(self);
end;
procedure TfpgRadioButton.SetFontDesc(const AValue: string);
@@ -194,22 +200,48 @@ begin
if not Checked then
begin
Checked := not FChecked;
- if Assigned(FOnChange) then
- FOnChange(self);
end
else
RePaint;
end;
+procedure TfpgRadioButton.HandleKeyPress(var keycode: word;
+ var shiftstate: TShiftState; var consumed: boolean);
+var
+ nbr: TfpgRadioButton;
+begin
+ if (keycode = keyUp) then
+ begin
+ consumed := True;
+ nbr := FindNeighbor(fsdPrev);
+ if nbr = Self then
+ nbr := FindNeighbor(fsdLast);
+ nbr.SetFocus;
+ nbr.Checked := True;
+ end else
+ if (keycode = keyDown) then
+ begin
+ consumed := True;
+ nbr := FindNeighbor(fsdNext);
+ if nbr = Self then
+ nbr := FindNeighbor(fsdFirst);
+ nbr.SetFocus;
+ nbr.Checked := True;
+ end;
+
+ if consumed then
+ Exit; //==>
+
+ inherited HandleKeyPress(keycode, shiftstate, consumed);
+end;
+
procedure TfpgRadioButton.HandleKeyRelease(var keycode: word;
var shiftstate: TShiftState; var consumed: boolean);
begin
if (keycode = keySpace) then
begin
consumed := True;
- Checked := not FChecked;
- if Assigned(FOnChange) then
- FOnChange(self);
+ Checked := true;
end;
if consumed then
@@ -218,6 +250,58 @@ begin
inherited HandleKeyRelease(keycode, shiftstate, consumed);
end;
+function TfpgRadioButton.FindNeighbor(direction: TFocusSearchDirection): TfpgRadioButton;
+var
+ i: integer;
+ wg, bestwg: TfpgWidget;
+ bestdsp, dsp: integer; // spacing delta
+begin
+ if (Parent <> nil) then
+ begin
+ case direction of
+ fsdNext: bestdsp := High(integer); // or "-999999" like that in TfpgWidget.FindFocusWidget?
+ fsdPrev: bestdsp := Low(integer); // or "999999"?
+ end;
+
+ bestwg := Self;
+ for i := 0 to Parent.ComponentCount-1 do
+ begin
+ wg := TfpgWidget(Parent.Components[i]);
+ if (wg <> nil) and (wg <> self) and (wg is TfpgRadioButton) and
+ (TfpgRadioButton(wg).GroupIndex = GroupIndex) then
+ begin
+ case direction of
+ fsdNext:
+ begin
+ dsp := (wg.Top - Self.Top) + (wg.Left - Self.Left);
+ if (dsp > 0) and (dsp < bestdsp) then
+ begin
+ bestwg := wg;
+ bestdsp := dsp;
+ end;
+ end;
+ fsdPrev:
+ begin
+ dsp := (wg.Top - Self.Top) + (wg.Left - Self.Left);
+ if (dsp < 0) and (dsp > bestdsp) then
+ begin
+ bestwg := wg;
+ bestdsp := dsp;
+ end;
+ end;
+ fsdFirst:
+ if (wg.Top < bestwg.Top) then
+ bestwg := wg;
+ fsdLast:
+ if (wg.Top > bestwg.Top) then
+ bestwg := wg;
+ end;
+ Result := TfpgRadioButton(bestwg);
+ end;
+ end; { for }
+ end; { if }
+end;
+
constructor TfpgRadioButton.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
diff --git a/src/gui/gui_tab.pas b/src/gui/gui_tab.pas
index f9f9a1c8..ba88be8e 100644
--- a/src/gui/gui_tab.pas
+++ b/src/gui/gui_tab.pas
@@ -126,6 +126,7 @@ type
property FixedTabWidth: integer read FFixedTabWidth write SetFixedTabWidth default 0;
property SortPages: boolean read FSortPages write SetSortPages default False;
property Style: TfpgTabStyle read FStyle write SetStyle default tsTabs;
+ property TabOrder;
property TabPosition: TfpgTabPosition read FTabPosition write SetTabPosition default tpTop;
property TextColor;
end;
diff --git a/src/gui/gui_trackbar.pas b/src/gui/gui_trackbar.pas
index 962c4c8a..6f80661a 100644
--- a/src/gui/gui_trackbar.pas
+++ b/src/gui/gui_trackbar.pas
@@ -74,6 +74,7 @@ type
property Position: integer read FPosition write SetPosition default 0;
property SliderSize: integer read FSliderSize write SetSliderSize default 11;
property Orientation: TOrientation read FOrientation write FOrientation default orHorizontal;
+ property TabOrder;
property OnChange: TTrackBarChange read FOnChange write FOnChange;
end;
@@ -118,6 +119,7 @@ type
property Max: integer read FMax write SetMax default 100;
property ShowPosition: boolean read FShowPosition write SetShowPosition default False;
property Orientation: TOrientation read FOrientation write FOrientation default orHorizontal;
+ property TabOrder;
property TextColor;
property OnChange: TTrackBarChange read FOnChange write FOnChange;
end;
diff --git a/src/gui/gui_tree.pas b/src/gui/gui_tree.pas
index 656116ed..5133a068 100644
--- a/src/gui/gui_tree.pas
+++ b/src/gui/gui_tree.pas
@@ -208,6 +208,7 @@ type
property ScrollWheelDelta: integer read FScrollWheelDelta write FScrollWheelDelta default 15;
property ShowColumns: boolean read FShowColumns write SetShowColumns default False;
property ShowImages: boolean read FShowImages write SetShowImages default False;
+ property TabOrder;
property TreeLineColor: TfpgColor read FTreeLineColor write SetTreeLineColor default clShadow1;
property TreeLineStyle: TfpgLineStyle read FTreeLineStyle write SetTreeLineStyle default lsDot;
property OnChange: TNotifyEvent read FOnChange write FOnChange;