summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-03-18 19:59:01 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-03-18 19:59:01 +0000
commit790b38ec8407f47b24962d8ebb72fde9f0b28a39 (patch)
tree09ef5f0e9803b4332e3f4a4c56c66e99083148c6 /examples
parent9bce6c3487c70f7e735a561f9cda4729a070b90d (diff)
downloadfpGUI-790b38ec8407f47b24962d8ebb72fde9f0b28a39.tar.xz
* UI Designer: Implemented a new property editor for the FontDesc property. It now calls the Font Select dialog.
Diffstat (limited to 'examples')
-rw-r--r--examples/apps/uidesigner/vfdprops.pas30
-rw-r--r--examples/apps/uidesigner/vfdwidgets.pas24
2 files changed, 40 insertions, 14 deletions
diff --git a/examples/apps/uidesigner/vfdprops.pas b/examples/apps/uidesigner/vfdprops.pas
index fd6c37dc..32166060 100644
--- a/examples/apps/uidesigner/vfdprops.pas
+++ b/examples/apps/uidesigner/vfdprops.pas
@@ -77,6 +77,14 @@ type
function GetValueText(wg: TfpgWidget): string; override;
function CreateEditor(AOwner: TComponent): TVFDPropertyEditor; override;
end;
+
+
+ { TPropertyFontDesc }
+
+ TPropertyFontDesc = class(TPropertyString)
+ function CreateEditor(AOwner: TComponent): TVFDPropertyEditor; override;
+ procedure OnExternalEdit(wg: TfpgWidget); override;
+ end;
TGPEType = (gptInteger, gptString);
@@ -135,7 +143,8 @@ uses
TypInfo,
vfdformparser,
vfdeditors,
- fpgfx;
+ fpgfx,
+ gui_dialogs;
procedure EditStringList(sl: TStringList);
var
@@ -482,7 +491,7 @@ begin
Height := self.Height;
Width := 24;
Top := 0;
- Left := self.Width - Width;
+ Left := self.Width - btnEdit.Width;
Text := '...';
UpdateWindowPosition;
Anchors := [anTop, anRight];
@@ -503,6 +512,7 @@ begin
Exit;
prop.OnExternalEdit(widget);
widget.Invalidate;
+ RePaint;
end;
procedure TExternalPropertyEditor.StoreValue(wg: TfpgWidget);
@@ -615,5 +625,21 @@ begin
SetOrdProp(wg, prop.Name, Ord(StrToBool(chl.Text)));
end;
+{ TPropertyFontDesc }
+
+function TPropertyFontDesc.CreateEditor(AOwner: TComponent): TVFDPropertyEditor;
+begin
+ Result := TExternalPropertyEditor.Create(AOwner, self);
+end;
+
+procedure TPropertyFontDesc.OnExternalEdit(wg: TfpgWidget);
+var
+ s: string;
+begin
+ s := GetStrProp(wg, Name);
+ if SelectFontDialog(s) then
+ SetStrProp(wg, Name, s);
+end;
+
end.
diff --git a/examples/apps/uidesigner/vfdwidgets.pas b/examples/apps/uidesigner/vfdwidgets.pas
index 86519d8f..3dbdfd74 100644
--- a/examples/apps/uidesigner/vfdwidgets.pas
+++ b/examples/apps/uidesigner/vfdwidgets.pas
@@ -226,7 +226,7 @@ begin
wc := TVFDWidgetClass.Create(TfpgLabel);
wc.NameBase := 'lblName';
wc.AddProperty('Alignment', TPropertyEnum, 'Horizontal text alignment');
- wc.AddProperty('FontDesc', TPropertyString, 'The font used for displaying the label text');
+ wc.AddProperty('FontDesc', TPropertyFontDesc, 'The font used for displaying the label text');
wc.AddProperty('Layout', TPropertyEnum, 'Vertical text layout');
wc.AddProperty('Text', TPropertyString, 'Label text');
wc.AddProperty('WrapText', TPropertyBoolean, 'If True text will wrap when it doesn''t fit the width');
@@ -239,7 +239,7 @@ begin
// wc.AddProperty('Color', TPropertyColor, 'Text color');
wc.AddProperty('TabOrder', TPropertyInteger, 'The tab order');
wc.AddProperty('Text', TPropertyString, 'Initial text');
- wc.AddProperty('FontDesc', TPropertyString, 'The font used for displaying the text');
+ wc.AddProperty('FontDesc', TPropertyFontDesc, 'The font used for displaying the text');
wc.WidgetIconName := 'vfd.edit';
RegisterVFDWidget(wc);
@@ -247,7 +247,7 @@ begin
wc := TVFDWidgetClass.Create(TfpgMemo);
wc.NameBase := 'memName';
wc.AddProperty('Lines', TPropertyStringList, '');
- wc.AddProperty('FontDesc', TPropertyString, 'The font used for displaying the text');
+ wc.AddProperty('FontDesc', TPropertyFontDesc, 'The font used for displaying the text');
wc.AddProperty('TabOrder', TPropertyInteger, 'The tab order');
wc.WidgetIconName := 'vfd.memo';
RegisterVFDWidget(wc);
@@ -258,7 +258,7 @@ begin
wc.AddProperty('Text', TPropertyString, 'Initial text');
wc.AddProperty('AllowAllUp', TPropertyBoolean, '');
wc.AddProperty('Embedded', TPropertyBoolean, 'No focus rectangle will be drawn. eg: Toolbar buttons');
- wc.AddProperty('FontDesc', TPropertyString, 'The font used for displaying the text');
+ wc.AddProperty('FontDesc', TPropertyFontDesc, 'The font used for displaying the text');
wc.AddProperty('GroupIndex', TPropertyInteger, '');
wc.AddProperty('ImageMargin', TPropertyInteger, '');
wc.AddProperty('ImageName', TPropertyString, '');
@@ -273,7 +273,7 @@ begin
wc := TVFDWidgetClass.Create(TfpgCheckBox);
wc.NameBase := 'cbName';
wc.AddProperty('Checked', TPropertyBoolean, 'Boolean value');
- wc.AddProperty('FontDesc', TPropertyString, 'The font used for displaying the text');
+ wc.AddProperty('FontDesc', TPropertyFontDesc, 'The font used for displaying the text');
wc.AddProperty('TabOrder', TPropertyInteger, 'The tab order');
wc.AddProperty('Text', TPropertyString, 'Initial text');
wc.WidgetIconName := 'vfd.checkbox';
@@ -283,7 +283,7 @@ begin
wc := TVFDWidgetClass.Create(TfpgRadioButton);
wc.NameBase := 'rbName';
wc.AddProperty('Checked', TPropertyBoolean, 'Boolean value');
- wc.AddProperty('FontDesc', TPropertyString, 'The font used for displaying the text');
+ wc.AddProperty('FontDesc', TPropertyFontDesc, 'The font used for displaying the text');
wc.AddProperty('GroupIndex', TPropertyInteger, '');
wc.AddProperty('TabOrder', TPropertyInteger, 'The tab order');
wc.AddProperty('Text', TPropertyString, 'Initial text');
@@ -293,7 +293,7 @@ begin
// ComboBox
wc := TVFDWidgetClass.Create(TfpgComboBox);
wc.NameBase := 'cbName';
- wc.AddProperty('FontDesc', TPropertyString, 'The font used for displaying the text');
+ wc.AddProperty('FontDesc', TPropertyFontDesc, 'The font used for displaying the text');
wc.AddProperty('Items', TPropertyStringList, '');
wc.AddProperty('TabOrder', TPropertyInteger, 'The tab order');
wc.WidgetIconName := 'vfd.combobox';
@@ -302,7 +302,7 @@ begin
// Calendar ComboBox
wc := TVFDWidgetClass.Create(TfpgCalendarCombo);
wc.NameBase := 'calName';
- wc.AddProperty('FontDesc', TPropertyString, 'The font used for displaying the text');
+ wc.AddProperty('FontDesc', TPropertyFontDesc, 'The font used for displaying the text');
wc.AddProperty('TabOrder', TPropertyInteger, 'The tab order');
wc.WidgetIconName := 'vfd.combodateedit';
RegisterVFDWidget(wc);
@@ -310,7 +310,7 @@ begin
// ListBox
wc := TVFDWidgetClass.Create(TfpgListBox);
wc.NameBase := 'lstName';
- wc.AddProperty('FontDesc', TPropertyString, 'The font used for displaying the text');
+ wc.AddProperty('FontDesc', TPropertyFontDesc, 'The font used for displaying the text');
wc.AddProperty('HotTrack', TPropertyBoolean, '');
wc.AddProperty('Items', TPropertyStringList, '');
wc.AddProperty('PopupFrame', TPropertyBoolean, '');
@@ -322,8 +322,8 @@ begin
wc := TVFDWidgetClass.Create(TfpgStringGrid);
wc.NameBase := 'grdName';
wc.AddProperty('Columns', TPropertyDBColumns, '');
- wc.AddProperty('FontDesc', TPropertyString, '');
- wc.AddProperty('HeaderFontDesc', TPropertyString, '');
+ wc.AddProperty('FontDesc', TPropertyFontDesc, '');
+ wc.AddProperty('HeaderFontDesc', TPropertyFontDesc, '');
wc.AddProperty('RowCount', TPropertyInteger, '');
wc.AddProperty('RowSelect', TPropertyBoolean, '');
wc.AddProperty('ShowHeader', TPropertyBoolean, '');
@@ -374,7 +374,7 @@ begin
wc := TVFDWidgetClass.Create(TfpgTreeView);
wc.NameBase := 'tvName';
wc.AddProperty('DefaultColumnWidth',TPropertyInteger, '');
- wc.AddProperty('FontDesc',TPropertyString, '');
+ wc.AddProperty('FontDesc',TPropertyFontDesc, '');
wc.AddProperty('ScrollWheelDelta', TPropertyInteger, 'Scroll amount with mouse wheel');
wc.AddProperty('ShowColumns',TPropertyBoolean, 'Boolean value');
wc.AddProperty('ShowImages',TPropertyBoolean, 'Boolean value');