Tips&Tricks | I trucchi del mestiere |
![]() |
Creazione di componenti a run-time |
Selected:=TToolButton(Sender).Tag; |
case Selected of 2: ControlRef:=TButton; 3: ControlRef:=TEdit; end; |
if Selected > 1 then with ControlRef.Create(Self) do begin Inc(Counter); Visible:=false; Parent:=Self; ControlName:=ControlRef.ClassName; Delete(ControlName,1,1); Name:=ControlName + IntToStr(Counter); Left:=X; Top:=Y; Visible:=true; tbNone.Down:=true; //tbNone = name del primo toolbutton tbNoneClick(tbNone); end; |