![]() |
Type in INI sichern?
Moin !
Ich habe da diesen Typen:
Delphi-Quellcode:
Diesen würde ich gerne in einer INI Datei sichern und auch wieder laden.
type TLVDeviceID = ( ID_Test1, ID_Test2, ID_Test3 );
Geht das? Und wenn ja wie? |
Re: Type in INI sichern?
Hi,
ich würde das so machen:
Delphi-Quellcode:
var x: integer;
LVDeviceID: TLVDeviceID; //schreiben x := ord (LVDeviceID); ini.WriteInteger ('foo', 'LVDeviceID', x); //lesen x := ini.ReadInteger ('foo', 'LVDeviceID', 1); LVDeviceID := TLVDeviceID(x); |
Re: Type in INI sichern?
Hallo,
noch eine Alternative:
Delphi-Quellcode:
Grüße vom marabu
type
TLVDeviceID = ( ID_Test1, ID_Test2, ID_Test3 ); var devId: TLVDeviceID; begin devID := ID_Test2; ini.WriteString( 'settings', 'LVDeviceID', {TypInfo.}GetEnumName(TypeInfo(TLVDeviceID), Ord(devId)) ); end; |
Re: Type in INI sichern?
Moin !
Ok, das wegschreiben geht super, aber wie kriege ich es retour?
Delphi-Quellcode:
So gehts nicht. Dann sagt er Integer und TLVDeviceID sind Inkompatibele Typen. (Hat er sogar recht :D )
Temp := DeviceINI.ReadString( 'settings', 'LVDeviceID', '');
devID := GetEnumValue(TypeInfo(TLVDeviceID), Temp); |
Re: Type in INI sichern?
Ok ich habs schon ...
Temp ist Integer ...
Delphi-Quellcode:
Danke trotzdem für die Infos !
Temp := GetEnumValue(TypeInfo(TLVDeviceID), DeviceINI.ReadString( 'settings', 'LVDeviceID', ''));
devID := TLVDeviceID(Temp); |
Alle Zeitangaben in WEZ +1. Es ist jetzt 01:25 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz