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 

Inplaceeditor.

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





PostPosted: Tue Aug 19, 2003 7:11 am    Post subject: Inplaceeditor. Reply with quote



Hi.

Is there a way to force the system to use a different Inplaceeditor in a
string grid without having to derive from TInplaceedit.

If I override the CreateEditor function of TCustomGrid in my own class and
if use a decendent of TInplaceedit everything works fine.

But I want to use an existing component derived from TCustomedit so how do I
do it?

Help with sample code will be appreciated.

Kind regards,

Ahamed


Back to top
Cruxy
Guest





PostPosted: Tue Aug 19, 2003 7:52 am    Post subject: Re: Inplaceeditor. Reply with quote



Quote:
Is there a way to force the system to use a different Inplaceeditor in
a string grid without having to derive from TInplaceedit.

If I override the CreateEditor function of TCustomGrid in my own
class and if use a decendent of TInplaceedit everything works fine.

But I want to use an existing component derived from TCustomedit so
how do I do it?


Hi!

AFAIK not. But you could try to change the control deriving from
TCustomEdit to derive from TInplaceEdit.

regards

Back to top
Danny Thorpe
Guest





PostPosted: Tue Aug 19, 2003 11:30 pm    Post subject: Re: Inplaceeditor. Reply with quote




"A.D. Mohideen" <ahamed.mohideen (AT) klingerkg (DOT) com> wrote

Quote:
Hi.

Is there a way to force the system to use a different Inplaceeditor in a
string grid without having to derive from TInplaceedit.

If I override the CreateEditor function of TCustomGrid in my own class
and
if use a decendent of TInplaceedit everything works fine.

But I want to use an existing component derived from TCustomedit so how do
I
do it?


Create a descendent of TCustomGrid that uses your custom inplace edit class.
Create a custom inplace edit class that serves as a container for the
existing component you want to show in the inplace edit. When the inplace
edit is instantiated, create an instance of the component with its owner and
parent set to the inplace edit.

Note that the inplace edit has several requirements placed upon it for
painting logic and especially focus control. You may have to do some
delicate message handling in the inplace edit class to make the existing
component you want to use work correctly in the context of the grid.

-Danny



Back to top
A.D. Mohideen
Guest





PostPosted: Wed Aug 20, 2003 7:04 am    Post subject: Re: Inplaceeditor. Reply with quote

Hello Danny,

Thanks for your reply. But I still need to get some things right. So please
try to help if you can.

I have already got a decendent of TCustomGrid. Please correct me if I am
mistaken, the only way I see to assign a custom inplaceeditor is to override
the CreateEditor function. But this function
needs a decendent of TinplaceEdit. And TInplaceEdit is a decendent of
TCustomMaskEdit. So how do I convert the Tinplaceedit to a container class?
In previous days I have subclassed the Inplaceeditor so if possible I would
like to change the Inplaceeditor with a decendent of TCustomEdit (but not
TCustomMaskEdit of course) behind the schenes so that the subclassing still
has an effect.

Kind regards,

Ahamed

"A.D. Mohideen" <ahamed.mohideen (AT) klingerkg (DOT) com> schrieb im Newsbeitrag
news:3f41cd38$1 (AT) newsgroups (DOT) borland.com...
Quote:
Hi.

Is there a way to force the system to use a different Inplaceeditor in a
string grid without having to derive from TInplaceedit.

If I override the CreateEditor function of TCustomGrid in my own class
and
if use a decendent of TInplaceedit everything works fine.

But I want to use an existing component derived from TCustomedit so how do
I
do it?

Help with sample code will be appreciated.

Kind regards,

Ahamed





Back to top
Marc Rohloff
Guest





PostPosted: Wed Aug 20, 2003 1:00 pm    Post subject: Re: Inplaceeditor. Reply with quote

I think Danny means doing the following:

Given: TMyEditor as your TCustomEdit descendant.

type
TMyInPlaceEditor = classs(TInplaceEditor)
private
fEditor:TMyEditor;
public
constructor create(aOwner:TComponent); override;
end;

constructor TMyInplaceEditor.create(aOwner:TComponent);
begin
inherited;
fEditor := TMyEditor.create(self);
fEditor.parent := self;
fEditor.ALign := alClient;
fEditor.visible := true;
end;

This would create an inplace editor with your own editor embedded in it.
You would still need to override quite a few methods such as handling the
focus and getting/setting the text.

Marc


Back to top
A.D. Mohideen
Guest





PostPosted: Thu Aug 21, 2003 6:49 am    Post subject: Re: Inplaceeditor. Reply with quote

Thanks alot got it working the same way. Sorry Dany for misunderstanding. :)

Best regards,

Ahamed

"Marc Rohloff" <marc rohloff at bigfoot dot com> schrieb im Newsbeitrag
news:MPG.19ad3af29bbbd9df989a8d (AT) newsgroups (DOT) borland.com...
Quote:
I think Danny means doing the following:

Given: TMyEditor as your TCustomEdit descendant.

type
TMyInPlaceEditor = classs(TInplaceEditor)
private
fEditor:TMyEditor;
public
constructor create(aOwner:TComponent); override;
end;

constructor TMyInplaceEditor.create(aOwner:TComponent);
begin
inherited;
fEditor := TMyEditor.create(self);
fEditor.parent := self;
fEditor.ALign := alClient;
fEditor.visible := true;
end;

This would create an inplace editor with your own editor embedded in it.
You would still need to override quite a few methods such as handling the
focus and getting/setting the text.

Marc





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.