-
Notifications
You must be signed in to change notification settings - Fork 7
FAQ : Common runtime questions
Generally speaking top level windows except dialogs are destroyed when closed (or explicitly destroyed by calling #destroy
)
and all their child windows are destroyed at that moment.
Please see the user guide chapters wxRuby Life Cycles (especially the Windows section) and wxRuby Dialogs for detailed information.
Toplevel windows like Wx::Frame with a single, unique, child window will resize the child window to fill all the available space by default (irrespective of the fact whether the child window itself has any child windows or not).
That is why code like this:
frame = Wx::Frame.new(nil, 'Test Frame')
Wx::Button.new(frame, 'Hello world!', pos: [10,10], size: [80,30])
frame.show
will show a frame with a button completely filling up the entire client area instead of showing a button of 80 by 30 pixels.
This is default behaviour accommodates the far more usual approach of creating frames with a Wx::Panel as its single, unique, child window into which all controls are added like this:
frame = Wx::Frame.new(nil, 'Test Frame')
panel = Wx::Panel.new(frame)
Wx::Button.new(panel, 'Hello world!', pos: [10,10], size: [80,30])
frame.show
NOTE Be aware that fixed positioning/sizing of controls is strongly discouraged as this won’t work correctly on all platforms and on all the different screens, using different resolutions.
Please use sizers (see Wx::Sizer and related classes documentation) for positioning (and sizing) them instead.
See the test_event_handling
regression test and/or the following samples:
-
event/event.rb
('Event samples' -> 'wxRuby event handling example') -
event/threaded.rb
('Event samples' -> 'wxRuby threading example')
Use the Wx::Window#move_before_in_tab_order
or Wx::Window#move_after_in_tab_order methods
to change the position of a child window in the TAB order.
By default the TAB order is the same as the order of creation.
Dialogs only close on pressing [ESC]
if and only if they have a button with id Wx::ID_CANCEL
.
-
-
- What is wxRuby3?
- Can I use wxRuby3 for proprietary or open source projects?
- What is the origin of wxRuby3?
- How is wxRuby3 supported?
- What platforms are supported by wxRuby3?
- What features does wxRuby3 support?
- Does wxRuby3 support platform-specific features?
- How is wxRuby3 developed?
- How do I get wxRuby3?
- How do I use wxRuby3
- Can I help?
- Is there another, more declarative way, for writing wxRuby3 desktop GUI applications?
-