From philippe.lang at attiksystem.ch Mon May 4 11:27:08 2009 From: philippe.lang at attiksystem.ch (Philippe Lang) Date: Mon, 4 May 2009 17:27:08 +0200 Subject: [fxruby-users] FXTable, SEL_REPLACED and modal dialogs, 2nd References: Message-ID: 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; } From saratkongara at gmail.com Wed May 6 09:02:52 2009 From: saratkongara at gmail.com (Sarat Kongara) Date: Wed, 6 May 2009 18:32:52 +0530 Subject: [fxruby-users] Using ActiveRecord in FXRuby application Message-ID: <4c251b0d0905060602w198460bh8186decef88f6d7@mail.gmail.com> Hello, I am a newbie to FXRuby development. I like the fact that I can write the code in Ruby for cross-platform GUI development. I am developing a desktop application that needs to save some information to a database. I am using ActiveRecord for this purpose. My code works fine when I don't require fox16 and include Fox. But once I do that I get a bunch of warnings. Here is the sample code: require 'rubygems' require 'active_record' require File.expand_path(File.dirname(__FILE__) + "/question_set") # require 'fox16' # include Fox question_set = QuestionSet.new 3.times do question = Question.new 4.times do choice = Choice.new question.choices << choice end question_set.questions << question end question_set.save! QuestionSet, Question and Choice inherit from ActiveRecord::Base QuestionSet has many questions, Question has many choices. If I uncomment the following two lines # require 'fox16' # include Fox I get these warnings. /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations.rb:100: warning: instance variable @choices not initialized /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/database_statements.rb:116: warning: instance variable @transaction_joinable not initialized /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations.rb:100: warning: instance variable @questions not initialized /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations.rb:100: warning: instance variable @choices not initialized /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations.rb:100: warning: instance variable @choices not initialized /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations.rb:100: warning: instance variable @question_set not initialized /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations.rb:100: warning: instance variable @question not initialized /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations.rb:100: warning: instance variable @question not initialized /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations.rb:100: warning: instance variable @question not initialized /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations.rb:100: warning: instance variable @question not initialized /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations.rb:100: warning: instance variable @question_set not initialized /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations.rb:100: warning: instance variable @question not initialized /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations.rb:100: warning: instance variable @question not initialized /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations.rb:100: warning: instance variable @question not initialized /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations.rb:100: warning: instance variable @question not initialized /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations.rb:100: warning: instance variable @question_set not initialized /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations.rb:100: warning: instance variable @question not initialized /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations.rb:100: warning: instance variable @question not initialized /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations.rb:100: warning: instance variable @question not initialized /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations.rb:100: warning: instance variable @question not initialized I tried changing the sequence of require statements but I still get the same warnings. Has anybody been able to use ActiveRecord in FXRuby application? Any help/suggestion is really appreciated. Thanks for your time. Regards Sarat From lyle at lylejohnson.name Wed May 6 10:44:14 2009 From: lyle at lylejohnson.name (Lyle Johnson) Date: Wed, 6 May 2009 09:44:14 -0500 Subject: [fxruby-users] Using ActiveRecord in FXRuby application In-Reply-To: <4c251b0d0905060602w198460bh8186decef88f6d7@mail.gmail.com> References: <4c251b0d0905060602w198460bh8186decef88f6d7@mail.gmail.com> Message-ID: <38B7D35D-8842-46B9-9B0B-547EBDA36A34@lylejohnson.name> On May 6, 2009, at 8:02 AM, Sarat Kongara wrote: > My code works fine when I don't require fox16 and include Fox. But > once I do that I get a bunch of warnings. Since they are warning messages, they shouldn't be causing your program to fail (you just get a lot of noise in the console window). But I have a guess of what might fix it, if you can try something for me locally. For the purpose of this discussion, I'm going to assume that you've installed FXRuby via RubyGems, and that it's installed here: /opt/local/lib/ruby/gems/1.8/gems/fxruby-1.6.19 I want you to make changes to two lines in this file from the FXRuby installation: /opt/local/lib/ruby/gems/1.8/gems/fxruby-1.6.19/lib/fox16/kwargs.rb The first line I want you to change is line 3. It currently reads: $VERBOSE = nil and I want you to change it to: old_verbose = $VERBOSE; $VERBOSE = nil The other line I want you to change is line 2740 (the last line), which currently reads: $VERBOSE = true and I want you to change it to read: $VERBOSE = old_verbose When you've changed those two lines, try running your program again and let's see if that doesn't clear up all those warnings from ActiveRecord. Hope this helps, Lyle From saratkongara at gmail.com Wed May 6 11:17:35 2009 From: saratkongara at gmail.com (Sarat Kongara) Date: Wed, 6 May 2009 20:47:35 +0530 Subject: [fxruby-users] Using ActiveRecord in FXRuby application In-Reply-To: <38B7D35D-8842-46B9-9B0B-547EBDA36A34@lylejohnson.name> References: <4c251b0d0905060602w198460bh8186decef88f6d7@mail.gmail.com> <38B7D35D-8842-46B9-9B0B-547EBDA36A34@lylejohnson.name> Message-ID: <4c251b0d0905060817m1035364ct20d700ac1575e077@mail.gmail.com> Hi Lyle, Thanks for the quick response. I actually followed instructions from your FXRuby book (Create Lean and Mean GUIs with Ruby). I used the command: "sudo port install rb-fxruby" to install fxruby. I found the file kwargs.rb in this folder: /opt/local/lib/ruby/vendor_ruby/1.8/fox16 I made the changes you suggested and I don't see any warnings now. Earlier I also used to get a warning from rscribd gem code when I am using fox16, now that is gone too. Is it safe to ignore these warnings and keep the changes in the file kwargs.rb permanently? Thanks again. Regards Sarat On 5/6/09, Lyle Johnson wrote: > > On May 6, 2009, at 8:02 AM, Sarat Kongara wrote: > >> My code works fine when I don't require fox16 and include Fox. But >> once I do that I get a bunch of warnings. > > > > Since they are warning messages, they shouldn't be causing your > program to fail (you just get a lot of noise in the console window). > But I have a guess of what might fix it, if you can try something for > me locally. > > For the purpose of this discussion, I'm going to assume that you've > installed FXRuby via RubyGems, and that it's installed here: > > /opt/local/lib/ruby/gems/1.8/gems/fxruby-1.6.19 > > I want you to make changes to two lines in this file from the FXRuby > installation: > > /opt/local/lib/ruby/gems/1.8/gems/fxruby-1.6.19/lib/fox16/kwargs.rb > > The first line I want you to change is line 3. It currently reads: > > $VERBOSE = nil > > and I want you to change it to: > > old_verbose = $VERBOSE; $VERBOSE = nil > > The other line I want you to change is line 2740 (the last line), > which currently reads: > > $VERBOSE = true > > and I want you to change it to read: > > $VERBOSE = old_verbose > > When you've changed those two lines, try running your program again > and let's see if that doesn't clear up all those warnings from > ActiveRecord. > > Hope this helps, > > Lyle > > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users > From lyle at lylejohnson.name Wed May 6 12:08:08 2009 From: lyle at lylejohnson.name (Lyle Johnson) Date: Wed, 6 May 2009 11:08:08 -0500 Subject: [fxruby-users] Using ActiveRecord in FXRuby application In-Reply-To: <4c251b0d0905060817m1035364ct20d700ac1575e077@mail.gmail.com> References: <4c251b0d0905060602w198460bh8186decef88f6d7@mail.gmail.com> <38B7D35D-8842-46B9-9B0B-547EBDA36A34@lylejohnson.name> <4c251b0d0905060817m1035364ct20d700ac1575e077@mail.gmail.com> Message-ID: <3CE3B96D-599A-4024-8EC3-2C1499E568B7@lylejohnson.name> On May 6, 2009, at 10:17 AM, Sarat Kongara wrote: > I made the changes you suggested and I don't see any warnings now. Excellent. > Earlier I also used to get a warning from rscribd gem code when I am > using fox16, now that is gone too. OK. > Is it safe to ignore these warnings and keep the changes in the file > kwargs.rb permanently? Thanks again. Yes to both questions. I will implement this change in the next release of FXRuby, so when you upgrade to FXRuby 1.6.20 you won't need to re-patch your kwargs.rb file. Thanks for your help, Lyle From lyle at lylejohnson.name Thu May 14 12:13:48 2009 From: lyle at lylejohnson.name (Lyle Johnson) Date: Thu, 14 May 2009 11:13:48 -0500 Subject: [fxruby-users] fxruby 1.6.19 gem fails to find appropriate libpng library under Mac OS X 10.4.11 In-Reply-To: <726D5305-6486-42B6-862C-72507874D904@mit.edu> References: <726D5305-6486-42B6-862C-72507874D904@mit.edu> Message-ID: On May 11, 2009, at 6:07 PM, Ronald D. Mabbitt wrote: > I was curious -- is there a known issue with trying to use fxruby > gems under Mac OS X 10.4.11? After installing fxruby-1.6.19 via gem > under ruby 1.8.6, I'm getting load errors indicating that fxruby is > looking for the libpng library in /usr/X11/lib, when in fact Mac OS > X 10.4.11 doesn't even HAVE a /usr/X11/lib (only a /usr/X11R6/lib). > The place it should find the file is /sw/lib/, as I'm using Fink, > and /sw/lib is certainly in my PATH and LIBPATH variables. Here is > the actual error message: The FXRuby binary gem for OS X is built on my MacBook, which is running Leopard (10.5.x). So it's based on the Ruby that comes preinstalled with Leopard, and the X server that ships with that OS version, etc. So yes, you're going to need to either build it from source (with help from Fink for some of the dependencies). Hope this helps, Lyle From lyle at lylejohnson.name Mon May 18 11:47:26 2009 From: lyle at lylejohnson.name (Lyle Johnson) Date: Mon, 18 May 2009 10:47:26 -0500 Subject: [fxruby-users] FxRuby failing on Ruby 1.9.1 windows In-Reply-To: <9a0972ec0905171040j67cacc4fm729bf017f0d2679e@mail.gmail.com> References: <9a0972ec0905171040j67cacc4fm729bf017f0d2679e@mail.gmail.com> Message-ID: On May 17, 2009, at 12:40 PM, Janos Sebok wrote: > Hi all. > > I am new to FxRuby, and trying to install the toolkit. > > I'm running winXP > >ruby -v > ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-mswin32] > > >gem -v > 1.3.3 > > >gem list > > *** LOCAL GEMS *** > > fxruby (1.6.19) > rubygems-update (1.3.3) > > --- > My problem is: require 'fox16' fails with a OS error message > complaining > "Can not start application because msvcrt-ruby18.dll is not found". > After closing the error window the console reads: > > >ruby test.rb > test.rb:2:in `require': 126: A megadott modul nem talalhato(which > means module not found). - d:/Ruby/Vm/1.9.1-p0/lib/ruby/gems/1.9.1/ > gems/fxruby-1.6 > .19-x86-mswin32-60/ext/fox16/fox16.so (LoadError) > from test.rb:2:in `
' > > fox16.so is right where it is looked for, but it is linking to > msvcrt-ruby18.dll. > Of course the 1.8 dll is not present. What may cause this? I > remember to have read FxRuby is Ruby 1.9 compatible for a while. The FXRuby source code is compatible with Ruby 1.9; it can be compiled for use with Ruby 1.9. The FXRuby binary gem for Windows is built for use with the One-Click Installer for Ruby (on Windows), which is based on Ruby 1.8.6. If you need a version of FXRuby that works with your Ruby 1.9 on Windows, you'll need to compile it yourself (or get someone else to). > The very same gem works just fine on Ruby 1.8.7-p72. Yes, this is not too surprising, since there were few ABI changes between Ruby 1.8.6 and Ruby 1.8.7. From mfalcon at me.com Thu May 21 18:44:06 2009 From: mfalcon at me.com (Micheal Falcon) Date: Thu, 21 May 2009 17:44:06 -0500 Subject: [fxruby-users] List Box Question Message-ID: <64362644268469927810208662063227473033-Webmail@me.com> Hi, I'm new to this list and new to FXRuby. I have been building an app for work that is using listboxes. I have one listbox that has 300 options. I have been digging around but cannot seem to find any solution to implement auto-complete typing. Is there a solution in FXRuby, if not has there been any talk of one in developement? Thanks Mike