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

Philippe Lang philippe.lang at attiksystem.ch
Mon Jan 5 04:00:12 EST 2009

Hi again, and sorry for the previous incomplete message.

I'm using the SEL_REPLACE event in FXTable to check at run-time that the
values entered by the user are correct. In case of an error, I tried to
show the error with an FXMessageBox modal dialog, like in the following
test code:


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,
    t.connect(SEL_REPLACED, method(:onReplaced))
    t.visibleRows = 3
    t.visibleColumns = 3
    t.setTableSize(3, 3)

  def create
  def onReplaced(sender, sel, data)
    FXMessageBox.information(self, MBOX_OK, "Error", "This is an error

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

FXRuby or maybe fox itself gets confused after the modal dialog has been
closed: although the mouse button has been released, FXTable cells
selection follow the mouse.

To reproduce the problem, do the following:

1) Click in a cell.
2) Type something in this cell.
3) Press TAB or click on another cell. An error message appears. Close
4) Move your cursor around on the table cells. Here is the problem.

Is that a bug? And if yes, is there a workaround maybe? The only
solution I found for this problem, is to use a non-modal dialog. No
problem in this case.

Best regards,

Philippe Lang

More information about the fxruby-users mailing list