|
From: Takaaki T. <tt...@kt...> - 2002-09-16 04:49:24
|
At Sun, 15 Sep 2002 23:36:57 +0100 (BST),
> Can anyone point me at an example of pop-up menus done in ruby-fltk (or
> fltk-proper for that matter).
> This is to implement a right-click context-sensitive menu.
Use FLTK::MenuButton with the type POPUP3. Here is an example:
require 'fltk'
$items1 = [
["item1", 0, proc{ print("item1\n") }, "item1_data", FLTK::SUBMENU],
["bar", 0, proc{|w,data| print("item1/bar\n") }, "item1_foo_data"],
[],
["item2", 0, proc{ print("item2\n") }, "item2_data", FLTK::SUBMENU],
["foo", 0, proc{ print("item2/foo\n") }, "item2_foo_data"],
[],
["item3", 0, proc{ print("item3\n") }, "item3_data", FLTK::SUBMENU],
["foo", 0, proc{ print("item3/foo\n") }, "item3_foo_data"],
[],
]
FLTK::Window.new(300,100){|win|
mb = FLTK::MenuButton.new(0,0,100,100,"popup")
mb.menu($items1)
mb.widget_type(FLTK::MenuButton::POPUP3)
win.show
}
FLTK.run
--
Takaaki Tateishi <tt...@kt...>
|