[fxruby-users] Problem with FXSwitcher
lyle at lylejohnson.name
Sat Jan 12 07:02:04 EST 2008
On Jan 12, 2008, at 5:21 AM, Grobie wrote:
> I'm writing my first FXRuby program (with the help of Lyle Johnsons
> Pragmatic book, thanks) and I've got a little problem with the
> I've got a form and a picture. When the user opens a new picture, I
> want to
> reload the form (so every picture has one form). This works,
> fires a message and I can react. But if the switcher is empty (when
> program starts) and I add the first picture to it, it doesn't fire.
> Why? And
> if it's impossible to do it my way, how can I fire a message manually?
The switcher only fires a SEL_COMMAND message when the index of its
current window is changed from one child window to another. So for
example if you are currently showing panel 2, and then you change to
panel 3, it should fire SEL_COMMAND. However, merely adding a window
to a switcher doesn't cause this index to change (nor does removing a
window from the switcher).
If you're wanting to fire a SEL_COMMAND every time a new panel is
added to the switcher, you'd need to do something manually, e.g.
switcher = FXSwitcher.new(...)
new_panel = FXVerticalFrame.new(switcher, ...)
switcher.setCurrent(switcher.numChildren -1, true)
Hope this helps,
More information about the fxruby-users