BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Updating Object Inspector Properties

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OpenToolsAPI
View previous topic :: View next topic  
Author Message
Jan Lund
Guest





PostPosted: Wed Feb 28, 2007 5:54 pm    Post subject: Updating Object Inspector Properties Reply with quote



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;
Back to top
Jan Lund
Guest





PostPosted: Thu Mar 01, 2007 9:14 am    Post subject: Re: Updating Object Inspector Properties Reply with quote



I forgot to say that i am using BDS2006.


"Jan Lund" <no (AT) spam (DOT) plz> wrote in message
news:45e56d84$1 (AT) newsgroups (DOT) borland.com...
Quote:
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;


Back to top
Erik Berry
Guest





PostPosted: Tue Mar 13, 2007 6:19 am    Post subject: Re: Updating Object Inspector Properties Reply with quote



Jan Lund wrote:
Quote:
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.

I would try calling IOTAComponent.Select on your component and see if
that forces a refresh.

Erik
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OpenToolsAPI All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.