summaryrefslogtreecommitdiff
path: root/examples/apps
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-03-26 14:06:25 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-03-26 14:06:25 +0000
commit74def83309137d0db51031b422c9d8e894ba72f7 (patch)
treedf6dbd204f9d08f96380d7982ebbcb818d3108f0 /examples/apps
parent65249d0bb04c15a543060f782b2c669ea5210cfd (diff)
downloadfpGUI-74def83309137d0db51031b422c9d8e894ba72f7.tar.xz
* UI Designer now has a very basic way of setting the TabOrder. Still a lot of improvements are needed, but it's working on simple forms.
Diffstat (limited to 'examples/apps')
-rw-r--r--examples/apps/uidesigner/newformdesigner.pas2
-rw-r--r--examples/apps/uidesigner/vfddesigner.pas67
-rw-r--r--examples/apps/uidesigner/vfdmain.pas7
3 files changed, 74 insertions, 2 deletions
diff --git a/examples/apps/uidesigner/newformdesigner.pas b/examples/apps/uidesigner/newformdesigner.pas
index e666c68c..9b0fb1b6 100644
--- a/examples/apps/uidesigner/newformdesigner.pas
+++ b/examples/apps/uidesigner/newformdesigner.pas
@@ -369,7 +369,7 @@ begin
Name := 'formmenu';
SetPosition(464, 48, 120, 20);
AddMenuItem('Widget Order...', '', @(maindsgn.OnEditWidgetOrder));
- AddMenuItem('Tab Order...', '', nil).Enabled := False; // TODO
+ AddMenuItem('Tab Order...', '', @(maindsgn.OnEditTabOrder));
AddMenuItem('-', '', nil);
AddMenuItem('Edit special...', '', nil).Enabled := False; // TODO
end;
diff --git a/examples/apps/uidesigner/vfddesigner.pas b/examples/apps/uidesigner/vfddesigner.pas
index 227e04bd..8e107ddf 100644
--- a/examples/apps/uidesigner/vfddesigner.pas
+++ b/examples/apps/uidesigner/vfddesigner.pas
@@ -119,6 +119,7 @@ type
procedure MoveResizeWidgets(dx, dy, dw, dh: integer);
procedure DeleteWidgets;
procedure EditWidgetOrder;
+ procedure EditTabOrder;
// procedure PutControlByName(x, y: integer; cname: string);
procedure InsertWidget(pwg: TfpgWidget; x, y: integer; wgc: TVFDWidgetClass);
procedure OnPaletteChange(Sender: TObject);
@@ -142,7 +143,7 @@ type
implementation
uses
- vfdmain;
+ vfdmain, TypInfo;
{ TWidgetDesigner }
@@ -684,6 +685,70 @@ begin
frm.Free;
end;
+procedure TFormDesigner.EditTabOrder;
+const
+ cDivider = ' : ';
+var
+ frm: TWidgetOrderForm;
+ n, fi, i: integer;
+ cd: TWidgetDesigner;
+ identlevel: integer;
+ s: string;
+ taborder: integer;
+
+ procedure AddChildWidgets(pwg: TfpgWidget; slist: TStrings);
+ var
+ f: integer;
+ fcd: TWidgetDesigner;
+ begin
+ for f := 0 to FWidgets.Count - 1 do
+ begin
+ fcd := TWidgetDesigner(FWidgets.Items[f]);
+
+ if fcd.Widget.Parent = pwg then
+ begin
+ frm.list.Items.AddObject(StringOfChar(' ', identlevel) + fcd.Widget.Name + cDivider + fcd.Widget.ClassName, fcd);
+ Inc(identlevel, 2);
+ AddChildWidgets(fcd.Widget, slist);
+ Dec(identlevel, 2);
+ end;
+
+ if fcd.Selected then
+ fi := f + 1;
+ end;
+ end;
+
+begin
+ frm := TWidgetOrderForm.Create(nil);
+ frm.WindowTitle := 'Tab Order';
+ fi := 1;
+ identlevel := 0;
+
+ AddChildWidgets(FForm, frm.list.Items);
+
+ if fi <= frm.list.ItemCount then
+ frm.list.FocusItem := fi;
+
+ if frm.ShowModal = 1 then
+ begin
+ taborder := 1;
+ for n := 0 to frm.List.Items.Count - 1 do
+ begin
+ try
+ if IsPublishedProp(TWidgetDesigner(frm.List.Items.Objects[n]).Widget, 'TabOrder') then
+ begin
+// SetPropValue(TWidgetDesigner(frm.List.Items.Objects[n]).Widget, 'TabOrder', taborder);
+ TWidgetDesigner(frm.List.Items.Objects[n]).Widget.TabOrder := taborder;
+ inc(taborder);
+ end;
+ except
+ // do nothing. TabOrder was not published
+ end;
+ end;
+ end; { if }
+ frm.Free;
+end;
+
procedure TFormDesigner.DesignerKeyPress(var keycode: word; var shiftstate: TShiftState; var consumed: boolean);
var
dx,
diff --git a/examples/apps/uidesigner/vfdmain.pas b/examples/apps/uidesigner/vfdmain.pas
index f78b0787..a15790b6 100644
--- a/examples/apps/uidesigner/vfdmain.pas
+++ b/examples/apps/uidesigner/vfdmain.pas
@@ -68,6 +68,7 @@ type
procedure OnAnchorChange(Sender: TObject);
procedure OnEditWidget(Sender: TObject);
procedure OnEditWidgetOrder(Sender: TObject);
+ procedure OnEditTabOrder(Sender: TObject);
procedure OnExit(Sender: TObject);
procedure OnOptionsClick(Sender: TObject);
property EditedFileName: string read FEditedFileName write SetEditedFileName;
@@ -403,6 +404,12 @@ begin
SelectedForm.EditWidgetOrder;
end;
+procedure TMainDesigner.OnEditTabOrder(Sender: TObject);
+begin
+ if SelectedForm <> nil then
+ SelectedForm.EditTabOrder;
+end;
+
procedure TMainDesigner.OnExit(Sender: TObject);
begin
frmProperties.Close;