Tabs


#1

Can anyone tell me how to create a tabbed interface? I tried using the
Notebook control but I could not get it to work.

I’m trying to put a Grid on one of the Notebook pages.

Thanks,
Trans


#2

Luc T. a écrit :

removed_email_address@domain.invalid
DEFAULT_POSITION,
welcome_text, “Welcome”,
true,
-1)

Hope it’s useful

Sorry about bad formatting… thunderbird messed it all


#3

Trans a écrit :

http://rubyforge.org/mailman/listinfo/wxruby-users

Here is some code I used in a small app:

the tabbed interface

# create the notebook
@notebook = Notebook.new(
  @frame,   # the parent frame
  1,
  DEFAULT_POSITION,
  DEFAULT_SIZE,
  0,
  'notebook')

welcome_text = StaticText.new(
  @notebook,
  2,
  "\nClick on a project node to open it or create a new project.",
  DEFAULT_POSITION,
  DEFAULT_SIZE,
  0,
  "welcomeText")

@notebook.add_page(
  welcome_text,
  "Welcome",
  true,
  -1)

Hope it’s useful


#4

Trans wrote:

http://rubyforge.org/mailman/listinfo/wxruby-users
It is fairly straightforward. I think the key is to attach the controls
to Wx::Panels, then add the panels to the notebook. See the sample code
below.

#!/usr/bin/env ruby

require ‘wx’
include Wx

class MainFrame < Frame

def initialize(title)

 super(nil, :title => title)
 panel_1 = Panel.new(self)
 box_1 = BoxSizer.new(VERTICAL)
 panel_1.sizer = box_1

 notebook = Notebook.new(panel_1, :style => NB_TOP)
 box_1.add(notebook, 0, ALIGN_LEFT | ALL, 10)

 panel_n1 = Panel.new(notebook)
 box_n1 = BoxSizer.new(VERTICAL)
 panel_n1.sizer = box_n1
 box_n1.add(TextCtrl.new(panel_n1), 0, ALIGN_LEFT | ALL, 10)
 box_n1.add(TextCtrl.new(panel_n1), 0, ALIGN_LEFT | ALL, 10)

 panel_n2 = Panel.new(notebook)
 box_n2 = BoxSizer.new(VERTICAL)
 panel_n2.sizer = box_n2
 grid_n2 = Grid.new(panel_n2, :size => [270, 140])
 grid_n2.create_grid(3,2)
 box_n2.add(grid_n2, 0, ALIGN_LEFT | ALL, 10)

 notebook.add_page(panel_n1, "Tab 1", true)
 notebook.add_page(panel_n2, "Tab 2", false)

end

end

Wx::App.run do
self.app_name = ‘TestNotebook’
frame = MainFrame.new(“Test notebook”)
frame.show
end


David Peoples removed_email_address@domain.invalid
The Touring Cyclist http://www.touringcyclist.com
11816 St. Charles Rock Road, Bridgeton, MO 63044
tel: 314-739-4648 fax: 314-739-4972