summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-05-19 15:13:26 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-05-19 15:13:26 +0000
commit3d203b58185f8d703d638fe762167291f3dc055c (patch)
tree9682d9e92dfa95a420e4b8db346516fae7fb6c5e /examples
parent47aa5a7615cb3d7adf5e9af693288d9cbd89adb9 (diff)
downloadfpGUI-3d203b58185f8d703d638fe762167291f3dc055c.tar.xz
* Merged my private graemeg branch changes (r752:r781) into trunk. These changes are required to change all componens from 1-based indexing to 0-based indexing.
Diffstat (limited to 'examples')
-rw-r--r--examples/apps/uidesigner/newformdesigner.pas50
-rw-r--r--examples/apps/uidesigner/uidesigner.lpr2
-rw-r--r--examples/apps/uidesigner/vfddesigner.pas43
-rw-r--r--examples/apps/uidesigner/vfdeditors.pas28
-rw-r--r--examples/apps/uidesigner/vfdfile.pas41
-rw-r--r--examples/apps/uidesigner/vfdformparser.pas40
-rw-r--r--examples/apps/uidesigner/vfdforms.pas49
-rw-r--r--examples/apps/uidesigner/vfdmain.pas52
-rw-r--r--examples/apps/uidesigner/vfdpropeditgrid.pas46
-rw-r--r--examples/apps/uidesigner/vfdprops.pas63
-rw-r--r--examples/apps/uidesigner/vfdresizer.pas17
-rw-r--r--examples/apps/uidesigner/vfdutils.pas4
-rw-r--r--examples/apps/uidesigner/vfdwidgetclass.pas4
-rw-r--r--examples/apps/uidesigner/vfdwidgets.pas6
-rw-r--r--examples/gui/colorlistbox/frmMain.pas2
-rw-r--r--examples/gui/combobox/comboboxtest.lpi58
-rw-r--r--examples/gui/combobox/comboboxtest.lpr29
-rw-r--r--examples/gui/combobox/extrafpc.cfg5
-rw-r--r--examples/gui/combobox/frm_main.pas251
-rw-r--r--examples/gui/filedialog/filedialog.lpr8
-rw-r--r--examples/gui/gridtest/gridtest.lpr100
-rw-r--r--examples/gui/listbox/frm_main.pas160
-rw-r--r--examples/gui/listbox/listboxtest.lpi58
-rw-r--r--examples/gui/listbox/listboxtest.lpr29
-rw-r--r--examples/gui/memo/memotest.lpr6
-rw-r--r--examples/gui/menutest/menutest.lpr3
26 files changed, 890 insertions, 264 deletions
diff --git a/examples/apps/uidesigner/newformdesigner.pas b/examples/apps/uidesigner/newformdesigner.pas
index 175e4fa6..8a96997c 100644
--- a/examples/apps/uidesigner/newformdesigner.pas
+++ b/examples/apps/uidesigner/newformdesigner.pas
@@ -1,7 +1,7 @@
{
- fpGUI - Free Pascal GUI Library
+ fpGUI - Free Pascal GUI Toolkit
- 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,
@@ -75,7 +75,6 @@ type
previewmenu: TfpgPopupMenu;
{@VFD_HEAD_END: frmMain}
mru: TfpgMRU;
-
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function GetSelectedWidget: TVFDWidgetClass;
@@ -89,11 +88,11 @@ type
TPropertyList = class(TObject)
private
FList: TList;
+ function GetCount: integer;
public
Widget: TfpgWidget;
constructor Create;
destructor Destroy; override;
- function GetCount: integer;
procedure Clear;
property Count: integer read GetCount;
procedure AddItem(aProp: TVFDWidgetProperty);
@@ -346,7 +345,7 @@ begin
SetPosition(116, 60, 200, 22);
Items.Add('-');
FontDesc := '#List';
- FocusItem := 1;
+ FocusItem := 0;
end;
filemenu := TfpgPopupMenu.Create(self);
@@ -415,7 +414,7 @@ begin
x := 0;
- for n := 1 to VFDWidgetCount do
+ for n := 0 to VFDWidgetCount-1 do
begin
wgc := VFDWidget(n);
btn := TwgPaletteButton.Create(wgpalette);
@@ -457,12 +456,10 @@ begin
if TwgPaletteButton(Sender).Down then
begin
s := TwgPaletteButton(Sender).VFDWidget.WidgetClass.ClassName;
- i := chlPalette.Items.IndexOf(s);
- if i >= 0 then
- chlPalette.FocusItem := i + 1;
- end
- else
- chlPalette.FocusItem := 1;
+ chlPalette.FocusItem := chlPalette.Items.IndexOf(s);
+ end;
+ if chlPalette.FocusItem = -1 then
+ chlPalette.FocusItem := 0;
end;
{ TfrmProperties }
@@ -665,20 +662,11 @@ end;
procedure TPropertyList.AddItem(aProp: TVFDWidgetProperty);
begin
- {
- result := TPropertyLine.Create;
- result.name := aPropName;
- result.propclass := apropclass;
- result.value := aPropName;
-}
FList.Add(aProp);
end;
procedure TPropertyList.Clear;
- //var
- // n : integer;
begin
- //for n:=0 to FList.Count-1 do TObject(FList[n]).Free;
FList.Clear;
end;
@@ -702,17 +690,17 @@ end;
function TPropertyList.GetItem(index: integer): TVFDWidgetProperty;
begin
- if (index < 1) or (index > Count) then
+ if (index < 0) or (index > Count-1) then
Result := nil
else
- Result := TVFDWidgetProperty(FList[index - 1]);
+ Result := TVFDWidgetProperty(FList[index]);
end;
{ TwgPropertyList }
constructor TwgPropertyList.Create(AOwner: TComponent);
begin
- inherited;
+ inherited Create(AOwner);
NameWidth := 80;
editor := nil;
OnChange := @OnRowChange;
@@ -741,10 +729,9 @@ var
prop: TVFDWidgetProperty;
r: TfpgRect;
begin
- //inherited;
prop := Props.GetItem(num);
if prop = nil then
- Exit;
+ Exit; //==>
x := rect.left;
y := rect.top;
@@ -782,9 +769,7 @@ end;
procedure TwgPropertyList.OnUpdateProperty(Sender: TObject);
begin
-// writeln('updating property...');
editor.StoreValue(props.Widget);
-// props.Widget.UpdateWindowPosition;
end;
procedure TwgPropertyList.HandleMouseMove(x, y: integer; btnstate: word; shiftstate: TShiftState);
@@ -887,8 +872,8 @@ end;
function TfrmMain.GetSelectedWidget: TVFDWidgetClass;
begin
- if chlPalette.FocusItem > 1 then
- Result := TVFDWidgetClass(chlPalette.Items.Objects[chlPalette.FocusItem - 1])
+ if chlPalette.FocusItem > 0 then
+ Result := TVFDWidgetClass(chlPalette.Items.Objects[chlPalette.FocusItem])
else
Result := nil;
end;
@@ -899,7 +884,7 @@ var
begin
if wgc = nil then
begin
- chlPalette.FocusItem := 1;
+ chlPalette.FocusItem := 0;
for n := 0 to wgpalette.ComponentCount - 1 do
if wgpalette.Components[n] is TwgPaletteButton then
TwgPaletteButton(wgpalette.Components[n]).Down := False;
@@ -943,10 +928,7 @@ end;
procedure TwgPalette.HandlePaint;
begin
-// inherited HandlePaint;
- Canvas.BeginDraw;
Canvas.Clear(clWindowBackground);
- Canvas.EndDraw;
end;
diff --git a/examples/apps/uidesigner/uidesigner.lpr b/examples/apps/uidesigner/uidesigner.lpr
index 4b4c371f..96aef118 100644
--- a/examples/apps/uidesigner/uidesigner.lpr
+++ b/examples/apps/uidesigner/uidesigner.lpr
@@ -12,7 +12,7 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Description:
- The starting unit for the uiDesigner project.
+ The starting unit for the UI Designer project.
}
program uidesigner;
diff --git a/examples/apps/uidesigner/vfddesigner.pas b/examples/apps/uidesigner/vfddesigner.pas
index 6eb79b9b..17e1bedc 100644
--- a/examples/apps/uidesigner/vfddesigner.pas
+++ b/examples/apps/uidesigner/vfddesigner.pas
@@ -1,7 +1,7 @@
{
- fpGUI - Free Pascal GUI Library
+ fpGUI - Free Pascal GUI Toolkit
- 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
TOtherWidget = class(TfpgWidget)
protected
FFont: TfpgFont;
- procedure HandlePaint; override;
+ procedure HandlePaint; override;
public
wgClassName: string;
constructor Create(AOwner: TComponent); override;
@@ -61,7 +61,7 @@ type
TDesignedForm = class(TfpgForm)
public
- procedure AfterCreate; override;
+ procedure AfterCreate; override;
end;
@@ -145,9 +145,6 @@ implementation
uses
vfdmain, TypInfo;
-type
- // used to get to SetDesigning() in Form Designer
- TComponentFriendClass = class(TComponent);
{ TWidgetDesigner }
@@ -439,13 +436,13 @@ begin
FWidgets := TList.Create;
FWasDrag := False;
- OneClickMove := True; //false;
+ OneClickMove := True;
- FForm := TDesignedForm.Create(nil);
- FForm.FormDesigner := self;
- FForm.Name := maindsgn.NewFormName;
- FForm.WindowTitle := FForm.Name;
- FFormOther := '';
+ FForm := TDesignedForm.Create(nil);
+ FForm.FormDesigner := self;
+ FForm.Name := maindsgn.NewFormName;
+ FForm.WindowTitle := FForm.Name;
+ FFormOther := '';
end;
destructor TFormDesigner.Destroy;
@@ -543,7 +540,7 @@ var
n, dir: integer;
cd, scd: TWidgetDesigner;
begin
- if FWidgets.Count < 1 then
+ if FWidgets.Count = 0 then
Exit;
if fw then
@@ -894,7 +891,7 @@ end;
procedure TFormDesigner.OnPaletteChange(Sender: TObject);
begin
- if PaletteForm.clist.FocusItem > 1 then
+ if PaletteForm.clist.FocusItem > 0 then
FForm.MouseCursor := mcCross
else
FForm.MouseCursor := mcDefault;
@@ -936,18 +933,18 @@ begin
wgc := scd.FVFDClass;
n := frmProperties.lstProps.FocusItem;
- if (n > 0) and (PropList.GetItem(n) <> nil) then
+ if (n >= 0) and (PropList.GetItem(n) <> nil) then
lastpropname := PropList.GetItem(n).Name
else
lastpropname := '';
- i := 0;
+ i := -1;
if PropList.Widget <> wg then
begin
frmProperties.lstProps.ReleaseEditor;
PropList.Clear;
- for n := 1 to wgc.PropertyCount do
+ for n := 0 to wgc.PropertyCount-1 do
begin
PropList.AddItem(wgc.GetProperty(n));
if UpperCase(wgc.GetProperty(n).Name) = UpperCase(lastPropName) then
@@ -955,7 +952,7 @@ begin
end;
PropList.Widget := wg;
frmProperties.lstProps.Update;
- if i > 0 then
+ if i > -1 then
frmProperties.lstProps.FocusItem := i;
end;
@@ -1475,7 +1472,7 @@ begin
s := s + ident + 'Anchors := ' + ts + LineEnding;
end;
- for n := 1 to wgc.PropertyCount do
+ for n := 0 to wgc.PropertyCount-1 do
s := s + wgc.GetProperty(n).GetPropertySource(wg, ident);
{
@@ -1642,7 +1639,6 @@ begin
WindowPosition := wpUser;
WindowTitle := 'New Form';
SetPosition(300, 150, 300, 250);
-// TComponentFriendClass(self).SetDesigning(True);
end;
@@ -1652,9 +1648,6 @@ procedure TOtherWidget.HandlePaint;
var
s: string;
begin
- Canvas.BeginDraw;
- inherited HandlePaint;
-
Canvas.Clear(FBackgroundColor);
Canvas.SetFont(FFont);
Canvas.SetColor(clWidgetFrame);
@@ -1662,8 +1655,6 @@ begin
Canvas.SetTextColor(clText1);
s := Name + ': ' + wgClassName;
Canvas.DrawString(2, 2, s);
-
- Canvas.EndDraw;
end;
constructor TOtherWidget.Create(AOwner: TComponent);
diff --git a/examples/apps/uidesigner/vfdeditors.pas b/examples/apps/uidesigner/vfdeditors.pas
index 50a47b37..c5ba41e1 100644
--- a/examples/apps/uidesigner/vfdeditors.pas
+++ b/examples/apps/uidesigner/vfdeditors.pas
@@ -1,7 +1,7 @@
{
- fpGUI - Free Pascal GUI Library
+ fpGUI - Free Pascal GUI Toolkit
- 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,
@@ -31,14 +31,18 @@ uses
vfdforms;
type
+
TItemEditorForm = class(TVFDDialog)
+ private
+ procedure btnClearClicked(Sender: TObject);
+ procedure OnButtonClick(Sender: TObject);
public
l1: TfpgLabel;
edItems: TfpgMemo;
- btnOK,
+ btnOK: TfpgButton;
btnCancel: TfpgButton;
+ btnClear: TfpgButton;
procedure AfterCreate; override;
- procedure OnButtonClick(Sender: TObject);
end;
@@ -61,13 +65,23 @@ begin
with edItems do
begin
SetPosition(8, 24, 344, 168);
- Anchors := [anLeft, anTop, anRight, anBottom];
+ Anchors := AllAnchors;
end;
- btnOK := CreateButton(self, 8, 200, 105, 'OK', @OnButtonClick);
+ btnClear := CreateButton(self, 8, 200, 80, 'Clear', @btnClearClicked);
+ btnClear.Anchors := [anLeft, anBottom];
+
+ btnOK := CreateButton(self, btnClear.Right + 4, 200, 80, 'OK', @OnButtonClick);
btnOK.Anchors := [anLeft, anBottom];
- btnCancel := CreateButton(self, 244, 200, 105, 'Cancel', @OnButtonClick);
+
+ btnCancel := CreateButton(self, Width-84, 200, 80, 'Cancel', @OnButtonClick);
btnCancel.Anchors := [anRight, anBottom];
+
+end;
+
+procedure TItemEditorForm.btnClearClicked(Sender: TObject);
+begin
+ edItems.Lines.Clear;
end;
procedure TItemEditorForm.OnButtonClick(Sender: TObject);
diff --git a/examples/apps/uidesigner/vfdfile.pas b/examples/apps/uidesigner/vfdfile.pas
index 15e23d75..16910883 100644
--- a/examples/apps/uidesigner/vfdfile.pas
+++ b/examples/apps/uidesigner/vfdfile.pas
@@ -1,5 +1,5 @@
{
- fpGUI - Free Pascal GUI Library
+ fpGUI - Free Pascal GUI Toolkit
Copyright (C) 2006 - 2008 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
@@ -46,20 +46,21 @@ type
NewFormsDecl: string;
NewFormsImpl: string;
constructor Create;
- destructor Destroy; override;
- function LoadFile(fname: string): boolean;
- procedure AddBlock(aposition: integer; ablockid, aformname, ablockdata: string);
- function BlockCount: integer;
- function Block(index: integer): TVFDFileBlock;
- procedure FreeBlocks;
- function GetBlocks: integer; // parse file
- function MergeBlocks: string; // store file
- procedure AddNewFormDecl(formname, formheadblock: string);
- procedure AddNewFormImpl(formname, formbody: string);
- function FindFormBlock(blockid, formname: string): TVFDFileBlock;
- procedure SetFormData(formname, headblock, bodyblock: string);
- procedure NewFileSkeleton(unitname: string);
+ destructor Destroy; override;
+ function LoadFile(fname: string): boolean;
+ procedure AddBlock(aposition: integer; ablockid, aformname, ablockdata: string);
+ function BlockCount: integer;
+ function Block(index: integer): TVFDFileBlock;
+ procedure FreeBlocks;
+ function GetBlocks: integer; // parse file
+ function MergeBlocks: string; // store file
+ procedure AddNewFormDecl(formname, formheadblock: string);
+ procedure AddNewFormImpl(formname, formbody: string);
+ function FindFormBlock(blockid, formname: string): TVFDFileBlock;
+ procedure SetFormData(formname, headblock, bodyblock: string);
+ procedure NewFileSkeleton(unitname: string);
end;
+
implementation
@@ -109,9 +110,9 @@ end;
function TVFDFile.Block(index: integer): TVFDFileBlock;
begin
Result := nil;
- if (index < 1) or (index > FBlocks.Count) then
+ if (index < 0) or (index > FBlocks.Count-1) then
Exit;
- Result := TVFDFileBlock(FBlocks[index - 1]);
+ Result := TVFDFileBlock(FBlocks[index]);
end;
function TVFDFile.BlockCount: integer;
@@ -141,7 +142,7 @@ var
fb: TVFDFileBlock;
begin
Result := nil;
- for n := 1 to BlockCount do
+ for n := 0 to BlockCount-1 do
begin
fb := Block(n);
if (fb.BlockID = blockid) and (UpperCase(fb.FormName) = UpperCase(formname)) then
@@ -156,7 +157,7 @@ procedure TVFDFile.FreeBlocks;
var
n: integer;
begin
- for n := 0 to FBlocks.Count - 1 do
+ for n := 0 to FBlocks.Count-1 do
TVFDFileBlock(FBlocks[n]).Free;
FBlocks.Clear;
NewFormsDecl := '';
@@ -338,10 +339,8 @@ begin
end;
if not newsaved and (NewFormsImpl <> '') then
- rs := rs + NewFormsImpl// do not loose new form data.
- ;
+ rs := rs + NewFormsImpl; // do not loose new form data.
- //writeln(rs);
Result := rs;
end;
diff --git a/examples/apps/uidesigner/vfdformparser.pas b/examples/apps/uidesigner/vfdformparser.pas
index 1acaed31..a3d7c966 100644
--- a/examples/apps/uidesigner/vfdformparser.pas
+++ b/examples/apps/uidesigner/vfdformparser.pas
@@ -1,7 +1,7 @@
{
- fpGUI - Free Pascal GUI Library
+ fpGUI - Free Pascal GUI Toolkit
- 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,
@@ -41,7 +41,7 @@ type
line: string;
lineindex: integer;
public
- procedure nextline;
+ procedure NextLine;
public
constructor Create(const FormName, FormHead, FormBody: string);
destructor Destroy; override;
@@ -52,15 +52,17 @@ type
end;
-function GetIdentifier(var s: string): string;
-function GetStringValue(var s: string): string;
+function GetIdentifier(var s: string): string;
+function GetStringValue(var s: string): string;
procedure SkipSpaces(var s: string);
-function CheckSymbol(var s: string; const sym: string): boolean;
-function GetIntValue(var s: string): integer;
-function GetBoolValue(var s: string): boolean;
+function CheckSymbol(var s: string; const sym: string): boolean;
+function GetIntValue(var s: string): integer;
+function GetBoolValue(var s: string): boolean;
+
implementation
+
{ TVFDFormParser }
constructor TVFDFormParser.Create(const FormName, FormHead, FormBody: string);
@@ -69,7 +71,7 @@ begin
ffd := nil;
BodyLines := TStringList.Create;
BodyLines.Text := FormBody;
- lineindex := 0;
+ lineindex := -1;
end;
destructor TVFDFormParser.Destroy;
@@ -78,13 +80,13 @@ begin
inherited;
end;
-procedure TVFDFormParser.nextline;
+procedure TVFDFormParser.NextLine;
begin
repeat
Inc(lineindex);
- eob := (lineindex > BodyLines.Count);
+ eob := (lineindex > BodyLines.Count-1);
if not eob then
- line := trim(bodylines.Strings[lineindex - 1])
+ line := trim(bodylines.Strings[lineindex])
else
line := '';
until eob or (line <> '');
@@ -94,16 +96,12 @@ function TVFDFormParser.ParseForm: TFormDesigner;
begin
ffd := TFormDesigner.Create;
ffd.Form.Name := fformname;
-
// parsing line by line
// the unknown lines will be "other properties"
- lineindex := 0;
- nextline;
-
+ lineindex := -1;
+ NextLine;
ParseFormProperties;
-
ParseFormWidgets;
-
Result := ffd;
end;
@@ -250,10 +248,8 @@ begin
while not eob and (pos('.CREATE(', UpperCase(line)) = 0) do
begin
lok := ReadWGProperty(line, ffd.Form, VFDFormWidget);
-
if not lok then
ffd.FormOther := ffd.FormOther + line + LineEnding;
-
NextLine;
end;
end;
@@ -307,7 +303,7 @@ begin
wg := nil;
wgc := nil;
- for n := 1 to VFDWidgetCount do
+ for n := 0 to VFDWidgetCount-1 do
begin
wgc := VFDWidget(n);
if wgclassuc = UpperCase(wgc.WidgetClass.ClassName) then
@@ -532,7 +528,7 @@ begin
if not lok then
if wgc <> nil then
- for n := 1 to wgc.PropertyCount do
+ for n := 0 to wgc.PropertyCount-1 do
begin
lok := wgc.GetProperty(n).ParseSourceLine(wg, line);
if lok then
diff --git a/examples/apps/uidesigner/vfdforms.pas b/examples/apps/uidesigner/vfdforms.pas
index 508b64bf..8c19104a 100644
--- a/examples/apps/uidesigner/vfdforms.pas
+++ b/examples/apps/uidesigner/vfdforms.pas
@@ -1,5 +1,5 @@
{
- fpGUI - Free Pascal GUI Library
+ fpGUI - Free Pascal GUI Toolkit
Copyright (C) 2006 - 2008 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
@@ -161,18 +161,7 @@ begin
clist.Top := 22;
clist.Height := Height - clist.top - 2;
clist.Anchors := [anLeft, anRight, anTop, anBottom];
-
clist.Items.Add('-');
-{
- clist.Items.Add('Label');
- clist.Items.Add('Edit');
- clist.Items.Add('Button');
- clist.Items.Add('CheckBox');
- clist.Items.Add('ComboBox');
- clist.Items.Add('Memo');
- clist.Items.Add('ListBox');
- clist.Items.Add('[OTHER]');
-}
clist.OnChange := @(maindsgn.OnPaletteChange);
end;
@@ -360,8 +349,8 @@ end;
procedure TWidgetOrderForm.OnButtonClick(Sender: TObject);
var
- i,
- n,
+ i: integer;
+ n: integer;
myilev: integer;
function IdentLevel(astr: string): integer;
@@ -388,16 +377,16 @@ begin
begin
// up / down
i := list.FocusItem;
- if i < 1 then
+ if i < 0 then
Exit;
- myilev := IdentLevel(list.Items[i - 1]);
+ myilev := IdentLevel(list.Items[i]);
if Sender = btnUP then
begin
- if (i > 1) and (IdentLevel(list.Items[i - 2]) = myilev) then
+ if (i > 0) and (IdentLevel(list.Items[i - 1]) = myilev) then
begin
- list.Items.Move(i - 1, i - 2);
+ list.Items.Move(i, i - 1);
n := i;
while (n < list.Items.Count) and (IdentLevel(list.Items[n]) > myilev) do
@@ -410,24 +399,21 @@ begin
end;
end
else if Sender = btnDOWN then
- if (i < list.Items.Count) then
+ if (i < list.Items.Count-1) then
begin
- //list.Items.Move(i-1,i);
-
n := i;
while (n < list.Items.Count) and (IdentLevel(list.Items[n]) > myilev) do
- Inc(n)//list.Items.Move(n,n-1);
- ;
+ Inc(n);
- if (i = n) and (i < list.Items.Count - 1) and (IdentLevel(list.Items[i + 1]) > myilev) then
+ if (i = n) and (i < list.Items.Count-1) and (IdentLevel(list.Items[i]) > myilev) then
Exit;
- if (n > list.Items.Count - 1) then
- Exit;
+ if (n > list.Items.Count-1) then
+ Exit; //==>
while (n >= i) do
begin
- list.Items.Move(n, n - 1);
+ list.Items.Move(n, n + 1);
Dec(n);
end;
@@ -444,16 +430,15 @@ begin
begin
ModalResult := 2;
consumed := True;
- end
- else
- inherited HandleKeyPress(keycode, shiftstate, consumed);
+ end;
+ inherited HandleKeyPress(keycode, shiftstate, consumed);
end;
procedure TfrmVFDSetup.LoadSettings;
begin
- chlGrid.FocusItem := gINI.ReadInteger('Options', 'GridResolution', 2);
+ chlGrid.FocusItem := gINI.ReadInteger('Options', 'GridResolution', 2);
tbMRUFileCount.Position := gINI.ReadInteger('Options', 'MRUFileCount', 4);
- cbFullPath.Checked := gINI.ReadBool('Options', 'ShowFullPath', True);
+ cbFullPath.Checked := gINI.ReadBool('Options', 'ShowFullPath', True);
end;
procedure TfrmVFDSetup.SaveSettings;
diff --git a/examples/apps/uidesigner/vfdmain.pas b/examples/apps/uidesigner/vfdmain.pas
index 53145c6d..d0e81778 100644
--- a/examples/apps/uidesigner/vfdmain.pas
+++ b/examples/apps/uidesigner/vfdmain.pas
@@ -1,5 +1,5 @@
{
- fpGUI - Free Pascal GUI Library
+ fpGUI - Free Pascal GUI Toolkit
Copyright (C) 2006 - 2008 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
@@ -38,8 +38,8 @@ type
TMainDesigner = class(TObject)
private
- procedure SetEditedFileName(const Value: string);
- procedure LoadGridResolution;
+ procedure SetEditedFileName(const Value: string);
+ procedure LoadGridResolution;
protected
FDesigners: TList;
FFile: TVFDFile;
@@ -137,23 +137,21 @@ begin
TFormDesigner(FDesigners[n]).Free;
end;
FDesigners.Clear;
-
+
if not fpgFileExists(fname) then
begin
ShowMessage('File does not exists.', 'Error loading form');
Exit;
end;
- Writeln('loading file...');
-
FFile.LoadFile(fname);
FFile.GetBlocks;
- for n := 1 to FFile.BlockCount do
+ for n := 0 to FFile.BlockCount-1 do
begin
bl := FFile.Block(n);
if bl.BlockID = 'VFD_HEAD_BEGIN' then
- for m := n + 1 to FFile.BlockCount do
+ for m := n + 1 to FFile.BlockCount-1 do
begin
bl2 := FFile.Block(m);
if (bl2.BlockID = 'VFD_BODY_BEGIN') and (bl2.FormName = bl.FormName) then
@@ -213,7 +211,7 @@ begin
FFile.NewFileSkeleton(uname);
end;
- for n := 1 to DesignerCount do
+ for n := 0 to DesignerCount-1 do
begin
fd := Designer(n);
FFile.SetFormData(fd.Form.Name, fd.GetFormSourceDecl, fd.GetFormSourceImpl);
@@ -229,11 +227,11 @@ begin
finally
CloseFile(ff);
end;
- // frmMain.WindowTitle := 'fpGUI Designer v' + program_version + ' - ' + fname;
- // everything is done by SetEditedFileName (EditedFileName := ...)
frmMain.mru.AddItem(fname);
except
- Writeln('Form save I/O failure.');
+ on E: Exception do
+ raise Exception.Create('Form save I/O failure in TMainDesigner.OnSaveFile.' + #13 +
+ E.Message);
end;
end;
@@ -277,7 +275,6 @@ var
fd: TFormDesigner;
nfrm: TNewFormForm;
begin
- Writeln('new form');
nfrm := TNewFormForm.Create(nil);
if nfrm.ShowModal = 1 then
if nfrm.edName.Text <> '' then
@@ -292,8 +289,6 @@ begin
end;
procedure TMainDesigner.CreateWindows;
- //var
- // fd : TFormDesigner;
begin
frmMain := TfrmMain.Create(nil);
frmMain.WindowTitle := 'fpGUI Designer v' + program_version;
@@ -301,12 +296,6 @@ begin
frmProperties := TfrmProperties.Create(nil);
frmProperties.Show;
-
- // fd := TFormDesigner.Create;
- // fd.Form.Name := 'frmNewForm';
- // fd.Form.WindowTitle := u8('frmNewForm');
- // FDesigners.Add(fd);
- // fd.Show;
end;
constructor TMainDesigner.Create;
@@ -338,7 +327,6 @@ end;
procedure TMainDesigner.SelectForm(aform: TFormDesigner);
begin
- //Writeln('selected...');
if (SelectedForm <> nil) and (SelectedForm <> aform) then
SelectedForm.DeSelectAll;
SelectedForm := aform;
@@ -347,9 +335,9 @@ end;
function TMainDesigner.Designer(index: integer): TFormDesigner;
begin
Result := nil;
- if (index < 1) or (index > FDesigners.Count) then
+ if (index < 0) or (index > FDesigners.Count-1) then
Exit;
- Result := TFormDesigner(FDesigners[index - 1]);
+ Result := TFormDesigner(FDesigners[index]);
end;
function TMainDesigner.DesignerCount: integer;
@@ -366,14 +354,14 @@ begin
repeat
Inc(i);
s := 'Form' + IntToStr(i);
- n := 1;
- while (n <= DesignerCount) do
+ n := 0;
+ while (n < DesignerCount) do
begin
if Designer(n).Form.Name = s then
Break;
Inc(n);
end;
- until n > DesignerCount;
+ until n > DesignerCount-1;
Result := s;
end;
@@ -382,8 +370,6 @@ var
fd: TFormDesigner;
fp: TVFDFormParser;
begin
- Writeln('CreateParseForm: ', FormName);
-
fp := TVFDFormParser.Create(FormName, FormHead, FormBody);
fd := fp.ParseForm;
fp.Free;
@@ -446,10 +432,10 @@ end;
procedure TMainDesigner.LoadGridResolution;
begin
- case gINI.ReadInteger('Options', 'GridResolution', 2) of
- 1: GridResolution := 2;
- 2: GridResolution := 4;
- 3: GridResolution := 8;
+ case gINI.ReadInteger('Options', 'GridResolution', 1) of
+ 0: GridResolution := 2;
+ 1: GridResolution := 4;
+ 2: GridResolution := 8;
end;
end;
diff --git a/examples/apps/uidesigner/vfdpropeditgrid.pas b/examples/apps/uidesigner/vfdpropeditgrid.pas
index 97ebb0e6..d31f7f5b 100644
--- a/examples/apps/uidesigner/vfdpropeditgrid.pas
+++ b/examples/apps/uidesigner/vfdpropeditgrid.pas
@@ -1,7 +1,7 @@
{
- fpGUI - Free Pascal GUI Library
+ fpGUI - Free Pascal GUI Toolkit
- 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,
@@ -56,8 +56,8 @@ type
TColumnsGrid = class(TfpgCustomGrid)
protected
- function GetRowCount: Longword; override;
- procedure DrawCell(ARow, ACol: Longword; ARect: TfpgRect; AFlags: TfpgGridDrawState); override;
+ function GetRowCount: Integer; override;
+ procedure DrawCell(ARow, ACol: Integer; ARect: TfpgRect; AFlags: TfpgGridDrawState); override;
public
dbgrid: TfpgStringGrid;
constructor Create(AOwner: TComponent); override;
@@ -66,7 +66,7 @@ type
TColumnEditForm = class(TfpgForm)
private
- procedure GridRowChange(Sender: TObject; row: Longword);
+ procedure GridRowChange(Sender: TObject; row: Integer);
procedure EditChange(Sender: TObject);
procedure NewButtonClick(Sender: TObject);
procedure DeleteButtonClick(Sender: TObject);
@@ -284,12 +284,12 @@ begin
{@VFD_BODY_END: ColumnEditForm}
end;
-procedure TColumnEditForm.GridRowChange(Sender: TObject; row: Longword);
+procedure TColumnEditForm.GridRowChange(Sender: TObject; row: Integer);
var
i: integer;
c: TfpgStringColumn;
begin
- c := dbgrid.Columns[row{ - 1}];
+ c := dbgrid.Columns[row];
if c = nil then
Exit;
@@ -298,11 +298,11 @@ begin
edCOLWIDTH.Text := IntToStr(c.Width);
case c.Alignment of
taRightJustify:
- i := 2;
+ i := 1;
taCenter:
- i := 3
+ i := 2
else
- i := 1;
+ i := 0;
end;
chlALIGN.FocusItem := i;
end;
@@ -311,15 +311,15 @@ procedure TColumnEditForm.SaveColumn(row: integer);
var
c: TfpgStringColumn;
begin
- c := dbgrid.Columns[row{ - 1}];
+ c := dbgrid.Columns[row];
if c = nil then
Exit;
c.Title := edTITLE.Text;
c.Width := StrToIntDef(edCOLWIDTH.Text, 30);
case chlALIGN.FocusItem of
- 2: c.Alignment := taRightJustify;
- 3: c.Alignment := taCenter;
+ 1: c.Alignment := taRightJustify;
+ 2: c.Alignment := taCenter;
else
c.Alignment := taLeftJustify;
end;
@@ -330,7 +330,7 @@ end;
procedure TColumnEditForm.EditChange(Sender: TObject);
begin
- if grid.FocusRow < 1 then
+ if grid.FocusRow < 0 then
Exit;
SaveColumn(grid.FocusRow);
@@ -359,14 +359,14 @@ procedure TColumnEditForm.UpDownButtonClick(Sender: TObject);
begin
if Sender = btnUP then
begin
- if grid.FocusRow > 1 then
+ if grid.FocusRow > 0 then
begin
dbgrid.MoveColumn(grid.FocusRow - 1, grid.FocusRow - 2);
grid.FocusRow := grid.FocusRow - 1;
grid.Update;
end;
end
- else if grid.FocusRow < grid.RowCount then
+ else if grid.FocusRow < grid.RowCount-1 then
begin
dbgrid.MoveColumn(grid.FocusRow - 1, grid.FocusRow);
grid.FocusRow := grid.FocusRow + 1;
@@ -377,7 +377,7 @@ end;
{ TColumnsGrid }
-function TColumnsGrid.GetRowCount: Longword;
+function TColumnsGrid.GetRowCount: Integer;
begin
try
// Yes, it must be ColumnCount and *not* RowCount!
@@ -387,7 +387,7 @@ begin
end;
end;
-procedure TColumnsGrid.DrawCell(ARow, ACol: Longword; ARect: TfpgRect; AFlags: TfpgGridDrawState);
+procedure TColumnsGrid.DrawCell(ARow, ACol: Integer; ARect: TfpgRect; AFlags: TfpgGridDrawState);
var
s: string;
x: integer;
@@ -404,10 +404,10 @@ begin
x := ARect.Left + 1;
case ACol of
- 1: s := IntToStr(ARow);
- 2: s := c.Title;
- 3: s := IntToStr(c.Width);
- 4: case c.Alignment of
+ 0: s := IntToStr(ARow);
+ 1: s := c.Title;
+ 2: s := IntToStr(c.Width);
+ 3: case c.Alignment of
taRightJustify:
s := 'Right';
taCenter:
@@ -506,7 +506,7 @@ begin
Result := '';
with TfpgStringGrid(wg) do
begin
- for f := 1 to ColumnCount do
+ for f := 0 to ColumnCount-1 do
begin
c := Columns[f];
case c.Alignment of
diff --git a/examples/apps/uidesigner/vfdprops.pas b/examples/apps/uidesigner/vfdprops.pas
index fa2c8cd7..7e033d24 100644
--- a/examples/apps/uidesigner/vfdprops.pas
+++ b/examples/apps/uidesigner/vfdprops.pas
@@ -1,7 +1,7 @@
{
- fpGUI - Free Pascal GUI Library
+ fpGUI - Free Pascal GUI Toolkit
- 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,
@@ -62,10 +62,10 @@ type
TPropertyStringList = class(TVFDWidgetProperty)
public
- function ParseSourceLine(wg: TfpgWidget; const line: string): boolean; override;
- function GetPropertySource(wg: TfpgWidget; const ident: string): string; override;
- function GetValueText(wg: TfpgWidget): string; override;
- function CreateEditor(AOwner: TComponent): TVFDPropertyEditor; override;
+ function ParseSourceLine(wg: TfpgWidget; const line: string): boolean; override;
+ function GetPropertySource(wg: TfpgWidget; const ident: string): string; override;
+ function GetValueText(wg: TfpgWidget): string; override;
+ function CreateEditor(AOwner: TComponent): TVFDPropertyEditor; override;
procedure OnExternalEdit(wg: TfpgWidget); override;
end;
@@ -79,10 +79,8 @@ type
end;
- { TPropertyFontDesc }
-
TPropertyFontDesc = class(TPropertyString)
- function CreateEditor(AOwner: TComponent): TVFDPropertyEditor; override;
+ function CreateEditor(AOwner: TComponent): TVFDPropertyEditor; override;
procedure OnExternalEdit(wg: TfpgWidget); override;
end;
@@ -151,19 +149,19 @@ uses
fpgfx,
gui_dialogs;
+
procedure EditStringList(sl: TStringList);
var
- frmie: TItemEditorForm;
+ frm: TItemEditorForm;
begin
- frmie := TItemEditorForm.Create(nil);
- //GfxGetAbsolutePosition(PropertyForm.btnEdit.WinHandle, PropertyForm.btnEdit.width, 0, ax,ay);
- //frmie.Left := ax;
- //frmie.Top := ay;
-
- frmie.edItems.Lines.Assign(sl);
- if frmie.ShowModal = 1 then
- sl.Assign(frmie.edItems.Lines);
- frmie.Free;
+ frm := TItemEditorForm.Create(nil);
+ try
+ frm.edItems.Lines.Assign(sl);
+ if frm.ShowModal = 1 then
+ sl.Assign(frm.edItems.Lines);
+ finally
+ frm.Free;
+ end;
end;
procedure GetEnumPropValueList(wg: TObject; const APropName: string; sl: TStringList);
@@ -377,11 +375,18 @@ var
f: integer;
begin
sl := TStringList(GetObjectProp(wg, Name, TStrings));
+ if not Assigned(sl) then
+ raise Exception.Create('Failed to find TStrings type property.');
Result := '';
- for f := 0 to sl.Count - 1 do
- Result := Result + ident + Name + '.Add(' + QuotedStr(sl.Strings[f]) + ');' + LineEnding;
+ //if sl.Text <> '' then
+ //begin
+ //writeln('Text = <', sl.Text, '>');
+ //writeln('StringList.Count = ', sl.Count);
+ for f := 0 to sl.Count - 1 do
+ Result := Result + ident + Name + '.Add(' + QuotedStr(sl.Strings[f]) + ');' + LineEnding;
+ //end;
end;
function TPropertyStringList.GetValueText(wg: TfpgWidget): string;
@@ -389,6 +394,8 @@ var
sl: TStringList;
begin
sl := TStringList(GetObjectProp(wg, Name, TStrings));
+ if not Assigned(sl) then
+ raise Exception.Create('Failed to find TStrings type property.');
Result := '[' + IntToStr(sl.Count) + ' lines]';
end;
@@ -397,6 +404,8 @@ var
sl: TStringList;
begin
sl := TStringList(GetObjectProp(wg, Name, TStrings));
+ if not Assigned(sl) then
+ raise Exception.Create('Failed to find TStrings type property.');
EditStringList(sl);
end;
@@ -424,6 +433,8 @@ begin
if Result then
begin
sl := TStringList(GetObjectProp(wg, Name, TStrings));
+ if not Assigned(sl) then
+ raise Exception.Create('Failed to find TStrings type property.');
sl.Add(sval);
end;
end;
@@ -498,12 +509,10 @@ begin
// Exit;
if widget = nil then
Exit;
- Canvas.BeginDraw;
Canvas.Clear(clBoxColor);
Canvas.GetWinRect(r);
Canvas.SetTextColor(clText1);
prop.DrawValue(Widget, Canvas, r, 0);
- Canvas.EndDraw;
end;
procedure TExternalPropertyEditor.CreateLayout;
@@ -616,12 +625,12 @@ begin
sv := GetEnumProp(wg, prop.Name);
sl := TStringList.Create;
GetEnumPropValueList(wg, prop.Name, sl);
- fi := 1;
+ fi := 0;
for i := 0 to sl.Count - 1 do
begin
chl.Items.Add(sl.Strings[i]);
if UpperCase(sv) = UpperCase(sl.Strings[i]) then
- fi := i + 1;
+ fi := i;
end;
chl.FocusItem := fi;
sl.Free;
@@ -642,9 +651,9 @@ begin
chl.Items.Add('True');
chl.Items.Add('False');
if b = 1 then
- chl.FocusItem := 1
+ chl.FocusItem := 0
else
- chl.FocusItem := 2;
+ chl.FocusItem := 1;
end;
procedure TBooleanPropertyEditor.StoreValue(wg: TfpgWidget);
diff --git a/examples/apps/uidesigner/vfdresizer.pas b/examples/apps/uidesigner/vfdresizer.pas
index 137fdbd4..9944e3b6 100644
--- a/examples/apps/uidesigner/vfdresizer.pas
+++ b/examples/apps/uidesigner/vfdresizer.pas
@@ -1,7 +1,7 @@
{
- fpGUI - Free Pascal GUI Library
+ fpGUI - Free Pascal GUI Toolkit
- 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,
@@ -31,10 +31,10 @@ type
TwgResizer = class(TfpgWidget)
protected
wgdesigner: TObject;
- procedure HandlePaint; override;
- procedure HandleLMouseDown(x, y: integer; shiftstate: TShiftState); override;
- procedure HandleLMouseUp(x, y: integer; shiftstate: TShiftState); override;
- procedure HandleMouseMove(x, y: integer; btnstate: word; shiftstate: TShiftState); override;
+ procedure HandlePaint; override;
+ procedure HandleLMouseDown(x, y: integer; shiftstate: TShiftState); override;
+ procedure HandleLMouseUp(x, y: integer; shiftstate: TShiftState); override;
+ procedure HandleMouseMove(x, y: integer; btnstate: word; shiftstate: TShiftState); override;
public
direction: integer;
FDragging: boolean;
@@ -43,9 +43,11 @@ type
constructor Create(ACompDesigner: TObject; adirection: integer); reintroduce;
procedure Show;
end;
+
implementation
+
uses
vfddesigner,
vfdmain;
@@ -54,10 +56,7 @@ uses
procedure TwgResizer.HandlePaint;
begin
- Canvas.BeginDraw;
- inherited HandlePaint;
Canvas.Clear(FBackgroundColor);
- Canvas.EndDraw;
end;
procedure TwgResizer.HandleLMouseDown(x, y: integer; shiftstate: TShiftState);
diff --git a/examples/apps/uidesigner/vfdutils.pas b/examples/apps/uidesigner/vfdutils.pas
index fe60c933..90b99841 100644
--- a/examples/apps/uidesigner/vfdutils.pas
+++ b/examples/apps/uidesigner/vfdutils.pas
@@ -1,7 +1,7 @@
{
- fpGUI - Free Pascal GUI Library
+ fpGUI - Free Pascal GUI Toolkit
- 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 19308b35..9729691f 100644
--- a/examples/apps/uidesigner/vfdwidgetclass.pas
+++ b/examples/apps/uidesigner/vfdwidgetclass.pas
@@ -1,5 +1,5 @@
{
- fpGUI - Free Pascal GUI Library
+ fpGUI - Free Pascal GUI Toolkit
Copyright (C) 2006 - 2008 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
@@ -133,7 +133,7 @@ end;
function TVFDWidgetClass.GetProperty(ind: integer): TVFDWidgetProperty;
begin
- Result := TVFDWidgetProperty(FProps[ind - 1]);
+ Result := TVFDWidgetProperty(FProps[ind]);
end;
function TVFDWidgetClass.PropertyCount: integer;
diff --git a/examples/apps/uidesigner/vfdwidgets.pas b/examples/apps/uidesigner/vfdwidgets.pas
index 73088160..71cacc1d 100644
--- a/examples/apps/uidesigner/vfdwidgets.pas
+++ b/examples/apps/uidesigner/vfdwidgets.pas
@@ -1,5 +1,5 @@
{
- fpGUI - Free Pascal GUI Library
+ fpGUI - Free Pascal GUI Toolkit
Copyright (C) 2006 - 2008 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
@@ -79,7 +79,7 @@ end;
function VFDWidget(ind: integer): TVFDWidgetClass;
begin
- Result := TVFDWidgetClass(FVFDWidgets[ind - 1]);
+ Result := TVFDWidgetClass(FVFDWidgets[ind]);
end;
procedure RegisterVFDWidget(awc: TVFDWidgetClass);
@@ -352,6 +352,7 @@ begin
wc.AddProperty('Min', TPropertyInteger, '');
wc.AddProperty('Max', TPropertyInteger, '');
wc.AddProperty('Position', TPropertyInteger, '');
+ wc.AddProperty('ShowCaption', TPropertyBoolean, '');
wc.WidgetIconName := 'vfd.progressbar';
RegisterVFDWidget(wc);
@@ -362,6 +363,7 @@ begin
wc.AddProperty('Min', TPropertyInteger, '');
wc.AddProperty('Orientation', TPropertyEnum, '');
wc.AddProperty('Position', TPropertyInteger, '');
+ wc.AddProperty('ShowPosition', TPropertyBoolean, '');
wc.AddProperty('TabOrder', TPropertyInteger, 'The tab order');
wc.WidgetIconName := 'vfd.trackbar';
RegisterVFDWidget(wc);
diff --git a/examples/gui/colorlistbox/frmMain.pas b/examples/gui/colorlistbox/frmMain.pas
index 7fbe0327..5ec2d98c 100644
--- a/examples/gui/colorlistbox/frmMain.pas
+++ b/examples/gui/colorlistbox/frmMain.pas
@@ -83,7 +83,7 @@ begin
cbName1.Items.Add('cpStandardColors');
cbName1.Items.Add('cpSystemColors');
cbName1.Items.Add('cpWebColors');
- cbName1.FocusItem := 1;
+ cbName1.FocusItem := 0;
cbName1.OnChange := @cbName1Change;
end;
diff --git a/examples/gui/combobox/comboboxtest.lpi b/examples/gui/combobox/comboboxtest.lpi
new file mode 100644
index 00000000..41183e45
--- /dev/null
+++ b/examples/gui/combobox/comboboxtest.lpi
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+<CONFIG>
+ <ProjectOptions>
+ <PathDelim Value="/"/>
+ <Version Value="6"/>
+ <General>
+ <Flags>
+ <SaveOnlyProjectUnits Value="True"/>
+ </Flags>
+ <SessionStorage Value="InProjectDir"/>
+ <MainUnit Value="0"/>
+ <IconPath Value="./"/>
+ <TargetFileExt Value=""/>
+ </General>
+ <VersionInfo>
+ <ProjectVersion Value=""/>
+ </VersionInfo>
+ <PublishOptions>
+ <Version Value="2"/>
+ <IgnoreBinaries Value="False"/>
+ <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
+ <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
+ </PublishOptions>
+ <RunParams>
+ <local>
+ <FormatVersion Value="1"/>
+ <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
+ </local>
+ </RunParams>
+ <RequiredPackages Count="1">
+ <Item1>
+ <PackageName Value="fpgui_package"/>
+ </Item1>
+ </RequiredPackages>
+ <Units Count="2">
+ <Unit0>
+ <Filename Value="comboboxtest.lpr"/>
+ <IsPartOfProject Value="True"/>
+ <UnitName Value="comboboxtest"/>
+ </Unit0>
+ <Unit1>
+ <Filename Value="frm_main.pas"/>
+ <IsPartOfProject Value="True"/>
+ <UnitName Value="frm_main"/>
+ </Unit1>
+ </Units>
+ </ProjectOptions>
+ <CompilerOptions>
+ <Version Value="5"/>
+ <CodeGeneration>
+ <Generate Value="Faster"/>
+ </CodeGeneration>
+ <Other>
+ <CustomOptions Value="-FUunits"/>
+ <CompilerPath Value="$(CompPath)"/>
+ </Other>
+ </CompilerOptions>
+</CONFIG>
diff --git a/examples/gui/combobox/comboboxtest.lpr b/examples/gui/combobox/comboboxtest.lpr
new file mode 100644
index 00000000..a3a38da1
--- /dev/null
+++ b/examples/gui/combobox/comboboxtest.lpr
@@ -0,0 +1,29 @@
+program comboboxtest;
+
+{$mode objfpc}{$H+}
+
+uses
+ {$IFDEF UNIX}{$IFDEF UseCThreads}
+ cthreads,
+ {$ENDIF}{$ENDIF}
+ Classes, fpgfx, frm_main;
+
+procedure MainProc;
+var
+ frm: TMainForm;
+begin
+ fpgApplication.Initialize;
+ frm := TMainForm.Create(nil);
+ try
+ frm.Show;
+ fpgApplication.Run;
+ finally
+ frm.Free;
+ end;
+end;
+
+begin
+ MainProc;
+end.
+
+
diff --git a/examples/gui/combobox/extrafpc.cfg b/examples/gui/combobox/extrafpc.cfg
new file mode 100644
index 00000000..073dc4b6
--- /dev/null
+++ b/examples/gui/combobox/extrafpc.cfg
@@ -0,0 +1,5 @@
+-FUunits
+-Fu../../../lib
+-Xs
+-XX
+-CX
diff --git a/examples/gui/combobox/frm_main.pas b/examples/gui/combobox/frm_main.pas
new file mode 100644
index 00000000..2b834b51
--- /dev/null
+++ b/examples/gui/combobox/frm_main.pas
@@ -0,0 +1,251 @@
+unit frm_main;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ SysUtils, Classes, gfxbase, fpgfx, gui_edit,
+ gfx_widget, gui_form, gui_label, gui_button,
+ gui_listbox, gui_memo, gui_combobox, gui_basegrid, gui_grid,
+ gui_dialogs, gui_checkbox, gui_tree, gui_trackbar,
+ gui_progressbar, gui_radiobutton, gui_tab, gui_menu,
+ gui_panel, gui_popupcalendar, gui_gauge, gui_editcombo;
+
+type
+
+ TMainForm = class(TfpgForm)
+ private
+ procedure cbAutoCompleteChanged(Sender: TObject);
+ procedure cbAutoDropDownChanged(Sender: TObject);
+ procedure cbAllowNewChanged(Sender: TObject);
+ procedure btnAdd1Clicked(Sender: TObject);
+ procedure btnFocusClicked(Sender: TObject);
+ procedure btnClearClicked(Sender: TObject);
+ procedure btnAdd10Clicked(Sender: TObject);
+ public
+ {@VFD_HEAD_BEGIN: MainForm}
+ btnAdd10: TfpgButton;
+ btnClear: TfpgButton;
+ btnFocus: TfpgButton;
+ btnAdd1: TfpgButton;
+ cbAutoComplete: TfpgCheckBox;
+ Combo1: TfpgComboBox;
+ lblName1: TfpgLabel;
+ lblName2: TfpgLabel;
+ EditCombo1: TfpgEditCombo;
+ cbAutoDropdown: TfpgCheckBox;
+ lblName3: TfpgLabel;
+ lblName4: TfpgLabel;
+ cbAllowNew: TfpgComboBox;
+ {@VFD_HEAD_END: MainForm}
+ procedure AfterCreate; override;
+ end;
+
+{@VFD_NEWFORM_DECL}
+
+implementation
+
+{@VFD_NEWFORM_IMPL}
+
+procedure TMainForm.cbAutoCompleteChanged(Sender: TObject);
+begin
+ EditCombo1.AutoCompletion := cbAutoComplete.Checked;
+end;
+
+procedure TMainForm.cbAutoDropDownChanged(Sender: TObject);
+begin
+ EditCombo1.AutoDropDown := cbAutoDropdown.Checked;
+end;
+
+procedure TMainForm.cbAllowNewChanged(Sender: TObject);
+begin
+ if cbAllowNew.Text = 'anNo' then
+ EditCombo1.AllowNew := anNo
+ else if cbAllowNew.Text = 'anYes' then
+ EditCombo1.AllowNew := anYes
+ else if cbAllowNew.Text = 'anAsk' then
+ EditCombo1.AllowNew := anAsk
+end;
+
+procedure TMainForm.btnAdd1Clicked(Sender: TObject);
+begin
+ Combo1.Items.Add(Format('Item %2d', [Combo1.Items.Count]));
+ EditCombo1.Items.Add(Format('Item %2d', [EditCombo1.Items.Count]));
+end;
+
+procedure TMainForm.btnFocusClicked(Sender: TObject);
+begin
+ if Combo1.Items.Count > 1 then
+ Combo1.FocusItem := 2;
+ if EditCombo1.Items.Count > 1 then
+ EditCombo1.FocusItem := 2;
+end;
+
+procedure TMainForm.btnClearClicked(Sender: TObject);
+begin
+ Combo1.Items.Clear;
+ EditCombo1.Items.Clear;
+end;
+
+procedure TMainForm.btnAdd10Clicked(Sender: TObject);
+var
+ i: integer;
+begin
+ for i := 1 to 10 do
+ begin
+ Combo1.Items.Add(Format('Item %2d', [Combo1.Items.Count]));
+ EditCombo1.Items.Add(Format('Item %2d', [EditCombo1.Items.Count]));
+ end;
+end;
+
+procedure TMainForm.AfterCreate;
+begin
+ {@VFD_BODY_BEGIN: MainForm}
+ Name := 'MainForm';
+ SetPosition(345, 220, 344, 260);
+ WindowTitle := 'ComboBox test';
+ WindowPosition := wpScreenCenter;
+
+ btnAdd10 := TfpgButton.Create(self);
+ with btnAdd10 do
+ begin
+ Name := 'btnAdd10';
+ SetPosition(220, 28, 92, 23);
+ Text := 'Add 10 items';
+ FontDesc := '#Label1';
+ ImageName := '';
+ TabOrder := 1;
+ OnClick := @btnAdd10Clicked;
+ end;
+
+ btnClear := TfpgButton.Create(self);
+ with btnClear do
+ begin
+ Name := 'btnClear';
+ SetPosition(220, 56, 92, 23);
+ Text := 'Clear Items';
+ FontDesc := '#Label1';
+ ImageName := '';
+ TabOrder := 2;
+ OnClick := @btnClearClicked;
+ end;
+
+ btnFocus := TfpgButton.Create(self);
+ with btnFocus do
+ begin
+ Name := 'btnFocus';
+ SetPosition(220, 84, 92, 23);
+ Text := 'FocusItem = 2';
+ FontDesc := '#Label1';
+ ImageName := '';
+ TabOrder := 3;
+ OnClick := @btnFocusClicked;
+ end;
+
+ btnAdd1 := TfpgButton.Create(self);
+ with btnAdd1 do
+ begin
+ Name := 'btnAdd1';
+ SetPosition(220, 112, 92, 23);
+ Text := 'Add 1 item';
+ FontDesc := '#Label1';
+ ImageName := '';
+ TabOrder := 4;
+ OnClick := @btnAdd1Clicked;
+ end;
+
+ cbAutoComplete := TfpgCheckBox.Create(self);
+ with cbAutoComplete do
+ begin
+ Name := 'cbAutoComplete';
+ SetPosition(216, 168, 120, 19);
+ FontDesc := '#Label1';
+ TabOrder := 6;
+ Text := 'Auto Complete';
+ OnChange := @cbAutoCompleteChanged;
+ end;
+
+ Combo1 := TfpgComboBox.Create(self);
+ with Combo1 do
+ begin
+ Name := 'Combo1';
+ SetPosition(8, 24, 168, 21);
+ FontDesc := '#List';
+ TabOrder := 6;
+ end;
+
+ lblName1 := TfpgLabel.Create(self);
+ with lblName1 do
+ begin
+ Name := 'lblName1';
+ SetPosition(8, 8, 176, 15);
+ FontDesc := '#Label1';
+ Text := 'Static ComboBox';
+ end;
+
+ lblName2 := TfpgLabel.Create(self);
+ with lblName2 do
+ begin
+ Name := 'lblName2';
+ SetPosition(8, 68, 176, 15);
+ FontDesc := '#Label1';
+ Text := 'Edit ComboBox';
+ end;
+
+ EditCombo1 := TfpgEditCombo.Create(self);
+ with EditCombo1 do
+ begin
+ Name := 'EditCombo1';
+ SetPosition(8, 88, 168, 21);
+ end;
+
+ cbAutoDropdown := TfpgCheckBox.Create(self);
+ with cbAutoDropdown do
+ begin
+ Name := 'cbAutoDropdown';
+ SetPosition(216, 188, 120, 19);
+ FontDesc := '#Label1';
+ TabOrder := 9;
+ Text := 'Auto Dropdown';
+ OnChange := @cbAutoDropDownChanged;
+ end;
+
+ lblName3 := TfpgLabel.Create(self);
+ with lblName3 do
+ begin
+ Name := 'lblName3';
+ SetPosition(204, 148, 128, 15);
+ FontDesc := '#Label2';
+ Text := 'EditCombo only';
+ end;
+
+ lblName4 := TfpgLabel.Create(self);
+ with lblName4 do
+ begin
+ Name := 'lblName4';
+ SetPosition(204, 8, 136, 15);
+ FontDesc := '#Label2';
+ Text := 'Both components';
+ end;
+
+ cbAllowNew := TfpgComboBox.Create(self);
+ with cbAllowNew do
+ begin
+ Name := 'cbAllowNew';
+ SetPosition(220, 212, 100, 21);
+ FontDesc := '#List';
+ Items.Add('anNo');
+ Items.Add('anYes');
+ Items.Add('anAsk');
+ TabOrder := 13;
+ OnChange := @cbAllowNewChanged;
+ FocusItem := 0;
+ end;
+
+ {@VFD_BODY_END: MainForm}
+
+end;
+
+
+end.
diff --git a/examples/gui/filedialog/filedialog.lpr b/examples/gui/filedialog/filedialog.lpr
index 29635dbb..e7fa99ce 100644
--- a/examples/gui/filedialog/filedialog.lpr
+++ b/examples/gui/filedialog/filedialog.lpr
@@ -55,7 +55,7 @@ type
function TMyDBLoginDlg.GetDatabase: TfpgString;
begin
- Result := aStringList.ValueFromIndex[cbDatabases.FocusItem-1];
+ Result := aStringList.ValueFromIndex[cbDatabases.FocusItem];
end;
procedure TMyDBLoginDlg.PopulateComboDb;
@@ -64,9 +64,9 @@ var
begin
aStringList.Clear;
aStringList.Add('Database1=192.168.0.1:/data/db1.gdb');
- aStringList.Add('Database2=192.168.0.10:/data/live.gdb');
- aStringList.Add('Database3=192.168.0.150:/data/sometest.gdb');
- aStringList.Add('Database4=192.168.0.200:c:\MyData\test.gdb');
+ aStringList.Add('Database2=192.168.0.10:/data/db2.gdb');
+ aStringList.Add('Database3=192.168.0.150:/data/db3.gdb');
+ aStringList.Add('Database4=192.168.0.200:c:\MyData\db4.gdb');
cbDatabases.Items.Clear;
for i := 0 to aStringList.Count-1 do
cbDatabases.Items.Add(aStringList.Names[i]);
diff --git a/examples/gui/gridtest/gridtest.lpr b/examples/gui/gridtest/gridtest.lpr
index a7bbe7fc..2bd6d4ec 100644
--- a/examples/gui/gridtest/gridtest.lpr
+++ b/examples/gui/gridtest/gridtest.lpr
@@ -34,13 +34,21 @@ type
chkDisabled: TfpgCheckBox;
edtTopRow: TfpgEditInteger;
btnTopRow: TfpgButton;
+ btnAddFive: TfpgButton;
+ btnAddOne: TfpgButton;
+ btnFiveOnly: TfpgButton;
{@VFD_HEAD_END: MainForm}
+ procedure StringGridDoubleClicked(Sender: TObject; AButton: TMouseButton;
+ AShift: TShiftState; const AMousePos: TPoint);
+ procedure btnAddFiveClicked(Sender: TObject);
+ procedure btnAddOneClicked(Sender: TObject);
+ procedure btnFiveOnlyClicked(Sender: TObject);
procedure chkDisabledChange(Sender: TObject);
procedure chkRowSelectChange(Sender: TObject);
procedure chkShowHeaderChange(Sender: TObject);
procedure chkShowGridChange(Sender: TObject);
procedure btnQuitClick(Sender: TObject);
- procedure stringgridDrawCell(Sender: TObject; const ARow, ACol: Longword;
+ procedure stringgridDrawCell(Sender: TObject; const ARow, ACol: Integer;
const ARect: TfpgRect; const AFlags: TfpgGridDrawState; var ADefaultDrawing: boolean);
procedure btnTopRowClicked(Sender: TObject);
public
@@ -51,6 +59,30 @@ type
{ TMainForm }
+procedure TMainForm.StringGridDoubleClicked(Sender: TObject;
+ AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint);
+var
+ lCol, lRow: integer;
+begin
+ StringGrid.MouseToCell(AMousePos.X, AMousePos.Y, lCol, lRow);
+ StringGrid.Cells[lCol, lRow] := Format('(c%d,r%d)', [lCol, lRow]);
+end;
+
+procedure TMainForm.btnAddFiveClicked(Sender: TObject);
+begin
+ StringGrid.RowCount := StringGrid.RowCount + 5;
+end;
+
+procedure TMainForm.btnAddOneClicked(Sender: TObject);
+begin
+ StringGrid.RowCount := StringGrid.RowCount + 1;
+end;
+
+procedure TMainForm.btnFiveOnlyClicked(Sender: TObject);
+begin
+ StringGrid.RowCount := 5;
+end;
+
procedure TMainForm.chkDisabledChange(Sender: TObject);
begin
stringgrid.Enabled := not chkDisabled.Checked;
@@ -77,7 +109,7 @@ begin
end;
procedure TMainForm.stringgridDrawCell(Sender: TObject; const ARow,
- ACol: Longword; const ARect: TfpgRect; const AFlags: TfpgGridDrawState;
+ ACol: Integer; const ARect: TfpgRect; const AFlags: TfpgGridDrawState;
var ADefaultDrawing: boolean);
begin
if (ACol = 1) and (ARow = 3) then
@@ -93,7 +125,7 @@ end;
procedure TMainForm.btnTopRowClicked(Sender: TObject);
begin
- if edtTopRow.Value < 1 then
+ if edtTopRow.Value < 0 then
Exit;
stringgrid.TopRow := edtTopRow.Value;
end;
@@ -104,7 +136,7 @@ var
begin
{@VFD_BODY_BEGIN: MainForm}
Name := 'MainForm';
- SetPosition(351, 214, 566, 350);
+ SetPosition(351, 214, 515, 350);
WindowTitle := 'Grid control test';
WindowPosition := wpScreenCenter;
@@ -112,7 +144,7 @@ begin
with btnQuit do
begin
Name := 'btnQuit';
- SetPosition(476, 320, 80, 25);
+ SetPosition(425, 320, 80, 25);
Anchors := [anRight,anBottom];
Text := 'Quit';
FontDesc := '#Label1';
@@ -124,11 +156,12 @@ begin
with stringgrid do
begin
Name := 'stringgrid';
- SetPosition(10, 10, 426, 250);
+ SetPosition(10, 10, 375, 250);
Anchors := [anLeft,anRight,anTop,anBottom];
+ AddColumn('Column 0', 65);
AddColumn('Column 1', 100, taLeftJustify);
AddColumn('Col 2', 50, taCenter);
- AddColumn('New', 150, taRightJustify);
+ AddColumn('Numbers', 150, taRightJustify);
FontDesc := '#Grid';
HeaderFontDesc := '#GridHeader';
RowCount := 17;
@@ -143,12 +176,14 @@ begin
TextColor:= clBlue;
ColumnTextColor[1] := clRed;
// add some text
- Cells[1, 1] := '(r1,c1)';
+ Cells[0, 0] := '[c0, r0]';
+ Cells[1, 1] := '[c1, r1]';
Cells[1, 3] := 'Custom';
Cells[2, 3] := 'Hello';
- Cells[3, 1] := '(r1,c3)';
+ Cells[3, 1] := '[c3, r1]';
// Add custom painting
- OnDrawCell := @stringgridDrawCell;
+ OnDrawCell := @StringGridDrawCell;
+ OnDoubleClick := @StringGridDoubleClicked;
end;
chkShowHeader := TfpgCheckBox.Create(self);
@@ -168,7 +203,7 @@ begin
with chkShowGrid do
begin
Name := 'chkShowGrid';
- SetPosition(110, 320, 100, 24);
+ SetPosition(114, 320, 92, 24);
Anchors := [anLeft,anBottom];
Checked := True;
FontDesc := '#Label1';
@@ -213,7 +248,7 @@ begin
with btnTopRow do
begin
Name := 'btnTopRow';
- SetPosition(76, 280, 91, 24);
+ SetPosition(72, 280, 91, 23);
Anchors := [anLeft,anBottom];
Text := 'Set TopRow';
FontDesc := '#Label1';
@@ -222,9 +257,48 @@ begin
OnClick := @btnTopRowClicked;
end;
+ btnAddFive := TfpgButton.Create(self);
+ with btnAddFive do
+ begin
+ Name := 'btnAddFive';
+ SetPosition(188, 280, 80, 23);
+ Anchors := [anLeft,anBottom];
+ Text := 'Add 5 lines';
+ FontDesc := '#Label1';
+ ImageName := '';
+ TabOrder := 8;
+ OnClick := @btnAddFiveClicked;
+ end;
+
+ btnAddOne := TfpgButton.Create(self);
+ with btnAddOne do
+ begin
+ Name := 'btnAddOne';
+ SetPosition(272, 280, 80, 23);
+ Anchors := [anLeft,anBottom];
+ Text := 'Add 1 line';
+ FontDesc := '#Label1';
+ ImageName := '';
+ TabOrder := 9;
+ OnClick := @btnAddOneClicked;
+ end;
+
+ btnFiveOnly := TfpgButton.Create(self);
+ with btnFiveOnly do
+ begin
+ Name := 'btnFiveOnly';
+ SetPosition(356, 280, 80, 23);
+ Anchors := [anLeft,anBottom];
+ Text := '5 lines only';
+ FontDesc := '#Label1';
+ ImageName := '';
+ TabOrder := 10;
+ OnClick := @btnFiveOnlyClicked;
+ end;
+
{@VFD_BODY_END: MainForm}
- for r := 1 to stringgrid.RowCount do
+ for r := 0 to stringgrid.RowCount-1 do
stringgrid.Cells[3, r] := IntToStr(r);
end;
diff --git a/examples/gui/listbox/frm_main.pas b/examples/gui/listbox/frm_main.pas
new file mode 100644
index 00000000..9757bfc9
--- /dev/null
+++ b/examples/gui/listbox/frm_main.pas
@@ -0,0 +1,160 @@
+unit frm_main;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ SysUtils, Classes, gfxbase, fpgfx, gui_edit,
+ gfx_widget, gui_form, gui_label, gui_button,
+ gui_listbox, gui_memo, gui_combobox, gui_basegrid, gui_grid,
+ gui_dialogs, gui_checkbox, gui_tree, gui_trackbar,
+ gui_progressbar, gui_radiobutton, gui_tab, gui_menu,
+ gui_panel, gui_popupcalendar, gui_gauge;
+
+type
+
+ TMainForm = class(TfpgForm)
+ private
+ procedure cbHotTrackChanged(Sender: TObject);
+ procedure btnAdd1Clicked(Sender: TObject);
+ procedure btnFocusClicked(Sender: TObject);
+ procedure btnClearClicked(Sender: TObject);
+ procedure btnAdd10Clicked(Sender: TObject);
+ public
+ {@VFD_HEAD_BEGIN: MainForm}
+ lstName1: TfpgListBox;
+ btnAdd10: TfpgButton;
+ btnClear: TfpgButton;
+ btnFocus: TfpgButton;
+ btnAdd1: TfpgButton;
+ memName1: TfpgMemo;
+ cbHotTrack: TfpgCheckBox;
+ {@VFD_HEAD_END: MainForm}
+ procedure AfterCreate; override;
+ end;
+
+{@VFD_NEWFORM_DECL}
+
+implementation
+
+{@VFD_NEWFORM_IMPL}
+
+procedure TMainForm.cbHotTrackChanged(Sender: TObject);
+begin
+ lstName1.HotTrack := cbHotTrack.Checked;
+end;
+
+procedure TMainForm.btnAdd1Clicked(Sender: TObject);
+begin
+ lstName1.Items.Add(Format('Item %2d', [lstName1.ItemCount]));
+end;
+
+procedure TMainForm.btnFocusClicked(Sender: TObject);
+begin
+ if lstName1.ItemCount > 1 then
+ lstName1.FocusItem := 2;
+end;
+
+procedure TMainForm.btnClearClicked(Sender: TObject);
+begin
+ lstName1.Items.Clear;
+end;
+
+procedure TMainForm.btnAdd10Clicked(Sender: TObject);
+var
+ i: integer;
+begin
+ for i := 1 to 10 do
+ lstName1.Items.Add(Format('Item %2d', [lstName1.ItemCount]));
+end;
+
+procedure TMainForm.AfterCreate;
+begin
+ {@VFD_BODY_BEGIN: MainForm}
+ Name := 'MainForm';
+ SetPosition(345, 220, 300, 270);
+ WindowTitle := 'ListBox test';
+ WindowPosition := wpScreenCenter;
+
+ lstName1 := TfpgListBox.Create(self);
+ with lstName1 do
+ begin
+ Name := 'lstName1';
+ SetPosition(12, 12, 128, 168);
+ FontDesc := '#List';
+ end;
+
+ btnAdd10 := TfpgButton.Create(self);
+ with btnAdd10 do
+ begin
+ Name := 'btnAdd10';
+ SetPosition(204, 28, 92, 23);
+ Text := 'Add 10 items';
+ FontDesc := '#Label1';
+ ImageName := '';
+ TabOrder := 1;
+ OnClick := @btnAdd10Clicked;
+ end;
+
+ btnClear := TfpgButton.Create(self);
+ with btnClear do
+ begin
+ Name := 'btnClear';
+ SetPosition(204, 56, 92, 23);
+ Text := 'Clear Items';
+ FontDesc := '#Label1';
+ ImageName := '';
+ TabOrder := 2;
+ OnClick := @btnClearClicked;
+ end;
+
+ btnFocus := TfpgButton.Create(self);
+ with btnFocus do
+ begin
+ Name := 'btnFocus';
+ SetPosition(204, 84, 92, 23);
+ Text := 'FocusItem = 2';
+ FontDesc := '#Label1';
+ ImageName := '';
+ TabOrder := 3;
+ OnClick := @btnFocusClicked;
+ end;
+
+ btnAdd1 := TfpgButton.Create(self);
+ with btnAdd1 do
+ begin
+ Name := 'btnAdd1';
+ SetPosition(204, 112, 92, 23);
+ Text := 'Add 1 item';
+ FontDesc := '#Label1';
+ ImageName := '';
+ TabOrder := 4;
+ OnClick := @btnAdd1Clicked;
+ end;
+
+ memName1 := TfpgMemo.Create(self);
+ with memName1 do
+ begin
+ Name := 'memName1';
+ SetPosition(12, 188, 280, 77);
+ FontDesc := '#Edit1';
+ TabOrder := 5;
+ end;
+
+ cbHotTrack := TfpgCheckBox.Create(self);
+ with cbHotTrack do
+ begin
+ Name := 'cbHotTrack';
+ SetPosition(204, 140, 120, 19);
+ FontDesc := '#Label1';
+ TabOrder := 6;
+ Text := 'Track Focus';
+ OnChange := @cbHotTrackChanged;
+ end;
+
+ {@VFD_BODY_END: MainForm}
+end;
+
+
+end.
diff --git a/examples/gui/listbox/listboxtest.lpi b/examples/gui/listbox/listboxtest.lpi
new file mode 100644
index 00000000..f80a70b0
--- /dev/null
+++ b/examples/gui/listbox/listboxtest.lpi
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+<CONFIG>
+ <ProjectOptions>
+ <PathDelim Value="/"/>
+ <Version Value="6"/>
+ <General>
+ <Flags>
+ <SaveOnlyProjectUnits Value="True"/>
+ </Flags>
+ <SessionStorage Value="InProjectDir"/>
+ <MainUnit Value="0"/>
+ <IconPath Value="./"/>
+ <TargetFileExt Value=""/>
+ </General>
+ <VersionInfo>
+ <ProjectVersion Value=""/>
+ </VersionInfo>
+ <PublishOptions>
+ <Version Value="2"/>
+ <IgnoreBinaries Value="False"/>
+ <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
+ <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
+ </PublishOptions>
+ <RunParams>
+ <local>
+ <FormatVersion Value="1"/>
+ <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
+ </local>
+ </RunParams>
+ <RequiredPackages Count="1">
+ <Item1>
+ <PackageName Value="fpgui_package"/>
+ </Item1>
+ </RequiredPackages>
+ <Units Count="2">
+ <Unit0>
+ <Filename Value="listboxtest.lpr"/>
+ <IsPartOfProject Value="True"/>
+ <UnitName Value="listboxtest"/>
+ </Unit0>
+ <Unit1>
+ <Filename Value="frm_main.pas"/>
+ <IsPartOfProject Value="True"/>
+ <UnitName Value="frm_main"/>
+ </Unit1>
+ </Units>
+ </ProjectOptions>
+ <CompilerOptions>
+ <Version Value="5"/>
+ <CodeGeneration>
+ <Generate Value="Faster"/>
+ </CodeGeneration>
+ <Other>
+ <CustomOptions Value="-FUunits"/>
+ <CompilerPath Value="$(CompPath)"/>
+ </Other>
+ </CompilerOptions>
+</CONFIG>
diff --git a/examples/gui/listbox/listboxtest.lpr b/examples/gui/listbox/listboxtest.lpr
new file mode 100644
index 00000000..dd14a408
--- /dev/null
+++ b/examples/gui/listbox/listboxtest.lpr
@@ -0,0 +1,29 @@
+program listboxtest;
+
+{$mode objfpc}{$H+}
+
+uses
+ {$IFDEF UNIX}{$IFDEF UseCThreads}
+ cthreads,
+ {$ENDIF}{$ENDIF}
+ Classes, fpgfx, frm_main, fpgui_package;
+
+procedure MainProc;
+var
+ frm: TMainForm;
+begin
+ fpgApplication.Initialize;
+ frm := TMainForm.Create(nil);
+ try
+ frm.Show;
+ fpgApplication.Run;
+ finally
+ frm.Free;
+ end;
+end;
+
+begin
+ MainProc;
+end.
+
+
diff --git a/examples/gui/memo/memotest.lpr b/examples/gui/memo/memotest.lpr
index c3e106a8..e4eed10b 100644
--- a/examples/gui/memo/memotest.lpr
+++ b/examples/gui/memo/memotest.lpr
@@ -57,9 +57,9 @@ begin
memo.Lines.Add('Memo Test0');
memo.Lines.Add('Memo Test1');
- //memo.Lines.Add('Memo Test2');
- //memo.Lines.Add('Memo Test3');
- //memo.Lines.Add('Memo Test4');
+ memo.Lines.Add('Memo Test2');
+ memo.Lines.Add('Memo Test3');
+ memo.Lines.Add('Memo Test4');
memo.Lines.Insert(1,'0 Before 1 after');
//memo.Lines.Delete(1);
//memo.Lines.Text := 'Dude'+LineEnding+'What''s mine say?'+LineEnding;;
diff --git a/examples/gui/menutest/menutest.lpr b/examples/gui/menutest/menutest.lpr
index c95c49de..801bdb97 100644
--- a/examples/gui/menutest/menutest.lpr
+++ b/examples/gui/menutest/menutest.lpr
@@ -77,8 +77,7 @@ begin
FHelpSubMenu.AddMenuItem('Test Russian text -> Òåñò', '', @miMenuItemSelected);
// Create main menu bar
- FMenuBar := TfpgMenuBar.Create(self);
- FMenuBar.SetPosition(0, 0, Width, FMenuBar.Height);
+ FMenuBar := CreateMenuBar(self);
FMenuBar.AddMenuItem('&File', nil).SubMenu := FFileSubMenu;
FMenuBar.AddMenuItem('&Edit', nil).SubMenu := FEditSubMenu;
FMenuBar.AddMenuItem('&Windows', nil);