summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-10-11 10:25:31 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-10-11 10:25:31 +0000
commitbfb114a2eb1bb613fe126b43cfba733408358ca7 (patch)
treefc5c3df35f79a45efa501ba68f9db829fc3f275f
parentf2c54cab546bb1cc403fc23b04f49f6b0b8b14dc (diff)
downloadfpGUI-bfb114a2eb1bb613fe126b43cfba733408358ca7.tar.xz
* Reworked the GetEnumPropValueList() procedure used in the UI Designer. No more pointer arithmatic and no more compiler hints or warnings.
-rw-r--r--examples/apps/uidesigner/vfdprops.pas33
1 files changed, 17 insertions, 16 deletions
diff --git a/examples/apps/uidesigner/vfdprops.pas b/examples/apps/uidesigner/vfdprops.pas
index bc14e890..37daf557 100644
--- a/examples/apps/uidesigner/vfdprops.pas
+++ b/examples/apps/uidesigner/vfdprops.pas
@@ -126,7 +126,7 @@ type
procedure EditStringList(sl: TStringList);
-procedure GetEnumPropValueList(wg: TObject; const propname: string; sl: TStringList);
+procedure GetEnumPropValueList(wg: TObject; const APropName: string; sl: TStringList);
implementation
@@ -152,25 +152,26 @@ begin
frmie.Free;
end;
-procedure GetEnumPropValueList(wg: TObject; const propname: string; sl: TStringList);
+procedure GetEnumPropValueList(wg: TObject; const APropName: string; sl: TStringList);
var
- pi: PPropInfo;
- P: ^ShortString;
- T: PTypeData;
+ lPropInfo: PPropInfo;
+ s: string;
+ lTypeData: PTypeData;
n: integer;
begin
- pi := GetPropInfo(wg, propname);
-{$ifdef FPC}
- T := GetTypeData(pi^.PropType);
-{$else}
- T := GetTypeData(pi^.PropType^);
-{$endif}
- P := @T^.NameList;
+ lPropInfo := GetPropInfo(wg, APropName);
+ lTypeData := GetTypeData(lPropInfo^.PropType);
- for n := 0 to T^.MaxValue do
- begin
- sl.Add(P^);
- Inc(PtrInt(P), Length(P^) + 1);
+ sl.BeginUpdate;
+ try
+ sl.Clear;
+ for n := lTypeData^.MinValue to lTypeData^.MaxValue do
+ begin
+ s := GetEnumName(lPropInfo^.PropType, n);
+ sl.Add(s);
+ end;
+ finally
+ sl.EndUpdate;
end;
end;