I have been trying to write a component based on tCustomComboBox.
 
I wanted to add some additional properties however when I add the properties
under Published I get the error Undefined Property in the IDE and the
compiler complains that these new properties do not exist in the base class.
Two of the properties return or set record types which I have previously
defined but as the other returns a string and still  generates the same
error I assume it is not that.
 
I have included my header below:
****************************************************************************
****************************************
unit ComPortLanCtrl;
 
interface
 
uses
  SysUtils, Classes, Controls, StdCtrls, ScktComp, Sockets, ComPort,
StrUtils;
 
type
 
  TComBaseSettings = Record
    BaudRate: TBaudRate;
    DataBits: TDataBits;
    Parity:   TParity;
    StopBits: TStopBits;
  End;
 
  TComSettings = Record
    DisplayName: String;
    DeviceName: String;
  end;
 
  TLanSettings = Record
    DisplayName: String;
    HostName: String;
    PortNum:  String;
  end;
 
    TCtrlErrorEvent = procedure(Sender: TObject; ErrorCode: Integer;
ErrorDesc: String) of Object;
    TDataReceivedEvent = procedure(Sender: TObject; Count: Integer) of
Object;
    TStatusEvent = procedure(Sender:TObject; Status: Integer; StatusDesc:
String) of Object;
 
TComLanCombo = class(TCustomComboBox)
  private
    { Private declarations }
    fComPort : TComPort;
    fLanPort:  TtcpClient;
    fCOMConnections: Array of TComSettings;
    fLANConnections: Array of TLanSettings;
    fOnError:  TCtrlErrorEvent;
    fOnDataReceived: TDataReceivedEvent;
    fOnConnect :TNotifyEvent;
    fOnStatusChanged: TStatusEvent;
    fOnTXBuffEmpty: TNotifyEvent;
    procedure DoError(pErrorCode: Integer; pErrDesc: String);
    procedure DoDataReceived(pCount: Integer);
    procedure DoStatusChanged(pStatus: Integer);
    procedure UpdateDropDown;
    function  PrimeComConnections :Boolean;
  protected
    { Protected declarations }
    { Com Port }
    procedure SetComPortbaseSettings(pSettings: TComBaseSettings);
    function  GetComPortbaseSettings: TComBaseSettings;
    function  GetComPort: String;
    procedure ComPortError (fComPort: TCustomComPort; E: EComError;
              var Action: TComAction);
    { LAN Port }
    function  GetLanConnection(pIndex: Integer): TLanSettings;
    procedure  SetLanConnection(pIndex: Integer; pSetting: TLanSettings);
    function  GetLanPort: TLanSettings;
    procedure LanPortError (FLanPort: TtcpClient; ErrorEvent: TErrorEvent;
              Var ErrorCode: Integer);
    { DropDown Box }
    procedure Change; Override;
  public
    { Public declarations }
    Constructor Create(AOwner:TComponent); override;
    Destructor  Destroy; Override;
    procedure CreateWnd; Override;
  published
    { Published declarations }
    property Align;
    property Top;
    property Left;
    property Width;
    property Height;
    property Color;
    property Font;
    property ParentColor;
    property Parentfont;
    property ParentShowHint;
    property ShowHint;
    property Visible;
    property ItemIndex;
    property Items;
    { Sub Controls }
    property LANPortCtrl: TtcpClient Read FLanPort;
    property ComPortCtrl: TComPort   Read FComPort;
    { SetUp Functions }
    property ComSettings   Read  GetComPortBaseSettings
                           Write SetComPortbaseSettings;
    property ComConnection Read  GetComPort;
    property LanConnection Read  GetLanConnection
                           Write SetLanConnection;
 
    function AddLanConnection(pHost: TLanSettings; pUpdate: Boolean =
True):Boolean;
    procedure DeleteLanConnection(pIndex: Integer; pUpdate: Boolean = True);
    { Events }
    property OnError: TCtrlErrorEvent read FOnError;
    property OnDataReceived: TDataReceivedEvent read fOnDataReceived;
    property OnConnect: TNotifyEvent read fOnConnect;
    property OnStatusChanged: TStatusEvent read fOnStatusChanged;
    property OnTXBuffEmpty: TNotifyEvent read fOnTXBuffEmpty;
end;
 
Thanks
 
JohnB
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to