[fxruby-users] setCurrent switcher index out of bounds problem

Axel Etzold AEtzold at gmx.de
Tue Jun 6 03:49:56 EDT 2006

I'm trying to develop a GUI that combines features of
the foursplit.rb and shutter.rb examples.
So there is a bar of ShutterButtons to the left,
and a set of four FX4Splitter elements to the right
of the screen. 
Thanks to expert help from Lyle, it's now possible to
'expand' any of these elements to full size of the
right pane.
Now, I need to add the possibility to switch between
different layers of the right pane, just like in the
shutter.rb application, where you press one of the
ShutterButtons on the left to have that behaviour.

In my code, I set a variable @shutter.current =0, etc..,
like this

big_splitter = FXSplitter.new(self, (LAYOUT_SIDE_TOP|LAYOUT_FILL_X|
@shutter = FXShutter.new(big_splitter, nil, 0,
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
@switcher = FXSwitcher.new(big_splitter,
      FRAME_SUNKEN|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0)
splitter = FX4Splitter.new(@switcher,
shutterItem = ShutterItem.new(@shutter, "Files, data, and pictures", nil, LAYOUT_FILL_Y)
    ShutterButton.new(shutterItem.content, "Expand dirlist", big_folder).connect(SEL_COMMAND){
     splitter.handle(self,FXSEL(SEL_COMMAND, FX4Splitter::ID_EXPAND_TOPLEFT), nil)}
    ShutterButton.new(shutterItem.content, "Expand cell file editor", pens).connect(SEL_COMMAND){
     splitter.handle(self,FXSEL(SEL_COMMAND, FX4Splitter::ID_EXPAND_BOTTOMLEFT), nil)}
    ShutterButton.new(shutterItem.content, "Expand tuning curve plot", messypaint).connect(SEL_COMMAND){
     splitter.handle(self,FXSEL(SEL_COMMAND, FX4Splitter::ID_EXPAND_TOPRIGHT), nil)}
    ShutterButton.new(shutterItem.content, "Expand reconstruction plot", drawing).connect(SEL_COMMAND){
     splitter.handle(self,FXSEL(SEL_COMMAND, FX4Splitter::ID_EXPAND_BOTTOMRIGHT), nil)}
    ShutterButton.new(shutterItem.content, "Show all four", monitor).connect(SEL_COMMAND){
     splitter.handle(self,FXSEL(SEL_COMMAND, FX4Splitter::ID_EXPAND_ALL), nil)}
Then, I get the error below.
What is the problem here ?

Thank you very much in advance,


Error message:

c:/ruby/lib/ruby/gems/1.8/gems/fxruby-1.4.6-mswin32/lib/fox14/aliases.rb:4067:in `setCurrent': switcher item index out of bounds (IndexError)
	from c:/ruby/lib/ruby/gems/1.8/gems/fxruby-1.4.6-mswin32/lib/fox14/aliases.rb:4067:in `current='
	from c:/axelhome/ngui/f17.rb:170:in `initialize'
	from c:/ruby/lib/ruby/gems/1.8/gems/fxruby-1.4.6-mswin32/lib/fox14/responder2.rb:57:in `onHandleMsg'
	from c:/axelhome/ngui/f17.rb:610:in `runme'
	from c:/axelhome/ngui/f17.rb:619


Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
      Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

More information about the fxruby-users mailing list