noreply at rubyforge.org
2009-Mar-29 13:31 UTC
[wxruby-development] [ wxruby-Bugs-24992 ] RadioBox: keyword args cause incorrect layout (wxruby 2.0, mac osx 10.4.11)
Bugs item #24992, was opened at 2009-03-29 13:31
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=218&aid=24992&group_id=35
Category: Incorrect behavior
Group: current
Status: Open
Resolution: None
Priority: 3
Submitted By: tom smith (seven_stud)
Assigned to: Nobody (None)
Summary: RadioBox: keyword args cause incorrect layout (wxruby 2.0, mac osx
10.4.11)
Initial Comment:
With 1 for the majorDimension and Wx::RA_SPECIFY_COLS for the style...
Using positional args:
----------------
A RadioBox lays out like the docs describe: with one radio per line.
Using keyword args:
---------------
A RadioBox lays out with all the radio buttons in one row. If I change the
style to Wx::RA_SPECIFY_ROWS, then the RadioBox lays out with one radio per row
and multiple rows. That is backwards compared to the the way it works with
positional args.
If you run the following program, it will show two RadioBoxes side by side. One
RadioBox will be laid out in one column, with one radio button per line. The
other RadioBox will be laid out in one row, with all the radio buttons on one
line. However, the only difference between the code for the two
RadioBox''s is that one uses positional args and the other uses keyword
args.
require "rubygems"
require "wx"
class MyFramePosArgs < Wx::Frame
def initialize
super(nil, #parent
:id => -1, #-1 => wxruby picks id
:title => "RadioBox Example", #displays on top of
window
:pos => Wx::Point.new(150, 25), #or Wx::DEFAULT_POSITION
:size => Wx::Size.new(300, 200) #or Wx::DEFAULT_SIZE
)
panel = Wx::Panel.new(
self, #parent, self refers to this frame
:id => -1 #-1 => wxruby picks the id
)
drink_choices = ["coffee", "tea", "juice",
"milk"]
radios = Wx::RadioBox.new(
panel, #parent
-1, #-1 => wxruby picks id
"Drinks", #label for box surrounding radios
Wx::Point.new(20, 5),
Wx::DEFAULT_SIZE,
drink_choices, #the labels for the radio buttons
1, #max number of columns
Wx::RA_SPECIFY_COLS #preceding number applies to columns
)
show #equivalent to self.show, makes the frame visible
end
end
class MyFrameKeyWordArgs < Wx::Frame
def initialize
super(nil, #parent
:id => -1, #-1 => wxruby picks id
:title => "RadioBox Example", #displays on top of
window
:pos => Wx::Point.new(500, 25), #or Wx::DEFAULT_POSITION
:size => Wx::Size.new(300, 200) #or Wx::DEFAULT_SIZE
)
panel = Wx::Panel.new(
self, #parent, self refers to this frame
:id => -1 #-1 => wxruby picks the id
)
drink_choices = ["coffee", "tea", "juice",
"milk"]
radios = Wx::RadioBox.new(
panel, #parent
:id => -1, #-1 => wxruby picks id
:label => "Drinks", #label for box surrounding
radios
:pos => Wx::Point.new(20, 5),
:size => Wx::DEFAULT_SIZE,
:choices => drink_choices, #the labels for the radio buttons
:majorDimension => 1, #max number of columns
:style => Wx::RA_SPECIFY_COLS #number applies to columns
)
show #equivalent to self.show, makes the frame visible
end
end
class MyApp < Wx::App
def on_init
MyFramePosArgs.new
MyFrameKeyWordArgs.new
end
end
MyApp.new.main_loop
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=218&aid=24992&group_id=35