wxruby-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wxruby-dev] Wait! Not ready for release


From: Kevin Smith
Subject: [Wxruby-dev] Wait! Not ready for release
Date: 29 Jun 2003 10:18:58 -0700

Last night, I realized that the event-handling problem is not that hard
to fix. And I would rather release the alpha with event handling that
will be at least quite close to the real method, rather than forcing
people to change their ruby application code after the alpha.

So I believe I can have new event handling working, and all the samples
updated, by the end of today.

Until now, you set up an event like this:
    evt_menu(self, ID_FILE_QUIT,  "onQuit")

This would be in your MyFrame class, and it says that any menu events
with an ID of ID_FILE_QUIT, should invoke MyFrame#onQuit(event).
Unfortunately, this means that you _must_ create a method for each kind
of event you want to handle, even if the code is trivial. 

My new approach looks like this:
    evt_menu(ID_FILE_QUIT) { onQuit }
or
    evt_menu(ID_FILE_QUIT) { |event| onQuit(event) }

Much simpler and more rubyesque. And if you really don't care about the
event (which is true 90% of the time), you don't have to pass it. 

For now, ID will be required, even though more than half the time it
will be -1. Once this part of the code is being generated by templates,
it will be trivial to have it default to -1.

Kevin






reply via email to

[Prev in Thread] Current Thread [Next in Thread]