Displaying 3 results from an estimated 3 matches for "on_button_click".
2007 Sep 10
2
syntax II
...e with whatever we
settle on for 2.0 for a little while, so...
1) Setting up event handlers
In most real apps, I think the most normal way to set up event handlers
is for the event to be dealt with by a corresponding method. At the
moment this has to be done using a block:
evt_button(AN_ID) { on_button_click }
evt_button(my_button.get_id) do | event |
on_button_click(event)
end
evt_size { | event | on_size(event) }
This is a sensible way to organise classes but it seems to have
redundancy in it. The bigger one is having to create a block, with
param, just to call a method; the smaller one is havin...
2007 Sep 17
7
Re : syntax II
Alex Fenton wrote :
>1) Setting up event handlers
>
>In most real apps, I think the most normal way to set up event handlers
>is for the event to be dealt with by a corresponding method. At the
>moment this has to be done using a block:
>
>evt_button(AN_ID) { on_button_click }
>evt_button(my_button.get_id) do | event |
> on_button_click(event)
>end
>evt_size { | event | on_size(event) }
>
>So I''d like to suggest as alternatives:
>
>evt_button(AN_ID, :on_button_click)
>evt_button my_button, :on_button_click
>evt_size :on_size
The...
2007 Oct 23
6
wxRuby 1.9.2
...lasses
* New and improved samples and documentation, including threads sample
== SYNTAX CHANGES ==
All the syntax additions are backwards compatible. The main change is
that when setting up an event handler that just passes onto a method,
instead of writing:
evt_button(my_button.wx_id) { | e | on_button_click(e) }
You can just write
evt_button my_button, :on_button_click
Phew! There''s more information in the event handling tutorial in the
docs. Also, for simple apps, instead of having to create a custom
Wx::App subclass, you can run an app like this:
Wx::App.run do
f = Frame.new(nil, :t...