[fxruby-users] RE : FXTable, SEL_REPLACED and modal dialogs, 2nd

Philippe Lang philippe.lang at attiksystem.ch
Tue Jan 6 03:29:21 EST 2009


fxruby-users-bounces at rubyforge.org wrote:

> OK, yes, this I can reproduce. I'll look into it. Presumably a FOX
> bug, but maybe something we can work around.

Hi Lyle,

Here is a more complete  example, closer to what I'm doing in my program, that shows one more thing:

----------------------------------
#!/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)
    @table = FXTable.new(f, nil, 0, TABLE_COL_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y)
    @table.connect(SEL_REPLACED, method(:onReplaced))
    
    @table.visibleRows = 3
    @table.visibleColumns = 3
    @table.setTableSize(3, 3)
    
  end

  def create
    super
    show(PLACEMENT_SCREEN)
  end
  
  def onReplaced(sender, sel, data)
    
    # We simulate here an input error, where the user gets "stuck" in the table cell
    # as long as the value is not correct. In this test example, he is not very lucky,
    # everything he enters is wrong...
    
    # We cancel the current input
    @table.cancelInput
    
    # We display the modal dialog
    FXMessageBox.information(self, MBOX_OK, "Error", "This is an error message.")
    
    # We move to the current cell, and start a new input on it
    row = data.fm.row
    col = data.fm.col
    @table.selectItem(row, col)
    @table.setCurrentItem(row, col)
    @table.startInput(row, col)
  end
  
end

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


First test:
-----------
1) Click on the top left cell
2) Type something in it
3) Validate the cell input with the return key
4) Close the dialog with the return key
5) That's fine

Second test:
------------
1) Click on the top left cell
2) Type something in it
3) Go to the next cell with the tab key
4) Close the dialog with the return key
5) That works, except the small dotted rectangle around the next cell, which should not be there in my opinion

Third test:
-----------
1) Click on the top left cell
2) Type something in it
3) Click on any other cell
4) Close the dialog with the mouse
5) Move your mouse around the table cells, and enjoy! :)




Regards,

Philippe


More information about the fxruby-users mailing list