wenn ich gerade einen String als default in einem Property setzten will erhalte ich folgende Meldung.
Code: Alles auswählen
Error: Property can't have a default valuedie Zeile schaut dafür so aus:
Code: Alles auswählen
property DeviceName: String read GetDeviceName write SetDeviceName default '/dev/ttyUSB0';Code: Alles auswählen
type
TSTOP = (SB1, SB1andHalf, SB2);
TSTAT = (Run, Wait, Free, Error);
TSer = class(TWinControl)
private
fLeft,
fTop,
fWidth,
fHeigth : Word;
fDefault : Boolean;
procedure SetDefault(Value: Boolean);
public
constructor Create(TheOwner: TComponent); override;
published
property Default : Boolean read fDefault write SetDefault default false;
end;
TUSBSer = class(TSer)
private
{ Private declarations }
fDevice : String;
fBaud : Int64;
fBit : byte;
fParity : char;
fStop : TSTOP;
fStat : TSTAT;
fSoft,
fHand,
fConnect : Boolean;
fOnConnect,
FOnClick : TNotifyEvent;
protected
{ Protected declarations }
public
{ Public declarations }
function GetDeviceName: String;
function GetBaud : Int64;
function GetBit : byte;
function GetParity : char;
function GetStop : TSTOP;
function GetStat : TSTAT;
function GetSoft : Boolean;
function GetHand : Boolean;
function GetConnect : Boolean;
procedure SetDeviceName(Value: String);
procedure SetBaud(Value: Int64);
procedure SetBit(Value: byte);
procedure SetParity(Value: char);
procedure SetStop(Value: TSTOP);
procedure SetSoft(Value: Boolean);
procedure SetHand(Value: Boolean);
procedure SetConnect(Value: Boolean);
Constructor Create;
published
{ Published declarations }
procedure Paint;
property default;
property DeviceName: String read GetDeviceName write SetDeviceName default '/dev/ttyUSB0'; // <--- Fehlermeldung!
property BaudRate: Int64 read GetBaud write SetBaud default 9600; // <--- Wird sauber genommen!
property Bit: byte read GetBit write SetBit;
property Parity: char read GetParity write SetParity;
property StopBit: TSTOP read GetStop write SetStop;
property Status: TSTAT read GetStat;
property Softshack: Boolean read GetSoft write SetSoft;
property Hardwarefluss: Boolean read GetHand write Sethand;
property AutoConnect : Boolean read GetConnect write SetConnect;
property OnConnect: TNotifyEvent read fOnConnect write fOnConnect;
property OnClick: TNotifyEvent read FOnClick write FOnClick;
end;Danke im Vorraus und Schönes Bergfest euch allen