Board index » delphi » How can i process event, like button.OnClick?

How can i process event, like button.OnClick?

in c#, use delegate, how can i do in delphi for .net preview?
 

Re:How can i process event, like button.OnClick?


Luke,

Quote
> in c#, use delegate, how can i do in delphi for .net preview?

a bit clumsy, but the following works:

Button1.Click :=
System.EventHandler.Create(self,NativeInt(@TForm1.Button1Click));

hth,

--
marc hoffman (m...@elitedev.com)
elitedevelopments software
http://www.elitedevelopments.com

"When two events occur simultaneously pertaining to the
same object of inquiry, one must always pay strict attention."

Re:How can i process event, like button.OnClick?


Quote
"marc hoffman" <m...@elitedev.com> wrote in message

news:3d68e3c3@newsgroups.borland.com...

Quote
> Luke,

> > in c#, use delegate, how can i do in delphi for .net preview?

> a bit clumsy, but the following works:

> Button1.Click :=
> System.EventHandler.Create(self,NativeInt(@TForm1.Button1Click));

How I love it!

Programming the D4.NET compiler preview is kinda like making love while
standing in a hammock, a bit tricky and hard to maintain your perspective
but how exciting.<g>

Thanks but I'll wait to see what Galileo offers and in the meantime use
VS.NET.

Since I have no interest in programming on anything other than MS OS it'll
be interesting to see if Galileo will be able to win back my heart and soul.

--Hairy

Re:How can i process event, like button.OnClick?


Quote
"marc hoffman" <m...@elitedev.com> wrote in message

news:3d68e3c3@newsgroups.borland.com...

Quote
> a bit clumsy, but the following works:

> Button1.Click :=
> System.EventHandler.Create(self,NativeInt(@TForm1.Button1Click));

Clumsy?  You said it..

This irks me somewhat when in C# you simply write the following to _add_ the
event to the event chain.

---
this.button1 = new System.Windows.Forms.Button();
...
this.button1.Click += new System.EventHandler(this.button1_Click);
----

The Delphi way of doing this adds a unique layer of difficulty to doing
something that should be quite simple and straightforward.

How do you unhook the event handler in Delphi.Net?  In CSharp, you would
use -= to remove the delegate from the event chain.

Paul

Re:How can i process event, like button.OnClick?


Quote
Harry Van Tassell wrote:
> Programming the D4.NET compiler preview is kinda like making love while
> standing in a hammock, a bit tricky and hard to maintain your perspective
> but how exciting.<g>

Yes, you must be e{*word*277}d as the only one in history to have the "D4.NET"
compiler preview  : - )

--
David Farrell-Garcia
Orca Software & Technologies
http://www.orcasoftware.com

Re:How can i process event, like button.OnClick?


Quote
Paul Qualls wrote:
> Clumsy?  You said it..

> This irks me somewhat when in C# you simply write the following to add the
> event to the event chain.

true, but there are some things in C# that are a lot more verbose then
Delphi as well.  All in all I think C# is more elegant then Delphi, but it
does not win on every count.

--
David Farrell-Garcia
Orca Software & Technologies
http://www.orcasoftware.com

Re:How can i process event, like button.OnClick?


On Sun, 25 Aug 2002 11:31:04 -0600, "Paul Qualls"

Quote
<p...@paulqualls.com> wrote:
>The Delphi way of doing this adds a unique layer of difficulty to doing
>something that should be quite simple and straightforward.

??

In Delphi, it's one line of code --

ByButton.OnClick := nil;

Of course, we'll soon see how Delphi will handle multiple event
handlers.

Nick Hodges
Lemanix Corporation
How to ask questions of techies --
http://www.tuxedo.org/~esr/faqs/smart-questions.html

Re:How can i process event, like button.OnClick?


Quote
"David Farrell-Garcia" <dav...@orcasoftware.com> wrote in message

news:3d6918d2$1@newsgroups.borland.com...

Quote
> Harry Van Tassell wrote:

> > Programming the D4.NET compiler preview is kinda like making love while
> > standing in a hammock, a bit tricky and hard to maintain your
perspective
> > but how exciting.<g>

> Yes, you must be e{*word*277}d as the only one in history to have the "D4.NET"
> compiler preview  : - )

You may be the first person to ever imply that I'm not compulsively
pedantic. ;-)

Well what ever, I found the experience quite exciting...<g>

-- Hairy

Re:How can i process event, like button.OnClick?


Is this functionally distinct from Button1.add_Click(Button1Click) as used
in the bdn examples at http://bdn.borland.com/article/0,1410,28972,00.html?

st

Quote
"marc hoffman" <m...@elitedev.com> wrote in message

news:3d68e3c3@newsgroups.borland.com...
Quote
> a bit clumsy, but the following works:

> Button1.Click :=
> System.EventHandler.Create(self,NativeInt(@TForm1.Button1Click));

Other Threads