summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-09-14 09:45:57 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-09-14 09:45:57 +0000
commita4059e6c08752c3d763b236d9b48cbafff4a6c11 (patch)
tree04cdf8849082e7dd3abdaf92764838a7cf9dc09a
parenteedba8c151df038f4dc25d2e41726e8c6b0f5dd5 (diff)
downloadfpGUI-a4059e6c08752c3d763b236d9b48cbafff4a6c11.tar.xz
* Introduced Setter methods for BaseWindow Width and Height properties.
* Fixed a minor bug in ComboBox that maintained it's own Width property. This also fixed the issue in the uiDesigner loading forms with comboboxes and not painting the internal button.
-rw-r--r--examples/apps/uidesigner/vfddesigner.pas15
-rw-r--r--examples/apps/uidesigner/vfdformparser.pas10
-rw-r--r--src/corelib/gfx_popupwindow.pas4
-rw-r--r--src/corelib/gfxbase.pas20
-rw-r--r--src/gui/gui_combobox.pas30
5 files changed, 37 insertions, 42 deletions
diff --git a/examples/apps/uidesigner/vfddesigner.pas b/examples/apps/uidesigner/vfddesigner.pas
index 11200d97..b6ee116d 100644
--- a/examples/apps/uidesigner/vfddesigner.pas
+++ b/examples/apps/uidesigner/vfddesigner.pas
@@ -110,7 +110,6 @@ type
procedure ClearForm;
procedure DefaultHandler(var msg); override;
procedure Show;
- procedure InitTest;
function AddWidget(wg: TfpgWidget; wgc: TVFDWidgetClass): TWidgetDesigner;
function WidgetDesigner(wg: TfpgWidget): TWidgetDesigner;
function FindWidgetByName(const wgname: string): TfpgWidget;
@@ -475,20 +474,6 @@ begin
UpdatePropWin;
end;
-procedure TFormDesigner.InitTest;
-var
- l1: TfpgLabel;
- ed1: TfpgEdit;
-begin
-// Exit;
- writeln('InitTest');
- l1 := CreateLabel(FForm, 10, 10, 'Test Label');
- ed1 := CreateEdit(FForm, 10, 50, 150, 0);
-
- AddWidget(l1, nil);
- AddWidget(ed1, nil);
-end;
-
function TFormDesigner.AddWidget(wg: TfpgWidget; wgc: TVFDWidgetClass): TWidgetDesigner;
var
cd: TWidgetDesigner;
diff --git a/examples/apps/uidesigner/vfdformparser.pas b/examples/apps/uidesigner/vfdformparser.pas
index e3900f4b..3f2f1eb8 100644
--- a/examples/apps/uidesigner/vfdformparser.pas
+++ b/examples/apps/uidesigner/vfdformparser.pas
@@ -44,11 +44,11 @@ type
procedure nextline;
public
constructor Create(const FormName, FormHead, FormBody: string);
- destructor Destroy; override;
- function ParseForm: TFormDesigner;
- procedure ParseFormProperties;
- procedure ParseFormWidgets;
- function ReadWGProperty(propline: string; wg: TfpgWidget; wgc: TVFDWidgetClass): boolean;
+ destructor Destroy; override;
+ function ParseForm: TFormDesigner;
+ procedure ParseFormProperties;
+ procedure ParseFormWidgets;
+ function ReadWGProperty(propline: string; wg: TfpgWidget; wgc: TVFDWidgetClass): boolean;
end;
diff --git a/src/corelib/gfx_popupwindow.pas b/src/corelib/gfx_popupwindow.pas
index 0c1d981c..ca6c0a42 100644
--- a/src/corelib/gfx_popupwindow.pas
+++ b/src/corelib/gfx_popupwindow.pas
@@ -2,10 +2,6 @@ unit gfx_popupwindow;
{$mode objfpc}{$H+}
-{
- Still under construction!!!!!
-}
-
interface
uses
diff --git a/src/corelib/gfxbase.pas b/src/corelib/gfxbase.pas
index cfe60c45..7b7eec6d 100644
--- a/src/corelib/gfxbase.pas
+++ b/src/corelib/gfxbase.pas
@@ -337,6 +337,8 @@ type
procedure AllocateWindowHandle;
procedure ReleaseWindowHandle;
procedure SetWindowTitle(const ATitle: string); virtual;
+ procedure SetHeight(const AValue: TfpgCoord); virtual;
+ procedure SetWidth(const AValue: TfpgCoord); virtual;
public
// The standard constructor.
constructor Create(AOwner: TComponent); override;
@@ -357,8 +359,8 @@ type
property WindowAttributes: TWindowAttributes read FWindowAttributes write FWindowAttributes;
property Left: TfpgCoord read FLeft write FLeft;
property Top: TfpgCoord read FTop write FTop;
- property Width: TfpgCoord read FWidth write FWidth;
- property Height: TfpgCoord read FHeight write FHeight;
+ property Width: TfpgCoord read FWidth write SetWidth;
+ property Height: TfpgCoord read FHeight write SetHeight;
property MinWidth: TfpgCoord read FMinWidth write FMinWidth;
property MinHeight: TfpgCoord read FMinHeight write FMinHeight;
property Canvas: TfpgCanvasBase read GetCanvas;
@@ -733,6 +735,20 @@ begin
DoSetWindowTitle(ATitle);
end;
+procedure TfpgWindowBase.SetHeight(const AValue: TfpgCoord);
+begin
+ if FHeight = AValue then
+ Exit;
+ FHeight := AValue;
+end;
+
+procedure TfpgWindowBase.SetWidth(const AValue: TfpgCoord);
+begin
+ if FWidth = AValue then
+ Exit;
+ FWidth := AValue;
+end;
+
constructor TfpgWindowBase.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
diff --git a/src/gui/gui_combobox.pas b/src/gui/gui_combobox.pas
index 94ecf178..debec7db 100644
--- a/src/gui/gui_combobox.pas
+++ b/src/gui/gui_combobox.pas
@@ -25,8 +25,6 @@ uses
type
- { TfpgCustomComboBox }
-
TfpgCustomComboBox = class(TfpgWidget)
private
FDropDownCount: integer;
@@ -48,16 +46,17 @@ type
procedure SetFocusItem(const AValue: integer);
procedure SetFontDesc(const AValue: string);
procedure SetText(const AValue: string);
- procedure SetWidth(const AValue: TfpgCoord);
procedure CalculateInternalButtonRect;
protected
FMargin: integer;
- property DropDownCount: integer read FDropDownCount write SetDropDownCount default 8;
+ procedure SetHeight(const AValue: TfpgCoord); override;
+ procedure SetWidth(const AValue: TfpgCoord); override;
procedure HandleLMouseDown(x, y: integer; shiftstate: TShiftState); override;
procedure HandleLMouseUp(x, y: integer; shiftstate: TShiftState); override;
procedure HandleResize(awidth, aheight: TfpgCoord); override;
procedure HandlePaint; override;
procedure PaintInternalButton; virtual;
+ property DropDownCount: integer read FDropDownCount write SetDropDownCount default 8;
property Items: TStringList read FItems; {$Note Make this read/write }
property FocusItem: integer read FFocusItem write SetFocusItem;
property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor;
@@ -68,9 +67,7 @@ type
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Update;
- procedure AfterConstruction; override;
property Font: TfpgFont read FFont;
- property Width: TfpgCoord read FWidth write SetWidth;
end;
@@ -322,9 +319,8 @@ end;
procedure TfpgCustomComboBox.SetWidth(const AValue: TfpgCoord);
begin
- if FWidth = AValue then
- Exit; //==>
- FWidth := AValue;
+ inherited;
+ CalculateInternalButtonRect;
RePaint;
end;
@@ -333,6 +329,13 @@ begin
FInternalBtnRect.SetRect(Width - Min(Height, 20), 2, Min(Height, 20)-2, Height-4);
end;
+procedure TfpgCustomComboBox.SetHeight(const AValue: TfpgCoord);
+begin
+ inherited;
+ CalculateInternalButtonRect;
+ RePaint;
+end;
+
procedure TfpgCustomComboBox.HandleLMouseDown(x, y: integer; shiftstate: TShiftState);
begin
inherited HandleLMouseDown(x, y, shiftstate);
@@ -451,7 +454,8 @@ begin
FFont := fpgGetFont('#List');
FItems := TStringList.Create;
-
+ CalculateInternalButtonRect;
+
FOnChange := nil;
end;
@@ -467,11 +471,5 @@ begin
Repaint;
end;
-procedure TfpgCustomComboBox.AfterConstruction;
-begin
- inherited AfterConstruction;
- CalculateInternalButtonRect;
-end;
-
end.