committed, thanks
alex
Roy Sutton wrote:> wxChoicebook.rbw + patch file to bigdemo.rb
>
> Roy
> ------------------------------------------------------------------------
>
> require ''wx''
>
> class TestCB < Wx::Choicebook
> def initialize(parent, log)
> @log = log
> super(parent, -1)
>
> page_texts = [ "Yet",
> "Another",
> "Way",
> "To",
> "Select",
> "Pages"
> ]
>
> # Now make a bunch of panels for the choice book
> count = 1
> page_texts.each { |txt|
> win = Wx::Panel.new(self)
> if count == 1
> st = Wx::StaticText.new(win, -1,
> "Wx::Choicebook is yet another way to switch
between ''page'' windows",
> Wx::Point.new(10, 10))
> else
> st = Wx::StaticText.new(win, -1, "Page:
#{count}", Wx::Point.new(10,10))
> end
> count += 1
>
> add_page(win, txt)
> }
>
> evt_choicebook_page_changed(get_id) {|event|
on_page_changed(event)}
> evt_choicebook_page_changing(get_id) {|event|
on_page_changing(event)}
>
> end
>
> def on_page_changed(event)
> old = event.get_old_selection
> new = event.get_selection
> sel = get_selection
> @log.write_text("on_page_changed, old:#{old}, new:#{new},
sel:#{sel}")
> event.skip
> end
>
> def on_page_changing(event)
> old = event.get_old_selection
> new = event.get_selection
> sel = get_selection
> @log.write_text("on_page_changing, old:#{old}, new:#{new},
sel:#{sel}")
> event.skip
> end
> end
>
> module Demo
> def Demo.run(frame, nb, log)
> win = TestCB.new(nb, log)
> return win
> end
>
> def Demo.overview
> return "This class is a control similar to a notebook control,
but uses a Wx::Choice to manage the selection of the pages."
> end
> end
>
> ------------------------------------------------------------------------
>
> Index: wxruby2/samples/bigdemo/bigdemo.rb
> ==================================================================> ---
wxruby2/samples/bigdemo/bigdemo.rb (revision 540)
> +++ wxruby2/samples/bigdemo/bigdemo.rb (working copy)
> @@ -57,6 +57,7 @@
> ''wxCheckBox'',
> ''wxCheckListBox'',
> ''wxChoice'',
> + ''wxChoicebook'',
> ''wxComboBox'',
> ''wxGauge'',
> #''wxGenericDirCtrl'',
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> wxruby-users mailing list
> wxruby-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wxruby-users