1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
{
fpGUI - Free Pascal GUI Toolkit
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,
for details about redistributing fpGUI.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Description:
Some utility functions.
}
unit vfdutils;
{$mode objfpc}{$H+}
interface
uses
Classes,
SysUtils,
fpg_widget,
gui_form,
gui_label,
gui_edit,
gui_button,
gui_memo,
gui_checkbox;
procedure SetWidgetText(wg: TfpgWidget; txt: string);
function GetWidgetText(wg: TfpgWidget; out txt: string): boolean;
implementation
procedure SetWidgetText(wg: TfpgWidget; txt: string);
begin
if wg is TfpgForm then
TfpgForm(wg).WindowTitle := txt
else if wg is TfpgLabel then
TfpgLabel(wg).Text := txt
else if wg is TfpgEdit then
TfpgEdit(wg).Text := txt
else if wg is TfpgMemo then
TfpgMemo(wg).Text := txt
else if wg is TfpgButton then
TfpgButton(wg).Text := txt
else if wg is TfpgCheckBox then
TfpgCheckBox(wg).Text := txt;
end;
function GetWidgetText(wg: TfpgWidget; out txt: string): boolean;
begin
Result := True;
if wg is TfpgForm then
txt := TfpgForm(wg).WindowTitle
else if wg is TfpgLabel then
txt := TfpgLabel(wg).Text
else if wg is TfpgEdit then
txt := TfpgEdit(wg).Text
else if wg is TfpgMemo then
txt := TfpgMemo(wg).Text
else if wg is TfpgButton then
txt := TfpgButton(wg).Text
else if wg is TfpgCheckBox then
txt := TfpgCheckBox(wg).Text
else
begin
Result := False;
txt := '';
end;
end;
end.
|