summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/gui/dbftest/dbftest.lpi53
-rw-r--r--examples/gui/dbftest/dbftest.pas71
-rw-r--r--examples/gui/dbftest/mainform.frm2
-rw-r--r--examples/gui/dbftest/test.dbfbin704 -> 704 bytes
-rw-r--r--examples/gui/widgetdemo/widgetdemo.lpr2
-rw-r--r--examples/gui/widgettest/mainform.frm5
-rw-r--r--examples/gui/widgettest/widgettest.lpi7
-rw-r--r--examples/gui/widgettest/widgettest.pas13
-rw-r--r--gfx/gfxbase.pas3
-rw-r--r--gfx/x11/fpgfxpackage.lpk2
-rw-r--r--gfx/x11/gfx_x11.pas6
-rw-r--r--gfx/x11/unitxft.pas2
-rw-r--r--gui/db/fpgui_db.pas82
-rw-r--r--gui/fpgui.pas21
-rw-r--r--gui/fpguidialogs.inc115
-rw-r--r--gui/fpguiform.inc3
-rw-r--r--gui/fpguilabel.inc22
-rw-r--r--gui/fpguilayouts.inc17
-rw-r--r--gui/fpguipackage.lpk9
-rw-r--r--gui/fpguipackage.pas2
20 files changed, 296 insertions, 141 deletions
diff --git a/examples/gui/dbftest/dbftest.lpi b/examples/gui/dbftest/dbftest.lpi
new file mode 100644
index 00000000..233e1ae5
--- /dev/null
+++ b/examples/gui/dbftest/dbftest.lpi
@@ -0,0 +1,53 @@
+<?xml version="1.0"?>
+<CONFIG>
+ <ProjectOptions>
+ <PathDelim Value="/"/>
+ <Version Value="5"/>
+ <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="fpguipackage"/>
+ </Item1>
+ </RequiredPackages>
+ <Units Count="1">
+ <Unit0>
+ <Filename Value="dbftest.pas"/>
+ <IsPartOfProject Value="True"/>
+ <UnitName Value="DBFTest"/>
+ </Unit0>
+ </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/dbftest/dbftest.pas b/examples/gui/dbftest/dbftest.pas
index 3a76cea7..d96b0fb9 100644
--- a/examples/gui/dbftest/dbftest.pas
+++ b/examples/gui/dbftest/dbftest.pas
@@ -18,15 +18,18 @@
program DBFTest;
-uses SysUtils, Classes, fpGUI, fpGUI_DB, DB, DBF;
+uses
+ SysUtils, Classes, fpGFX, fpGUI, fpGUI_DB, DB, DBF;
type
- TMainForm = class(TForm)
+ { TMainForm }
+
+ TMainForm = class(TFForm)
DataSet: TDBF;
DataSource: TDataSource;
Box: TFBoxLayout;
- ListBox: TListBox;
+ ListBox: TFListBox;
CurDataseTFLabel: TFLabel;
CurNameText, CurEMailText: TDBText;
Navi: TFBoxLayout;
@@ -36,6 +39,9 @@ type
procedure PrevDatasetClick(Sender: TObject);
procedure NextDatasetClick(Sender: TObject);
procedure LastDatasetClick(Sender: TObject);
+ public
+ constructor Create(AOwner: TComponent); override;
+ destructor Destroy; override;
end;
@@ -48,15 +54,15 @@ var
x: Integer;
s: String;
begin
- DataSet := TDBF.Create(Self);
- DataSet.TableName := 'test.dbf';
- DataSource := TDataSource.Create(Self);
- DataSource.DataSet := DataSet;
+ DataSet := TDBF.Create(Self);
+ DataSet.TableName := 'test.dbf';
+ DataSource := TDataSource.Create(Self);
+ DataSource.DataSet := DataSet;
- CurNameText.DataSource := DataSource;
- CurNameText.DataField := 'Name';
- CurEMailText.DataSource := DataSource;
- CurEMailText.DataField := 'Address';
+ CurNameText.DataSource := DataSource;
+ CurNameText.DataField := 'Name';
+ CurEMailText.DataSource := DataSource;
+ CurEMailText.DataField := 'Address';
DataSet.Open;
@@ -69,46 +75,61 @@ begin
ListBox.Items.Add(s);
DataSet.Next;
end;
-
+
DataSet.First;
end;
procedure TMainForm.FirstDatasetClick(Sender: TObject);
begin
DataSet.First;
+ ReDraw; // a hack to get around a TFLabel.SetText issue
end;
procedure TMainForm.PrevDatasetClick(Sender: TObject);
begin
DataSet.Prior;
+ ReDraw; // a hack to get around a TFLabel.SetText issue
end;
procedure TMainForm.NextDatasetClick(Sender: TObject);
begin
DataSet.Next;
+ ReDraw; // a hack to get around a TFLabel.SetText issue
end;
procedure TMainForm.LastDatasetClick(Sender: TObject);
begin
DataSet.Last;
+ ReDraw; // a hack to get around a TFLabel.SetText issue
+end;
+
+constructor TMainForm.Create(AOwner: TComponent);
+begin
+ inherited Create(AOwner);
+ LoadForm(self);
+end;
+
+destructor TMainForm.Destroy;
+begin
+ DataSet.Close;
+ DataSource.Free;
+ DataSet.Free;
+ inherited Destroy;
end;
var
MainForm: TMainForm;
begin
- Application.Title := 'Interbase Test';
- Application.CreateForm(TMainForm, MainForm);
- Application.Run;
+// WriteLn('Version: ' + {$I %date%} + ' ' + {$I %time%});
+ GFApplication.Initialize;
+
+ MainForm := TMainForm.Create(GFApplication);
+ try
+ MainForm.Show;
+ GFApplication.Run;
+ finally
+ MainForm.Free;
+ end;
end.
-
-{
- $Log: dbftest.pp,v $
- Revision 1.2 2001/01/18 12:40:41 sg
- * Now uses the correct field names for the data links ;)
-
- Revision 1.1 2001/01/17 21:33:28 sg
- * First version
-
-}
diff --git a/examples/gui/dbftest/mainform.frm b/examples/gui/dbftest/mainform.frm
index 602336d4..5732549a 100644
--- a/examples/gui/dbftest/mainform.frm
+++ b/examples/gui/dbftest/mainform.frm
@@ -5,7 +5,7 @@ object MainForm: TMainForm
object Box: TFBoxLayout
Spacing = 8
Orientation = Vertical
- object ListBox: TListBox
+ object ListBox: TFListBox
end
object CurDataseTFLabel: TFLabel
Text = 'Current dataset:'
diff --git a/examples/gui/dbftest/test.dbf b/examples/gui/dbftest/test.dbf
index cebd1384..3274dd2a 100644
--- a/examples/gui/dbftest/test.dbf
+++ b/examples/gui/dbftest/test.dbf
Binary files differ
diff --git a/examples/gui/widgetdemo/widgetdemo.lpr b/examples/gui/widgetdemo/widgetdemo.lpr
index 0dc8d206..f0d7ef73 100644
--- a/examples/gui/widgetdemo/widgetdemo.lpr
+++ b/examples/gui/widgetdemo/widgetdemo.lpr
@@ -122,6 +122,7 @@ begin
Edit2.Text := 'Wagwoord teks';
btnExit.Text := 'Verlaat Verlaat';
btnHelp.Text := 'Hulp';
+ Update;
Redraw;
end;
@@ -143,6 +144,7 @@ begin
Edit2.Text := 'Password Edit';
btnExit.Text := 'Exit';
btnHelp.Text := 'Help';
+ Update;
Redraw;
end;
diff --git a/examples/gui/widgettest/mainform.frm b/examples/gui/widgettest/mainform.frm
index 165907a1..ce0f8ae6 100644
--- a/examples/gui/widgettest/mainform.frm
+++ b/examples/gui/widgettest/mainform.frm
@@ -70,6 +70,11 @@ object MainForm: TMainForm
Text = 'Progress Bar'
OnClick = ProgressBarBtnClick
end
+ object ShowMessageBtn: TFButton
+ CanExpandWidth = True
+ Text = 'ShowMessage()'
+ OnClick = ShowMessageBtnClick
+ end
object Separator: TSeparator
end
object ExitBtn: TFButton
diff --git a/examples/gui/widgettest/widgettest.lpi b/examples/gui/widgettest/widgettest.lpi
index 711d2936..be425d5c 100644
--- a/examples/gui/widgettest/widgettest.lpi
+++ b/examples/gui/widgettest/widgettest.lpi
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
- <PathDelim Value="\"/>
+ <PathDelim Value="/"/>
<Version Value="5"/>
<General>
<Flags>
@@ -9,7 +9,7 @@
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
- <IconPath Value=".\"/>
+ <IconPath Value="./"/>
<TargetFileExt Value=""/>
</General>
<PublishOptions>
@@ -20,7 +20,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">
@@ -39,7 +39,6 @@
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
- <PathDelim Value="\"/>
<Parsing>
<SyntaxOptions>
<IncludeAssertionCode Value="True"/>
diff --git a/examples/gui/widgettest/widgettest.pas b/examples/gui/widgettest/widgettest.pas
index 8dea18a2..0705396a 100644
--- a/examples/gui/widgettest/widgettest.pas
+++ b/examples/gui/widgettest/widgettest.pas
@@ -57,6 +57,7 @@ type
MenuBtn: TFButton;
PanelBtn: TFButton;
ProgressBarBtn: TFButton;
+ ShowMessageBtn: TFButton;
Separator: TSeparator;
ExitBtn: TFButton;
procedure CheckBoxBtnClick(Sender: TObject);
@@ -72,6 +73,7 @@ type
procedure MenuBtnClick(Sender: TObject);
procedure PanelBtnClick(Sender: TObject);
procedure ProgressBarBtnClick(Sender: TObject);
+ procedure ShowMessageBtnClick(Sender: TObject);
end;
@@ -567,8 +569,8 @@ procedure TMainForm.PanelBtnClick(Sender: TObject);
begin
if not Assigned(_frmPanel) then
_frmPanel := TPanelForm.Create(self);
- _frmPanel.Show;
- _frmPanel.SetPosition(Point(Left + Width + 5, FindForm.Top));
+ _frmPanel.ShowModal;
+// _frmPanel.SetPosition(Point(Left + Width + 5, FindForm.Top));
end;
procedure TMainForm.ProgressBarBtnClick(Sender: TObject);
@@ -579,6 +581,11 @@ begin
_frmProgressBar.SetPosition(Point(Left + Width + 5, FindForm.Top));
end;
+procedure TMainForm.ShowMessageBtnClick(Sender: TObject);
+begin
+ ShowMessage('Hello World!');
+end;
+
// -------------------------------------------------------------------
// TCheckboxForm
@@ -772,6 +779,8 @@ begin
for y := 0 to StringGrid.RowCount - 1 do
for x := 0 to StringGrid.ColCount - 1 do
StringGrid.Cells[x, y] := Format('%d, %d', [x, y]);
+
+ StringGrid.Cells[3, 3] := 'This is one long piece of text';
end;
constructor TGridForm.Create(AOwner: TComponent);
diff --git a/gfx/gfxbase.pas b/gfx/gfxbase.pas
index ab4759ca..04212b2f 100644
--- a/gfx/gfxbase.pas
+++ b/gfx/gfxbase.pas
@@ -357,7 +357,8 @@ type
function TextExtent(const AText: String): TSize; virtual;
function TextWidth(const AText: String): Integer; virtual;
procedure TextOut(const APosition: TPoint; const AText: String);
-
+// procedure TextRect(Rect: TRect; X, Y: Integer; const Text: WideString; TextFlags: Integer = 0);
+
// Bit block transfers
procedure Copy(ASource: TFCustomCanvas; const ADestPos: TPoint); virtual;
procedure CopyRect(ASource: TFCustomCanvas; const ASourceRect: TRect; const ADestPos: TPoint);
diff --git a/gfx/x11/fpgfxpackage.lpk b/gfx/x11/fpgfxpackage.lpk
index 84608925..c58916a3 100644
--- a/gfx/x11/fpgfxpackage.lpk
+++ b/gfx/x11/fpgfxpackage.lpk
@@ -20,7 +20,7 @@
"/>
<License Value="Modified LGPL
"/>
- <Version Minor="3"/>
+ <Version Minor="4"/>
<Files Count="9">
<Item1>
<Filename Value="../gfxbase.pas"/>
diff --git a/gfx/x11/gfx_x11.pas b/gfx/x11/gfx_x11.pas
index eb4c0eb5..1a9d2228 100644
--- a/gfx/x11/gfx_x11.pas
+++ b/gfx/x11/gfx_x11.pas
@@ -2128,11 +2128,7 @@ end;
function TX11FontResourceImpl.GetHeight: integer;
begin
- {$IFDEF XftSupport}
- Result := FFontData^.height;
- {$ELSE}
- Result := FFontData^.Ascent + FFontData^.Descent;
- {$ENDIF}
+ Result := GetAscent + GetDescent;
end;
end.
diff --git a/gfx/x11/unitxft.pas b/gfx/x11/unitxft.pas
index 2ede5a10..10958261 100644
--- a/gfx/x11/unitxft.pas
+++ b/gfx/x11/unitxft.pas
@@ -57,7 +57,7 @@ type
end;
TXftColor = record
- pixel : longword;
+ pixel : ptrint;
color : TXRenderColor;
end;
diff --git a/gui/db/fpgui_db.pas b/gui/db/fpgui_db.pas
index 4be0aff2..c67bc3a2 100644
--- a/gui/db/fpgui_db.pas
+++ b/gui/db/fpgui_db.pas
@@ -3,7 +3,7 @@
Database support classes
- Copyright (C) 2000 - 2006 See the file AUTHORS.txt, included in this
+ Copyright (C) 2000 - 2007 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
See the file COPYING.modifiedLGPL, included in this distribution,
@@ -17,57 +17,67 @@
unit fpGUI_DB;
{$IFDEF Debug}
-{$ASSERTIONS On}
+ {$ASSERTIONS On}
{$ENDIF}
interface
-uses Classes, fpGUI, DB;
+uses
+ Classes
+ ,fpGUI
+ ,DB
+ ;
type
+
TFieldDataLink = class(TDataLink)
private
- FWidget: TWidget;
+ FWidget: TFWidget;
FField: TField;
FFieldName: String;
FOnDataChange: TNotifyEvent;
- procedure SetFieldName(const AFieldName: String);
- procedure UpdateField;
+ procedure SetFieldName(const AFieldName: String);
+ procedure UpdateField;
protected
- procedure ActiveChanged; override;
- procedure RecordChanged(AField: TField); override;
+ procedure ActiveChanged; override;
+ procedure RecordChanged(AField: TField); override;
public
- constructor Create(AWidget: TWidget);
- property Field: TField read FField;
- property FieldName: String read FFieldName write SetFieldName;
- property OnDataChange: TNotifyEvent read FOnDataChange write FOnDataChange;
+ constructor Create(AWidget: TFWidget);
+ property Field: TField read FField;
+ property FieldName: String read FFieldName write SetFieldName;
+ property OnDataChange: TNotifyEvent read FOnDataChange write FOnDataChange;
end;
+
TDBText = class(TFCustomLabel)
private
FDataLink: TFieldDataLink;
- function GetDataField: String;
- procedure SetDataField(const ADataField: String);
- function GetDataSource: TDataSource;
- procedure SetDataSource(ADataSource: TDataSource);
- procedure DataChange(Sender: TObject);
+ function GetDataField: String;
+ procedure SetDataField(const ADataField: String);
+ function GetDataSource: TDataSource;
+ procedure SetDataSource(ADataSource: TDataSource);
+ procedure DataChange(Sender: TObject);
public
constructor Create(AOwner: TComponent); override;
- destructor Destroy; override;
+ destructor Destroy; override;
published
- property Text;
- property DataField: String read GetDataField write SetDataField;
- property DataSource: TDataSource read GetDataSource write SetDataSource;
+ property Alignment default taLeftJustify;
+ property CanExpandWidth;
+ property DataField: string read GetDataField write SetDataField;
+ property DataSource: TDataSource read GetDataSource write SetDataSource;
+ property Enabled;
+ property FontColor;
+ property Text;
end;
-// ===================================================================
-// ===================================================================
implementation
-constructor TFieldDataLink.Create(AWidget: TWidget);
+{ TFieldDataLink }
+
+constructor TFieldDataLink.Create(AWidget: TFWidget);
begin
inherited Create;
FWidget := AWidget;
@@ -95,13 +105,15 @@ end;
procedure TFieldDataLink.UpdateField;
begin
-WriteLn('##############UpdateField. DataSet: ', DataSource.DataSet.ClassName);
+ {$IFDEF DEBUG} WriteLn('## UpdateField. DataSet: ', DataSource.DataSet.ClassName); {$ENDIF}
FField := DataSource.DataSet.FindField(FieldName);
if Assigned(OnDataChange) then
OnDataChange(Self);
end;
+{ TDBText }
+
constructor TDBText.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
@@ -137,28 +149,18 @@ end;
procedure TDBText.DataChange(Sender: TObject);
begin
-Write('TDBText.DataChange');
+ {$IFDEF DEBUG} Write('TDBText.DataChange'); {$ENDIF}
if Assigned(FDataLink.Field) then
begin
Text := FDataLink.Field.DisplayText;
- WriteLn(' new text: "', Text, '"');
- end else
+ {$IFDEF DEBUG} WriteLn(' new text: "', Text, '"'); {$ENDIF}
+ end
+ else
begin
Text := '';
- WriteLn('DataLink has no data');
+ {$IFDEF DEBUG} WriteLn('DataLink has no data'); {$ENDIF}
end;
end;
-
end.
-
-{
- $Log: fpgui_db.pp,v $
- Revision 1.2 2001/01/17 21:36:26 sg
- * Updating fixes
-
- Revision 1.1 2000/12/23 23:20:16 sg
- * First public CVS version...
-
-}
diff --git a/gui/fpgui.pas b/gui/fpgui.pas
index 111521b2..285c4c3b 100644
--- a/gui/fpgui.pas
+++ b/gui/fpgui.pas
@@ -147,11 +147,12 @@ type
{$I fpguiprogressbar.inc}
-function ClipMinMax(val, min, max: Integer): Integer; //inline;
+function ClipMinMax(val, min, max: Integer): Integer;
{ This will change at a later date! }
procedure LoadForm(AForm: TComponent);
procedure SaveForm(AForm: TComponent);
+procedure ShowMessage(const AMessage: string);
implementation
@@ -223,6 +224,24 @@ begin
BinStream.Free;
end;
+// graeme: still work in progress (2007-05-01)
+procedure ShowMessage(const AMessage: string);
+var
+ frm: TFStandardDialog;
+begin
+ frm := TFStandardDialog.Create(GFApplication);
+ try
+ frm.Text := 'ShowMessage';
+ frm.Buttons := [mbOk];
+// frm.Buttons := [mbYes, mbNo, mbCancel, mbHelp];
+ frm.Message := AMessage;
+ frm.ShowModal;
+ finally
+// frm.Free;
+ end
+end;
+
+
{$IFDEF LAYOUTTRACES}
procedure LAYOUTTRACE(const Position: String; const args: array of const);
{$IFDEF TraceEvents}
diff --git a/gui/fpguidialogs.inc b/gui/fpguidialogs.inc
index b92bcc9b..413b11c3 100644
--- a/gui/fpguidialogs.inc
+++ b/gui/fpguidialogs.inc
@@ -3,7 +3,7 @@
Dialogs class declarations
- Copyright (C) 2000 - 2006 See the file AUTHORS.txt, included in this
+ Copyright (C) 2000 - 2007 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
See the file COPYING.modifiedLGPL, included in this distribution,
@@ -19,21 +19,27 @@
{$IFDEF read_interface}
+ { TFCustomStandardDialog }
+
TFCustomStandardDialog = class(TFCustomForm)
private
- procedure StdBtnClicked(Sender: TObject);
+ function GetMessage: string;
+ procedure SetMessage(const AValue: string);
+ procedure StdBtnClicked(Sender: TObject);
protected
FButtons: TMsgDlgButtons;
MainLayout, BtnLayout: TFBoxLayout;
Separator: TSeparator;
- function ProcessEvent(Event: TEventObj): Boolean; override;
- function DistributeEvent(Event: TEventObj): Boolean; override;
- procedure CalcSizes; override;
- procedure Resized; override;
- procedure SeTFButtons(AButtons: TMsgDlgButtons);
- property Buttons: TMsgDlgButtons read FButtons write SeTFButtons default [mbOk, mbCancel];
+ FMessage: TFLabel;
+ function ProcessEvent(Event: TEventObj): Boolean; override;
+ function DistributeEvent(Event: TEventObj): Boolean; override;
+ procedure CalcSizes; override;
+ procedure Resized; override;
+ procedure SetButtons(AButtons: TMsgDlgButtons);
+ property Buttons: TMsgDlgButtons read FButtons write SetButtons default [mbOk, mbCancel];
public
constructor Create(AOwner: TComponent); override;
+ property Message: string read GetMessage write SetMessage;
end;
@@ -43,6 +49,8 @@
property OnCreate;
property Buttons;
end;
+
+
{$ENDIF read_interface}
@@ -59,16 +67,6 @@
// public methods
constructor TFCustomStandardDialog.Create(AOwner: TComponent);
-
- function AddBtn(const AText: String; ADefault: Boolean): TFButton;
- begin
- Result := TFButton.Create(Self);
- Result.Text := AText;
- // Result.Default := ADefault;
- Result.OnClick := @StdBtnClicked;
- Result.Parent := BtnLayout;
- end;
-
begin
inherited Create(AOwner);
FButtons := [mbOk, mbCancel];
@@ -76,31 +74,23 @@ begin
MainLayout := TFBoxLayout.Create(Self);
MainLayout.Orientation := Vertical;
- MainLayout.SetEmbeddedParent(Self);
+ Child := MainLayout;
+ FMessage := TFLabel.Create(self);
+ FMessage.CanExpandWidth := True;
+ MainLayout.InsertChild(FMessage);
+
Separator := TSeparator.Create(Self);
- Separator.Parent := MainLayout;
+ MainLayout.InsertChild(Separator);
BtnLayout := TFBoxLayout.Create(Self);
BtnLayout.Orientation := Horizontal;
BtnLayout.HorzAlign := horzRight;
BtnLayout.VertAlign := vertCenter;
BtnLayout.CanExpandHeight := False;
- BtnLayout.Parent := MainLayout;
-
- if mbYes in FButtons then AddBtn(mbText_Yes, False);
- if mbNo in FButtons then AddBtn(mbText_No, False);
- if mbOk in FButtons then AddBtn(mbText_OK, True);
- if mbCancel in FButtons then AddBtn(mbText_Cancel, False);
- if mbApply in FButtons then AddBtn(mbText_Apply, False);
- if mbAbort in FButtons then AddBtn(mbText_Abort, False);
- if mbRetry in FButtons then AddBtn(mbText_Retry, False);
- if mbIgnore in FButtons then AddBtn(mbText_Ignore, False);
- if mbAll in FButtons then AddBtn(mbText_All, False);
- if mbNoToAll in FButtons then AddBtn(mbText_NoToAll, False);
- if mbYesToAll in FButtons then AddBtn(mbText_YesToAll, False);
- if mbHelp in FButtons then AddBtn(mbText_Help, False);
+ MainLayout.InsertChild(BtnLayout);
+ SetButtons(FButtons);
end;
@@ -138,16 +128,65 @@ procedure TFCustomStandardDialog.Resized;
begin
if Assigned(Child) then
Child.SetBounds(Point(BorderWidth, BorderWidth),
- gfxBase.Size(Width - 2 * BorderWidth,
- Height - MainLayout.DefSize.cy - 2 * BorderWidth));
+ Size(Width - 2 * BorderWidth,
+ Height - MainLayout.DefSize.cy - 2 * BorderWidth));
MainLayout.SetBounds(
Point(BorderWidth, Height - MainLayout.DefSize.cy - BorderWidth),
- gfxBase.Size(Width - 2 * BorderWidth, MainLayout.DefSize.cy - BorderWidth));
+ Size(Width - 2 * BorderWidth, MainLayout.DefSize.cy - BorderWidth));
end;
-procedure TFCustomStandardDialog.SeTFButtons(AButtons: TMsgDlgButtons);
+procedure TFCustomStandardDialog.SetButtons(AButtons: TMsgDlgButtons);
+
+ function AddBtn(const AText: String; ADefault: Boolean): TFButton;
+ begin
+ Result := TFButton.Create(Self);
+ Result.Text := AText;
+ // Result.Default := ADefault;
+ Result.OnClick := @StdBtnClicked;
+ Result.Parent := BtnLayout;
+ end;
+
+var
+ i: integer;
+ b: TFButton;
begin
+ // remove and free all previous buttons
+ for i := ComponentCount - 1 downto 0 do
+ begin
+ if Components[i] is TFButton then
+ begin
+ b := TFButton(Components[i]);
+ if BtnLayout.ContainsChild(b) then
+ BtnLayout.RemoveChild(b);
+ b.Free;
+ end;
+ end;
+
FButtons := AButtons;
+
+ if mbYes in FButtons then AddBtn(mbText_Yes, False);
+ if mbNo in FButtons then AddBtn(mbText_No, False);
+ if mbOk in FButtons then AddBtn(mbText_OK, True);
+ if mbCancel in FButtons then AddBtn(mbText_Cancel, False);
+ if mbApply in FButtons then AddBtn(mbText_Apply, False);
+ if mbAbort in FButtons then AddBtn(mbText_Abort, False);
+ if mbRetry in FButtons then AddBtn(mbText_Retry, False);
+ if mbIgnore in FButtons then AddBtn(mbText_Ignore, False);
+ if mbAll in FButtons then AddBtn(mbText_All, False);
+ if mbNoToAll in FButtons then AddBtn(mbText_NoToAll, False);
+ if mbYesToAll in FButtons then AddBtn(mbText_YesToAll, False);
+ if mbHelp in FButtons then AddBtn(mbText_Help, False);
+end;
+
+function TFCustomStandardDialog.GetMessage: string;
+begin
+ Result := FMessage.Text;
+end;
+
+procedure TFCustomStandardDialog.SetMessage(const AValue: string);
+begin
+ if FMessage.Text <> AValue then
+ FMessage.Text := AValue;
end;
procedure TFCustomStandardDialog.StdBtnClicked(Sender: TObject);
diff --git a/gui/fpguiform.inc b/gui/fpguiform.inc
index 0db9b297..9bd737da 100644
--- a/gui/fpguiform.inc
+++ b/gui/fpguiform.inc
@@ -124,7 +124,6 @@ begin
FCanExpandHeight := True;
FCursor := crArrow;
FWindowOptions := [woWindow];
-
end;
@@ -143,8 +142,6 @@ procedure TFCustomForm.Show;
begin
LAYOUTTRACE('TFCustomForm.Show for %s:%s', [Name, ClassName]);
-// if Assigned(Wnd) then ; // this makes sure that wnd is created
-
FVisible := True;
GFApplication.AddWindow(Wnd);
Wnd.Show;
diff --git a/gui/fpguilabel.inc b/gui/fpguilabel.inc
index b7903f22..80ca2346 100644
--- a/gui/fpguilabel.inc
+++ b/gui/fpguilabel.inc
@@ -3,7 +3,7 @@
Label class declarations
- Copyright (C) 2000 - 2006 See the file AUTHORS.txt, included in this
+ Copyright (C) 2000 - 2007 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
See the file COPYING.modifiedLGPL, included in this distribution,
@@ -38,13 +38,12 @@
TFLabel = class(TFCustomLabel)
- public
published
- property CanExpandWidth;
- property Enabled;
- property FontColor;
- property Text;
- property Alignment default taLeftJustify;
+ property Alignment default taLeftJustify;
+ property CanExpandWidth;
+ property Enabled;
+ property FontColor;
+ property Text;
end;
{$ENDIF read_interface}
@@ -63,7 +62,6 @@ var
x: Integer;
begin
Canvas.SetColor(Style.GetUIColor(FFontColor));
-// Canvas.SetColor(FFontColor);
case Alignment of
taLeftJustify: x := 0;
taCenter: x := (BoundsSize.cx - Canvas.TextWidth(Text)) div 2;
@@ -73,22 +71,19 @@ begin
(BoundsSize.cy - Canvas.FontCellHeight) div 2), Text, WidgetState);
end;
-
procedure TFCustomLabel.CalcSizes;
begin
with FindForm.Wnd.Canvas do
- FMinSize := gfxbase.Size(TextWidth(Text), FontCellHeight);
+ FMinSize := Size(TextWidth(Text), FontCellHeight);
end;
-
constructor TFCustomLabel.Create(const pText: string; pOwner: TComponent);
begin
Create(pOwner);
- Text := pText;
FFontColor := clWindowText;
+ Text := pText;
end;
-
procedure TFCustomLabel.SetAlignment(AAlignment: TAlignment);
begin
if AAlignment <> Alignment then
@@ -98,7 +93,6 @@ begin
end;
end;
-
procedure TFCustomLabel.SetFontColor(const AValue: TColor);
begin
if FFontColor = AValue then exit;
diff --git a/gui/fpguilayouts.inc b/gui/fpguilayouts.inc
index ad12545c..2c45cf84 100644
--- a/gui/fpguilayouts.inc
+++ b/gui/fpguilayouts.inc
@@ -665,9 +665,22 @@ end;
procedure TFCustomBoxLayout.RemoveChild(AChild: TFWidget);
+var
+ i: integer;
+ item: TFLayoutItem;
begin
+ for i := FWidgets.Count - 1 downto 0 do
+ begin
+ item := TFLayoutItem(FWidgets.Items[i]);
+ if item.Widget = AChild then
+ begin
+ item := nil;
+ FWidgets.Delete(i);
+ exit;
+ end
+ end;
{$Warning Not implemented yet.}
- raise Exception.Create('TCustomBoxLayout.RemoveChild - Not implemented yet');
+// raise Exception.Create('TCustomBoxLayout.RemoveChild - Not implemented yet');
end;
@@ -1016,7 +1029,7 @@ begin
Inc(w, (item.Width - 1) * FColSpacing);
Inc(h, (item.Height - 1) * FRowSpacing);
item.Widget.SetBounds(Point(x + item.x * FColSpacing,
- y + item.y * FRowSpacing), gfxbase.Size(w, h));
+ y + item.y * FRowSpacing), Size(w, h));
end;
FreeMem(ColInfos);
diff --git a/gui/fpguipackage.lpk b/gui/fpguipackage.lpk
index 1213b9a4..844c953b 100644
--- a/gui/fpguipackage.lpk
+++ b/gui/fpguipackage.lpk
@@ -6,6 +6,7 @@
<CompilerOptions>
<Version Value="5"/>
<SearchPaths>
+ <OtherUnitFiles Value="db/"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
@@ -26,8 +27,8 @@
"/>
<License Value="Modified LGPL
"/>
- <Version Minor="3"/>
- <Files Count="5">
+ <Version Minor="4"/>
+ <Files Count="6">
<Item1>
<Filename Value="fpgui.pas"/>
<UnitName Value="fpGUI"/>
@@ -48,6 +49,10 @@
<Filename Value="opensoftstyle.pas"/>
<UnitName Value="OpenSoftStyle"/>
</Item5>
+ <Item6>
+ <Filename Value="db/fpgui_db.pas"/>
+ <UnitName Value="fpGUI_DB"/>
+ </Item6>
</Files>
<LazDoc Paths="../docs/xml/gui/"/>
<RequiredPkgs Count="2">
diff --git a/gui/fpguipackage.pas b/gui/fpguipackage.pas
index 2e601325..1052517f 100644
--- a/gui/fpguipackage.pas
+++ b/gui/fpguipackage.pas
@@ -7,7 +7,7 @@ unit fpguipackage;
interface
uses
- fpGUI, StyleManager, WindowsStyle, MotifStyle, OpenSoftStyle;
+ fpGUI, StyleManager, WindowsStyle, MotifStyle, OpenSoftStyle, fpGUI_DB;
implementation