AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren

String als default bei propertys ???

Ein Thema von EDatabaseError · begonnen am 3. Aug 2006 · letzter Beitrag vom 4. Aug 2006
 
EDatabaseError

Registriert seit: 11. Mai 2005
Ort: Göppingen
1.238 Beiträge
 
Delphi 2007 Professional
 
#15

Re: String als default bei propertys ???

  Alt 3. Aug 2006, 21:10
Delphi-Quellcode:
unit EDEComPort;

interface

uses
  Windows, Messages, SysUtils, Classes, Controls, Dialogs;

const
  DefaultComPort = 'Com1';
  DefaultDataBits = 8;
  DefaultStopBits = 1;
  DefaultParity = 'none';

type
  TEDEComPort = class(TComponent)
  private
    { Private-Deklarationen }
    VComPort: String;
    VParity: String;
    VDataBits: Integer;
    VStopBits: Integer;

    procedure SetComPort(Value: String);
    procedure SetParity(Value: String);
    procedure SetDatabits(Value: Integer);
    procedure SetStopbits(Value: Integer);
  protected
    { Protected-Deklarationen }
  public
    { Public-Deklarationen }
    constructor Create; override; //<- Dekleration "Create" unterscheidet sich von vorheriger Dekleration

    function Open : Boolean;
    function Close : Boolean;
    procedure TX(Data: String);
    function RX : String;

    property ComPort: String read VComPort write SetComPort;
    property Parity: String read VParity write SetParity;
    property Databits: Integer read VDatabits write SetDatabits default DefaultDatabits;
    property Stopbits: Integer read VStopbits write SetStopbits default DefaultStopbits;
  published
    { Published-Deklarationen }
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Tobias Hocke Software', [TEDEComPort]);
end;

constructor TEDEComPort.Create;
begin
  inherited Create; //<- Nicht genügend wirkliche Parameter
  ComPort := DefaultComPort;
end;
Schaut euch mal den Code an
Tobias
It's not a bug, it's a feature.
  Mit Zitat antworten Zitat
 

Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 23:59 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-2025 by Thomas Breitkreuz