Autor Beitrag
stiftmaster
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 149



BeitragVerfasst: Di 22.02.05 10:00 
Guten Morgen,

ich bekomme bei einer Funktion einen String-Wert: stringAnchors := '[akLeft,akTop]';

Jetzt soll ich irgend wie gebacken kriegen, dass diese Werte einem Button zugewiesen werden - also die Anchors.

Ich kann zwar schreiben

Button.Anchors := [akLeft,akTop];

doch ich brauch ja rechts n' String... also so was:

Button.Anchors := stringAnchors;

Da kriege ich aber jedesmal n' Zugriffsverletzung - jemand n' Ahnung, wie ich das gebacken kriege?

Dankend

Stefan
iKilledKenny
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 394
Erhaltene Danke: 8

Win XP
D5 Prof, C# Express 2005
BeitragVerfasst: Di 22.02.05 10:46 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
Button.Anchors := [];
if Pos ('akLeft', stringAnchors) > 0 then
  Button.Anchors := Button.Anchors + akLeft;
if Pos ('akTop', stringAnchors) > 0 then
  Button.Anchors := Button.Anchors + akTop;
if Pos ('akRight', stringAnchors) > 0 then
  Button.Anchors := Button.Anchors + akRight;
if Pos ('akBottom', stringAnchors) > 0 then
  Button.Anchors := Button.Anchors + akBottom;


grüße
alex
stiftmaster Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 149



BeitragVerfasst: Di 22.02.05 13:29 
super Idee, da hätte ich eigentlich auch selber drauf können *Ärger mich*

DANKE

Stefan