Delphi-Version: 7
Verständnis-Frage TButtonControl
Mahlzeit!
Wieso meckert mein Compiler "Undefinierter Bezeichner: 'Checked'" bei der folgender Funktion... TButtonControl hat doch die Eigenschaft "Checked" Wo mache ich da den Denkfehler?? bei "(TheComp as TCustomEdit).Text " funktionierts ja auch...
Delphi-Quellcode:
bin für alle Denk-Anstösse dankbar!
function WriteIni(IniFile:String;Section:String;Key:String;TheComp:TComponent):Boolean;
Var FIni:TInifile; begin result:=false; Try FIni := TIniFile.Create(IniFile+'.Ini'); If TheComp is TCustomEdit then begin FIni.WriteString(Section,Key,(TheComp as TCustomEdit).Text); result:=True; end; If TheComp is TButtonControl then begin FIni.WriteBool(Section,Key,(TheComp as TButtonControl).Checked); <--- Hier !!! result:=True; end; FIni.Free; except result:=false; end; end; Stefan |
AW: Verständnis-Frage TButtonControl
TButtonControl.Checked ist protected.
|
AW: Verständnis-Frage TButtonControl
Hallo Thom!
Aha.. :shock: Woher weist du das??? Etwa weils in der OH nen gelbes kleines Viereck hat?? Mir waren diese Symbole schon immer etwas suspekt.. Kennst du ne möglichkeit das trotzdem abzufragen?? |
AW: Verständnis-Frage TButtonControl
hat sich erledigt.. Danke trotzdem!!
habs so gelöst, dass ich nen neuen Typ deklariert habe:
Delphi-Quellcode:
nu funktionierts...
....
type TMyButtonControl = class(TButtonControl); ... ... ... function WriteIni(IniFile:String;Section:String;Key:String;TheComp:TComponent):Boolean; Var FIni:TInifile; begin result:=false; Try FIni := TIniFile.Create(IniFile+'.Ini'); If TheComp is TCustomEdit then begin FIni.WriteString(Section,Key,(TheComp as TCustomEdit).Text); result:=True; end; If TheComp is TMyButtonControl then begin FIni.WriteBool(Section,Key,(TheComp as TMyButtonControl).Checked); result:=True; end; FIni.Free; except result:=false; end; end; |
AW: Verständnis-Frage TButtonControl
Ja, genau deshalb! :thumb:
Ok, Beispiel hat sich erledigt. Genau so geht's! :-D |
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:14 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz