Article View: borland.public.delphi.language.objectpascal
Article #206Re: Button OnClikEvent
From: Kurt Barthelmess (TeamB)
Date: Mon, 26 Jan 2004 16:43
Date: Mon, 26 Jan 2004 16:43
48 lines
2292 bytes
2292 bytes
"MeCeX" <admin@mehmetcelik.com> wrote:
>i create a new button component but i want to change onclick event
>
>TIButton = class(TButton)
> private
> FOnClick: string;
> procedure ButtonClick(Sender: TObject);
> public
> constructor Create(AOwner: TComponent); override;
> published
> property OnClickEvent: string read FOnClick write FOnClick;
> { want to change it to below code }
> {property OnClick: string read FOnClick write FOnClick;}
> end;
>
>constructor TIButton.Create(AOwner: TComponent);
>begin
> inherited Create(AOwner);
> FOnClick := '';
> OnClick := ButtonClick; // when changed, i want this code works for
>ancestors button's onclick
>end;
>
>procedure TIButton.ButtonClick(Sender: TObject);
>begin
> if FOnClick <> '' then
> // ...
>end;
>
>how can i change ibutton's onclick event ? Is there a way ?
I'm not quite sure what you want to do here. It appears that you don't
want to allow the standard OnClick property to be used by the form
with your button on it, and want to define a new property with that
same name, but a completely different type (string vs. TNotifyEvent).
It would probably be better to declare a string property with a
different name, and then overide the Click method of TButton. In that
method you can handle a click, either by calling the inherited method
or not.
If that doesn't help, please describe what you want to do more
explicitly.
Good luck.
Kurt
Technical Details
Message-ID:
<40154230.477356@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!news.belwue.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<40152175@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109d30,a748b140769c74a3 X-Google-Attributes: gid109d30,public X-Google-ArrivalTime: 2004-01-26 09:11:53 PST From: kbarthelmess@compuserve.com (Kurt Barthelmess (TeamB)) Newsgroups: borland.public.delphi.language.objectpascal Subject: Re: Button OnClikEvent Date: Mon, 26 Jan 2004 16:43:08 GMT Organization: Scharf Systems Message-ID: <40154230.477356@newsgroups.borland.com> References: <40152175@newsgroups.borland.com> X-Newsreader: Forte Free Agent 1.21/32.243 NNTP-Posting-Host: 216.192.6.28 X-Trace: newsgroups.borland.com 1075135383 216.192.6.28 (26 Jan 2004 08:43:03 -0700) Lines: 49 Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!news.belwue.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail