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 

How to invoke a TCollection Item Property Editor From a Spee

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Writing
View previous topic :: View next topic  
Author Message
Andrew Denton
Guest





PostPosted: Tue Nov 25, 2003 3:04 pm    Post subject: How to invoke a TCollection Item Property Editor From a Spee Reply with quote



Hi All,

I've been developing and object-aware listview for a while now and it's
just about finished. What I wanted to do was add a Columns Editor to
the component's speed menu a la TDBGrid. I've created a
TComponentEditor descendant and implemented GetVerbCount etc. so that
when I right-click my component I get the extra Columns Editor menu
item. Question is what do I put in ExecuteVerb?? My Columns are derived
from TCollection and use that editor (they are actually a sub-property
of Header, so I need to simulate expanding the Header property and
clicking the ellipses for the columns property).

Any ideas anyone?

--
Cheers,

Andy
"I want to move to Theory....Everything works in Theory"
Back to top
Andrew Denton
Guest





PostPosted: Tue Nov 25, 2003 3:47 pm    Post subject: Re: How to invoke a TCollection Item Property Editor From a Reply with quote



Hi Alain,

Many thanks for the quick response. Unfortunately, ShowCollectionEditor
doesn't seem to compile. Does this method only apply to 6 or 7? I'm
using Delphi 5 (users of my component will be running anything from D5
through to 7.

Once again, thanks for the quick reply.

Best Regards,

Andy
"I want to move to Theory....Everything works in Theory"


Alain Quesnel wrote:

Quote:
Call ShowCollectionEditor. Here's an example (untested):

uses Classes, DesignEditors, DesignIntf, ColnEdit, MyComponent;

type
TMyComponentCompEditor= class(TComponentEditor)
private
public
procedure ExecuteVerb(Index: Integer); override;
function GetVerb(Index: Integer): string; override;
function GetVerbCount: Integer; override;
end;

implementation

procedure TMyComponentCompEditor.ExecuteVerb(Index: Integer);
begin
inherited;
case Index of
0: ShowCollectionEditor(Designer, Component,
TMyComponent(Component).MyItems, 'MyItems');
1: ShellExecute(0, nil, PChar('http://www.MyWebSite.com'), nil,
nil, SW_SHOWDEFAULT);
end;
end;

function TMyComponentCompEditor.GetVerb(Index: Integer): string;
begin
case Index of
0: Result := 'Add Item';
1: Result := ') 2003 My Company inc.';
end;
end;

function TMyComponentCompEditor.GetVerbCount: Integer;
begin
Result := 2;
end;




Back to top
Alain Quesnel
Guest





PostPosted: Tue Nov 25, 2003 4:32 pm    Post subject: Re: How to invoke a TCollection Item Property Editor From a Reply with quote



Call ShowCollectionEditor. Here's an example (untested):

uses Classes, DesignEditors, DesignIntf, ColnEdit, MyComponent;

type
TMyComponentCompEditor= class(TComponentEditor)
private
public
procedure ExecuteVerb(Index: Integer); override;
function GetVerb(Index: Integer): string; override;
function GetVerbCount: Integer; override;
end;

implementation

procedure TMyComponentCompEditor.ExecuteVerb(Index: Integer);
begin
inherited;
case Index of
0: ShowCollectionEditor(Designer, Component,
TMyComponent(Component).MyItems, 'MyItems');
1: ShellExecute(0, nil, PChar('http://www.MyWebSite.com'), nil, nil,
SW_SHOWDEFAULT);
end;
end;

function TMyComponentCompEditor.GetVerb(Index: Integer): string;
begin
case Index of
0: Result := 'Add Item';
1: Result := '© 2003 My Company inc.';
end;
end;

function TMyComponentCompEditor.GetVerbCount: Integer;
begin
Result := 2;
end;
--


Alain Quesnel
[email]alainsansspam (AT) logiquel (DOT) com[/email]

http://www.logiquel.com


"Andrew Denton" <adenton.diespamdie (AT) q-range (DOT) com> wrote

Quote:
Hi All,

I've been developing and object-aware listview for a while now and it's
just about finished. What I wanted to do was add a Columns Editor to
the component's speed menu a la TDBGrid. I've created a
TComponentEditor descendant and implemented GetVerbCount etc. so that
when I right-click my component I get the extra Columns Editor menu
item. Question is what do I put in ExecuteVerb?? My Columns are derived
from TCollection and use that editor (they are actually a sub-property
of Header, so I need to simulate expanding the Header property and
clicking the ellipses for the columns property).

Any ideas anyone?

--
Cheers,

Andy
"I want to move to Theory....Everything works in Theory"



Back to top
Alain Quesnel
Guest





PostPosted: Tue Nov 25, 2003 5:20 pm    Post subject: Re: How to invoke a TCollection Item Property Editor From a Reply with quote

I don't have D5 installed right now. Look for ShowCollectionEditor in the
C:Program FilesBorlandDelphi5Source directory. It might have been moved
since D5. Also, the unit DesignIntf which exists in D6 and D7 used to be
called DsgnIntf in D5. You need to put an IFDEF in your uses clause like so:

uses
Classes {$IFDEF VER130} , DsgnIntf {$ELSE} , DesignIntf, DesignEditors
{$ENDIF VER130}, MyComponent;

I'm not sure if the ColnEdit unit existed in D5. You might need to put it
inside or outide of the IFDEF.


What error message do you get when you compile?

--


Alain Quesnel
[email]alainsansspam (AT) logiquel (DOT) com[/email]

http://www.logiquel.com


"Andrew Denton" <adenton.diespamdie (AT) q-range (DOT) com> wrote

Quote:
Hi Alain,

Many thanks for the quick response. Unfortunately, ShowCollectionEditor
doesn't seem to compile. Does this method only apply to 6 or 7? I'm
using Delphi 5 (users of my component will be running anything from D5
through to 7.

Once again, thanks for the quick reply.

Best Regards,

Andy
"I want to move to Theory....Everything works in Theory"


Alain Quesnel wrote:

Call ShowCollectionEditor. Here's an example (untested):

uses Classes, DesignEditors, DesignIntf, ColnEdit, MyComponent;

type
TMyComponentCompEditor= class(TComponentEditor)
private
public
procedure ExecuteVerb(Index: Integer); override;
function GetVerb(Index: Integer): string; override;
function GetVerbCount: Integer; override;
end;

implementation

procedure TMyComponentCompEditor.ExecuteVerb(Index: Integer);
begin
inherited;
case Index of
0: ShowCollectionEditor(Designer, Component,
TMyComponent(Component).MyItems, 'MyItems');
1: ShellExecute(0, nil, PChar('http://www.MyWebSite.com'), nil,
nil, SW_SHOWDEFAULT);
end;
end;

function TMyComponentCompEditor.GetVerb(Index: Integer): string;
begin
case Index of
0: Result := 'Add Item';
1: Result := ') 2003 My Company inc.';
end;
end;

function TMyComponentCompEditor.GetVerbCount: Integer;
begin
Result := 2;
end;






Back to top
Andrew Denton
Guest





PostPosted: Wed Nov 26, 2003 8:31 am    Post subject: Re: How to invoke a TCollection Item Property Editor From a Reply with quote

Alain Quesnel wrote:

Quote:
{$IFDEF VER130} , DsgnIntf {$ELSE} , DesignIntf, DesignEditors
{$ENDIF VER130}

Alain,

I hadn't included ColnEdit in my uses clause. It works a treat now.
Thank you very much - I owe you a beer (or whatever it is you like to
drink)!.



--
Cheers,

Andy
"I want to move to Theory....Everything works in Theory"

Back to top
Alain Quesnel
Guest





PostPosted: Wed Nov 26, 2003 12:26 pm    Post subject: Re: How to invoke a TCollection Item Property Editor From a Reply with quote

Well, I'm in Montreal. What part of the world are you from?

--


Alain Quesnel
[email]alainsansspam (AT) logiquel (DOT) com[/email]

http://www.logiquel.com


"Andrew Denton" <adenton.diespamdie (AT) q-range (DOT) com> wrote

Quote:
Alain Quesnel wrote:

{$IFDEF VER130} , DsgnIntf {$ELSE} , DesignIntf, DesignEditors
{$ENDIF VER130}

Alain,

I hadn't included ColnEdit in my uses clause. It works a treat now.
Thank you very much - I owe you a beer (or whatever it is you like to
drink)!.



--
Cheers,

Andy
"I want to move to Theory....Everything works in Theory"



Back to top
Andrew Denton
Guest





PostPosted: Wed Nov 26, 2003 12:41 pm    Post subject: Re: How to invoke a TCollection Item Property Editor From a Reply with quote

Alain Quesnel wrote:

Quote:
Well, I'm in Montreal. What part of the world are you from?

Alain,

I'm in the UK, so if you're ever over here there's a cold one with your
name on it! <G> There'll be two if you know how to get round the
LibIntF problem ! (See other post).


--
Cheers,

Andy
"I want to move to Theory....Everything works in Theory"

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Writing 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.