Philippe Lang
2009-Jan-05 09:00 UTC
[fxruby-users] FXTable, SEL_REPLACED and modal dialogs, 2nd
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: ---------------------------------------------- #!/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.connect(SEL_REPLACED, method(:onReplaced)) t.visibleRows = 3 t.visibleColumns = 3 t.setTableSize(3, 3) end def create super show(PLACEMENT_SCREEN) end def onReplaced(sender, sel, data) FXMessageBox.information(self, MBOX_OK, "Error", "This is an error message.") end end if __FILE__ == $0 application = FXApp.new("Attik System", "FXRuby Test") MyWindow.new(application) application.create application.run end ---------------------------------------------- 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 it. 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
Lyle Johnson
2009-Jan-05 16:03 UTC
[fxruby-users] FXTable, SEL_REPLACED and modal dialogs, 2nd
On Jan 5, 2009, at 3:00 AM, Philippe Lang wrote:> 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:<snip>> 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 > it. > 4) Move your cursor around on the table cells. Here is the problem.Philippe, I am (so far) having trouble reproducing this bug. I''ve tried it both on OS X and Windows XP, using the latest release of FXRuby. What OS and version(s) of things are you working with? Thanks, Lyle
Philippe Lang
2009-Jan-05 21:20 UTC
[fxruby-users] RE : FXTable, SEL_REPLACED and modal dialogs, 2nd
> Philippe, > > I am (so far) having trouble reproducing this bug. I''ve tried it both > on OS X and Windows XP, using the latest release of FXRuby. What OS > and version(s) of things are you working with?Hi Lyle, I''m using the latest FXRuby, and a quite decent ruby enviroment too: --------------------------------- C:\Documents and Settings\Administrateur>ruby -v ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32] C:\Documents and Settings\Administrateur>gem list *** LOCAL GEMS *** activerecord (2.0.5) Implements the ActiveRecord pattern for ORM. activesupport (2.0.5) Support and utility classes used by the Rails framework. fxri (0.3.6) Graphical interface to the RI documentation, with search engine. fxruby (1.6.18) FXRuby is the Ruby binding to the FOX GUI toolkit. gettext (1.9.0) Ruby-GetText-Package is a libary and tools to localize messages. hpricot (0.6) a swift, liberal HTML parser with a fantastic library log4r (1.0.5) Log4r is a comprehensive and flexible logging library for Ruby. postgres-pr (0.4.0) A pure Ruby interface to the PostgreSQL (>= 7.4) database rake (0.7.3) Ruby based make-like utility. rubyscript2exe (0.5.3) A Ruby Compiler sources (0.0.1) This package provides download sources for remote gem installation win32-api (1.0.4) A superior replacement for Win32API win32-clipboard (0.4.3) A package for interacting with the Windows clipboard win32-dir (0.3.2) Extra constants and methods for the Dir class on Windows. win32-eventlog (0.4.6) Interface for the MS Windows Event Log. win32-file (0.5.4) Extra or redefined methods for the File class on Windows. win32-file-stat (1.2.7) A File::Stat class tailored to MS Windows win32-process (0.5.3) Adds fork, wait, wait2, waitpid, waitpid2 and a special kill method win32-sapi (0.1.4) An interface to the MS SAPI (Sound API) library. win32-sound (0.4.1) A library for playing with sound on MS Windows. windows-api (0.2.0) An easier way to create methods using Win32API windows-pr (0.7.2) Windows functions and constants bundled via Win32::API --------------------------------- For the OS, I use Windows XP SP3, but I''m pretty sure the problem happens with SP2 too. I have just made some more tests, and I agree the problem doe not always happen if you follow my previous email. Here is how to reproduce the bug on my laptop: 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 cursor around on the FXTable without clicking I hope you can reproduce this strange thing... Best regards, Philippe Lang -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/ms-tnef Size: 8338 bytes Desc: not available URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20090105/fe98af22/attachment-0001.bin>
Lyle Johnson
2009-Jan-05 22:56 UTC
[fxruby-users] RE : FXTable, SEL_REPLACED and modal dialogs, 2nd
On Jan 5, 2009, at 3:20 PM, Philippe Lang wrote:> I have just made some more tests, and I agree the problem doe not > always happen if you follow my previous email. Here is how to > reproduce the bug on my laptop: > > 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 cursor around on the FXTable without clickingOK, yes, this I can reproduce. I''ll look into it. Presumably a FOX bug, but maybe something we can work around.
Philippe Lang
2009-Jan-06 08:29 UTC
[fxruby-users] RE : FXTable, SEL_REPLACED and modal dialogs, 2nd
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
Len Lawrence
2009-Jan-06 10:27 UTC
[fxruby-users] FXTable, SEL_REPLACED and modal dialogs, 2nd
Lyle Johnson wrote:> > On Jan 5, 2009, at 3:00 AM, Philippe Lang wrote: > >> 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: > > <snip> > >> 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 >> it. >> 4) Move your cursor around on the table cells. Here is the problem. > > Philippe, > > I am (so far) having trouble reproducing this bug. I''ve tried it both > on OS X and Windows XP, using the latest release of FXRuby. What OS > and version(s) of things are you working with? > > Thanks, > > Lyle > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users >It reproduces on linux here for button presses but not for tabs. Len
Philippe Lang
2009-May-04 15:27 UTC
[fxruby-users] FXTable, SEL_REPLACED and modal dialogs, 2nd
fxruby-users-bounces at rubyforge.org wrote:> 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: > > ---------------------------------------------- > #!/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.connect(SEL_REPLACED, method(:onReplaced)) > > t.visibleRows = 3 > t.visibleColumns = 3 > t.setTableSize(3, 3) > > end > > def create > super > show(PLACEMENT_SCREEN) > end > > def onReplaced(sender, sel, data) > FXMessageBox.information(self, MBOX_OK, "Error", "This is an error > message.") > end > > end > > if __FILE__ == $0 > application = FXApp.new("Attik System", "FXRuby Test") > MyWindow.new(application) > application.create > application.run > end > ---------------------------------------------- > > 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 it. 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.Hi, I took time today to track the bug I mentionned a few months ago. It is a problem at the Fox level, apparently due to the way selections can be extended in an FXTable. I have commented out both "mode=MOUSE_SELECT;" lines in FXTable::onLeftBtnPress, and the problem disapeared. But as a side-effect, it is not possible to extend selections in FXTable objects anymore. ========================================// Pressed button long FXTable::onLeftBtnPress(FXObject*,FXSelector,void* ptr){ FXEvent* event=(FXEvent*)ptr; FXTablePos tablepos; flags&=~FLAG_TIP; handle(this,FXSEL(SEL_FOCUS_SELF,0),ptr); if(isEnabled()){ grab(); if(target && target->tryHandle(this,FXSEL(SEL_LEFTBUTTONPRESS,message),ptr)) return 1; // Cell being clicked on tablepos.row=rowAtY(event->win_y); tablepos.col=colAtX(event->win_x); // Outside table if(tablepos.row<0 || tablepos.row>=nrows || tablepos.col<0 || tablepos.col>=ncols){ setCurrentItem(current.row,current.col,true); return 1; } // Change current item setCurrentItem(tablepos.row,tablepos.col,TRUE); // Select or deselect if(event->state&SHIFTMASK){ if(0<=anchor.row && 0<=anchor.col){ if(isItemEnabled(anchor.row,anchor.col)){ extendSelection(current.row,current.col,TRUE); } } else{ setAnchorItem(current.row,current.col); if(isItemEnabled(current.row,current.col)){ extendSelection(current.row,current.col,TRUE); } } //mode=MOUSE_SELECT; <== HERE } /* else if(event->state&CONTROLMASK){ if(isItemEnabled(current.row,current.col)){ // toggleItem(current.row,current.col,TRUE); } setAnchorItem(current.row,current.col); mode=MOUSE_SELECT; } */ else{ if(isItemEnabled(current.row,current.col)){ killSelection(TRUE); setAnchorItem(current.row,current.col); extendSelection(current.row,current.col,TRUE); } else{ setAnchorItem(current.row,current.col); } //mode=MOUSE_SELECT; <== HERE } flags&=~FLAG_UPDATE; flags|=FLAG_PRESSED; return 1; } return 0; } ======================================== I couldn''t find for the moment a patch that allows the user to extend his selection. Jeroen, maybe you have an idea? Best regards, Philippe Note: ----- To debug, I simply added a line in the TableWindows Fox test project: // Replaced long TableWindow::onTableReplaced(FXObject*,FXSelector,void* ptr){ FXTableRange *tr=(FXTableRange*)ptr; FXTRACE((10,"SEL_REPLACED fm.row=%d, fm.col=%d to.row=%d, to.col=%d\n",tr->fm.row,tr->fm.col,tr->to.row,tr->to.col)); FXMessageBox::error(this,MBOX_OK,"Error","This is a modal error message"); return 1; }