Forum: GUI-Design mit VCL / FireMonkey / Common Controls
Delphi
by mirage228,
26. Okt 2004
Jupp,
aber der AS-Operator führt intern bereits ein IS aus (und löst ggf. ein EInvalidCast aus), soweit ich weiss.
Daher sollte man. wenn man schon mit IS prüft, dann auch direkt type-casten, also so (ich würde mir dann das doppelte findcomponent sparen):
var
Comp: TComponent;
begin
Comp := Feldnamenzuordnen1.FindComponent('Adress_' + IntToStr(i));
if (Comp is TMenuItem) then
...
Forum: GUI-Design mit VCL / FireMonkey / Common Controls
Delphi
by mirage228,
26. Okt 2004
Hi,
FindComponent liefert dir lediglich eine "TComponent" zurück. Für Deine Checked Eigenschaft brauchst Du also ein TMenuItem:
(Feldnamenzuordnen1.FindComponent('Adress_' + IntToStr(i)) as TMenuItem).checked := true
mfG
mirage228