[fxruby-users] FXTable initialization bug?

Philippe Lang philippe.lang at attiksystem.ch
Mon Sep 25 16:43:13 EDT 2006


Hi,

Firstly, sorry for flooding this forum with bug reports: FXRuby works just fine except a few minor glitches...

Here is another one: when clicking outside an FXTable visible cells (either on the right or at the bottom), when no cell have ever been selected, the app SEGFAULTs. Preselecting a cell corrects the problem.

Demo code 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)
    FXMenuCommand.new(filemenu, "&Quit\tCtl-Q\tQuit the application",
        nil, app, FXApp::ID_QUIT)
    FXMenuTitle.new(menubar, "&File", nil, filemenu)
    
    # Tabbook
    @tabbook = FXTabBook.new(self, nil, 0,
        LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_RIGHT)
    @tab = FXTabItem.new(@tabbook, "FXTable", nil)
    
    # FXTable
    @table = FXTable.new(@tabbook, nil, 0,
        TABLE_COL_SIZABLE|TABLE_ROW_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y,
        0, 0, 0, 0, 2, 2, 2, 2)
    @table.visibleRows = 10
    @table.visibleColumns = 4
    @table.setTableSize(10, 4)
    
    # Initialize columns
    @table.setColumnText(0, "A")
    @table.setColumnText(1, "B")
    @table.setColumnText(2, "C")
    @table.setColumnText(3, "D")
    
    # Initialize rows
    (0...10).each { |r| @table.setRowText(r, "Row #{r}") }
    
    # FXRuby bug workaround: one cell must be selected, otherwise app crashes
    # when a click is done outside the table
    #@table.setCurrentItem(0, 0)
    
  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

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

FXRuby 1.6.2 for Ryby 1.8.4, Windows XP

---------------
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/20060925/1015799b/attachment-0001.bin 


More information about the fxruby-users mailing list