Hi
Firstly, take a look at the sample
"bigdemo/bigdemo.rb" and look for the
class DemoTaskBarIcon. I think it demonstrates most of what
you want to do.
EchoB wrote:
> Am looking for a way to dynamically add menu items to a
task bar icon
> menu.
Define a method "create_popup_menu" in your
TaskBarIcon subclass. This
will be called on each occasion that the menu is shown, so
simply create
the menu with the appropriate items at any given time.
> And then once selected - I would like to get the title
of the menu
> item.
Use evt_menu to get the menu item selected, then use
Wx::Menu#get_label
to get the text string for that item. Imagine that in
create_popup_menu
you store the menu as an instance variable menu, you
could do the
following in your TaskBarIcon initialize method to capture
all menu
events and show the text label.
evt_menu(Wx::ID_ANY) do | event |
puts menu.label(event.id)
end
> Also - Am wondering about how to get the menu to
respond to the left
> mouse button click - as opposed to the right one by
default.
use evt_taskbar_left_down or evt_taskbar_left_up. Take a
look at the
TaskBarIcon and Menu documentation - I think this should all
be covered,
but please get in touch if anything's not clear.
http
://wxruby.rubyforge.org/doc/taskbaricon.html
http://wxru
by.rubyforge.org/doc/menu.html
cheers
alex
_______________________________________________
wxruby-users mailing list
wxruby-users rubyforge.org
ht
tp://rubyforge.org/mailman/listinfo/wxruby-users
|