I have a component that has the function of connecting to a specific hardware. It connects through the network or serial port. Something like the code below:
TConexao = (conRede, conSerial);
THardware = class(TComponent)
private
FAtivo: Boolean;
FPortaSerial: string;
FTipoConexao: TConexao;
FPorta: Integer;
FIP: string;
procedure SetAtivo(const Value: Boolean);
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Ativar;
procedure Desativar;
published
property Ativo: Boolean read FAtivo write SetAtivo;
property TipoConexao: TConexao read FTipoConexao write FTipoConexao;
property IP: string read FIP write FIP;
property Porta: Integer read FPorta write FPorta;
property PortaSerial: string read FPortaSerial write FPortaSerial;
end;
To connect through the network I use the IP and Port properties and to connect through the serial I use only the serial port. In the Object Inspector when setting ConnectionType to Network you would like to display only the IP and Port properties, if it were changed to Serial only show the PortaSerial property. It's possible?