[fxruby-users] FXTable.setTableSize & clic -> crash

Philippe Lang philippe.lang at attiksystem.ch
Sun Oct 29 13:00:18 EST 2006


Hi Lyle,

Thanks for the new version of FXRuby 1.6.3!

There is still a bug in FXRuby 1.6.3, that crashes the application when you click outside the visible cells of an FXTable where no cell was selected yet.

`setCurrentItem': table row out of bounds (IndexError)


Note this happens only if the table is being initialized with:

    t.visibleRows = 3
    t.visibleColumns = 3
    t.setTableSize(3, 3)

With the following equivalent (?) lines, the problem disappears:

    t.appendRows(3)
    t.appendColumns(3)


Maybe I'm doing something wrong?


Test code is provided here:

------------------------------------------------

#!/usr/bin/ruby

require 'fox16'

include Fox

class MyWindow < FXMainWindow
    
  def initialize(app)

    super(app, "Window", nil, nil, DECOR_ALL, 0, 0, 600, 350)

    # Menu bar stretched along the top of the main window
    menubar = FXMenuBar.new(self, LAYOUT_SIDE_TOP|LAYOUT_FILL_X)
  
    # File menu
    filemenu = FXMenuPane.new(self)
    FXMenuTitle.new(menubar, "&File", nil, filemenu)
    FXMenuCommand.new(filemenu, "&Quit\tCtl-Q\tQuit the application",
        nil, app, FXApp::ID_QUIT)

    # Table
    f = FXHorizontalFrame.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y)
    t = FXTable.new(f, nil, 0, TABLE_COL_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y)
    
    t.visibleRows = 3
    t.visibleColumns = 3
    t.setTableSize(3, 3)
    
    # Note: problem disappears if you use the following code
    # instead of the 3 lines above:
    
    #t.appendRows(3)
    #t.appendColumns(3)
    
  end

  def create
    super
    show(PLACEMENT_SCREEN)
  end
  
end

if __FILE__ == $0
  application = FXApp.new("Attik System", "FXRuby Test")
  MyWindow.new(application)
  application.create
  application.run
End


------------------------------------------------


Cheers,

---------------
Philippe Lang
Attik System

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3125 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20061029/362accac/attachment.bin 


More information about the fxruby-users mailing list