Board index » delphi » Updating Object Inspector Properties
Jan Lund
![]() Delphi Developer |
Updating Object Inspector Properties2007-02-28 07:54:52 PM delphi262 Hello. I am in the progress of making a component that has a property (Response) that changes its class when another property (ResponseType) changes. This works fine, however my problem is that when i change the ResponseType, the Object Inspector is not aware of this, unless i select another component on the form and then reselect my component. How do i force the inspector to update its Component properties ? Thanks Jan TJLTCPMessageSender = class(TComponent) published // a lot of stuff removed.... Property ResponseType : TJLTCPResponsetypes read FResponseType write SetResponseType; Property Response : TJLBaseTCPMessageResponse read FResponse write SetResponse; end; // Here we create the response class we want..... procedure TJLTCPMessageSender.SetResponseType(const Value: TJLTCPResponsetypes); begin FResponseType := Value; If Response<>Nil Then Response.Free; case FResponseType of trtNotDefined: ; trtInteger: Response:=TJLTCPMessageIntegerResponse.Create(Self); trtString: Response:=TJLTCPMessageStringResponse.Create(Self); end; If csDesigning in ComponentState Then *** Maybe we want some "Force Object Inspector Update code here *** end; TJLBaseTCPMessageResponse = class(Tpersistent) private FOwner : TJLTCPMessageSender; public constructor Create(AOwner : TJLTCPMessageSender); Overload;Virtual; end; TJLTCPMessageIntegerResponse = class(TJLBaseTCPMessageResponse) private FIntResponse: Integer; procedure SetIntResponse(const Value: Integer); published Property IntResponse : Integer read FIntResponse write SetIntResponse; end; TJLTCPMessageStringResponse = class(TJLBaseTCPMessageResponse) private FStrResponse: String; procedure SetStrResponse(const Value: String); published Property StrResponse : String read FStrResponse write SetStrResponse; end; |