I''m going to cross-post this to the wxRuby ML because I know of at
least one
wxRuby expert who does not subscribe to ruby-talk.
Curt
Stephan Kämper
[mailto:Stephan.Kaemper@Schleswig-Holstein.de]>
> Hi all,
>
> having just started to work with wxRuby, I would like to
> - display a Wx::Notebook
> - with several widgets in each row
> - where the text field in the row horizontally fills the frame/window.
> - and with a scrollbar in case the list gets too long to fit into
> the available space
>
> Now I condensed the code I started with into this example (with faked
> data to fill the tabs):
>
> --- code begin ---
>
> require ''wxruby''
>
> class TabScroller < Wx::App
>
> def on_init
> frame = Wx::Frame.new( nil, -1, ''Matices in tabs'' )
> frame.set_client_size( Wx::Size.new( 400, 120 ) )
> sizer = Wx::BoxSizer.new( Wx::VERTICAL )
>
> notebook = Wx::Notebook.new( frame, -1 )
>
> fill_tabbook( notebook )
>
> frame.show
> end
>
> def fill_tabbook( notebook )
> @sl = [ { :header => "Header 1",
> :list =>[ ["CB1", "Additional text1 "],
> ["CB2", "ding"],
> ["text2", "dong"] ]
> },
> { :header => "Third" ,
> :list => [ ["3rd check 1", "..." ],
> ["3rd check 2", "..." ],
> ["3rd check 3", "..." ],
> ["3rd check 4", "..." ] ]
> }
> ]
>
> @sl.each_with_index{ | line, idx |
> panel = Wx::Panel.new( notebook, -1 )
> sizer = Wx::FlexGridSizer.new( 2, 0, 2 )
> panel.set_sizer sizer
>
> header = Wx::StaticText.new( panel, -1, line[:header] )
> sizer.add( header, 0, Wx::ALIGN_LEFT )
> sizer.add( Wx::StaticText.new( panel, -1, '''' ), 0,
> Wx::ALIGN_LEFT )
>
> line[:list].each { | item |
> checker = Wx::CheckBox.new( panel, -1, item[0] )
> sizer.add( checker, 0, Wx::ALIGN_LEFT )
>
> notes = Wx::TextCtrl.new( panel, -1, item[1] )
> sizer.add( notes, 1)
>
> sizer.add( Wx::StaticText.new( panel, -1, '''' ),
0,
> Wx::ALIGN_LEFT )
> sizer.add( Wx::StaticText.new( panel, -1, '''' ),
0,
> Wx::ALIGN_LEFT )
> }
> notebook.add_page( panel, "Tab No #{idx + 1}" )
> }
> end
>
> end
>
> if __FILE__ == $0
> TabScroller.new.main_loop()
> end
>
> --- code end ---
>
> These are my questions:
> How would I introduce a Wx::ScrolledWindow (if that''s what is
needed)
> into this to add a scrollbar to each tab (so the user can use the scroll
> bar to reach all the widgets)?
>
> How can I make the Wx::TextCrtl fill the available space to the right?
>
> Any help would be greatly appreciated.
>
> Happy rubying
>
> Stephan
>
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.775 / Virus Database: 522 - Release Date: 10/8/2004
>