From llasram at gmail.com Mon Feb 1 09:28:33 2010 From: llasram at gmail.com (Marshall T. Vandegrift) Date: Mon, 1 Feb 2010 09:28:33 -0500 Subject: [fxruby-users] Accelerators on Tab and FXText Message-ID: Hi, I've found what seems to be a bug, although I'm not sure whether in Fox, FXRuby, or my use thereof. The issue is that when an FXText widget has focus, keyboard accelerators bound on the "Tab" key are "hijacked" by the FXText widget. At least on my system, Shift+Tab is actually Shift+ISO_Left_Tab, so in effect this means just Ctrl+Tab is so affected. The code which follows should demonstrate the issue: the accelerators on Ctrl+N and Ctrl+Shift+Tab work and print messages on the console when either the text box or button has focus, but the accelerator on Ctrl+Tab only invokes it's handler when the button has focus. I'm running fxruby 1.6.20 and libfox 1.6.36-1 (Debian testing). Any suggestions appreciated. Thanks! -Marshall Code follows: require 'fox16' include Fox class AcceleratorBug < FXMainWindow include Responder ID_CTRL_N = ID_LAST + 1 ID_CTRL_TAB = ID_CTRL_N + 1 ID_CTRL_SHIFT_TAB = ID_CTRL_TAB + 1 def initialize(app) super(app, "Accelerator Bug") frame = FXVerticalFrame.new(self, LAYOUT_FILL) FXText.new(frame, :opts => LAYOUT_FILL | LAYOUT_SIDE_TOP) FXButton.new(frame, "whatever", :opts => LAYOUT_FILL_X) FXMAPFUNC(SEL_COMMAND, ID_CTRL_N, :on_ctrl_n) accelTable.addAccel(fxparseAccel("Ctrl+N"), self, FXSEL(SEL_COMMAND, ID_CTRL_N)) FXMAPFUNC(SEL_COMMAND, ID_CTRL_TAB, :on_ctrl_tab) accelTable.addAccel(fxparseAccel("Ctrl+Tab"), self, FXSEL(SEL_COMMAND, ID_CTRL_TAB)) accelTable.addAccel(fxparseAccel("Alt+Tab"), self, FXSEL(SEL_COMMAND, ID_CTRL_TAB)) FXMAPFUNC(SEL_COMMAND, ID_CTRL_SHIFT_TAB, :on_ctrl_shift_tab) accelTable.addAccel(fxparseAccel("Ctrl+Shift+Tab"), self, FXSEL(SEL_COMMAND, ID_CTRL_SHIFT_TAB)) accelTable.addAccel(Fox.MKUINT(KEY_ISO_Left_Tab, CONTROLMASK | SHIFTMASK), self, FXSEL(SEL_COMMAND, ID_CTRL_SHIFT_TAB)) end def on_ctrl_n(sender, sel, data) puts "You pushed Ctrl+N!" end def on_ctrl_tab(sender, sel, data) puts "You pushed Ctrl+Tab!" end def on_ctrl_shift_tab(sender, sel, data) puts "You pushed Ctrl+Shift+Tab!" end def self.main(argv=ARGV) app = FXApp.new window = AcceleratorBug.new(app) app.create window.show app.run return 0 end end if __FILE__ == $0 exit(AcceleratorBug::main) end From lyle at lylejohnson.name Thu Feb 18 09:09:58 2010 From: lyle at lylejohnson.name (Lyle Johnson) Date: Thu, 18 Feb 2010 08:09:58 -0600 Subject: [fxruby-users] FXRuby and Ruby 1.9 In-Reply-To: <601f3c47374d758e78715ecb9937cea2@ruby-forum.com> References: <601f3c47374d758e78715ecb9937cea2@ruby-forum.com> Message-ID: <57cf8f721002180609s2f5284b8w2232d83384cf27ee@mail.gmail.com> On Thu, Feb 18, 2010 at 7:04 AM, Alex DeCaria wrote: > Forgive the post to this forum. ?The FXRuby forum doesn't seem to be > very active. Not sure what forum you're talking about, but as noted on the FXRuby home page, we have a mailing list for questions like these: http://www.fxruby.org/community.html I'm pretty sure you didn't post there (or maybe I just missed this question). > I'm running a script to open a file dialog window. ?The script works > fine in Ruby 1.8. ?In 1.9 the dialog box still opens and works, but I > get a list of 44 error messages in the command window before it opens > (the same two error messages repeated 22 times). ?The error messages > are: > > FXCursor.cpp(281): FXASSERT(GetSystemMetrics(SM_CXCURSOR)==32) failed. > FXCursor.cpp(282): FXASSERT(GetSystemMetrics(SM_CYCURSOR)==32) failed. > > Any ideas why this may be happening? ?I'm on a Windows 7 Professional, > 64-bit OS. I've already seen your follow-up e-mail, but yes, it appears to be a difference between 32-bit and 64-bit Windows. This may be something that can be fixed in the FOX library; it's not really anything that can be addressed in the FXRuby layer. Hope this helps, Lyle From tester.paul at gmail.com Tue Feb 23 13:16:18 2010 From: tester.paul at gmail.com (Paul Carvalho) Date: Tue, 23 Feb 2010 13:16:18 -0500 Subject: [fxruby-users] GUI Layout question Message-ID: <37c405481002231016q4402233dsf0b73400f23e5f5d@mail.gmail.com> Hi there, I'm new to FXRuby and programming in general. I'm trying to create a simple layout with only 2 elements in the window: a tabbook and a statusbar. I can get these 2 items in the window, but I'm having a bit of difficulty getting the tabbook to take up the whole top part of the window -- i.e. to resize to fit_x and fit_y, but don't overlap the statusbar (on the bottom). I downloaded foxGUIb 1.0.0 to see if it can help me sort out the UI elements but I haven't figured it out yet. I think I'm still missing something. Here's what I've tried so far: Attempt 1: ----- MainWindow - horizontalFrame1 -- Switcher --- TabBook ---- TabItem1 ---- VerticalFrame1 ----- button1 - StatusBar ----- => When I set the horizontalFrame layout properties to FILL_X and FILL_Y, it fills the whole window going behind (or in front of) the status bar. I don't want it to do that. I want it to stop at/above the status bar. In Attempt 2, I tried with 2 horizontal frames - putting the status bar in the second hFrame, but I couldn't seem to make it so the 2 horizontal frames play nicely together in the window. The first hFrame always fills the whole window hiding the second hFrame behind it. I then removed the hFrames and played with the the Layout settings for just the Switcher but I get the same effect - it fills the whole window and goes behind the status bar but I want it to stop just above it. Any suggestions? I'm using Ruby 1.8.6 and Fox 1.6.28. Paul. -------------- next part -------------- An HTML attachment was scrubbed... URL: From matma.rex at gmail.com Tue Feb 23 15:42:02 2010 From: matma.rex at gmail.com (=?UTF-8?Q?Bartosz_Dziewo=C5=84ski?=) Date: Tue, 23 Feb 2010 21:42:02 +0100 Subject: [fxruby-users] GUI Layout question In-Reply-To: <37c405481002231016q4402233dsf0b73400f23e5f5d@mail.gmail.com> References: <37c405481002231016q4402233dsf0b73400f23e5f5d@mail.gmail.com> Message-ID: 2010/2/23 Paul Carvalho : > Hi there, I'm new to FXRuby and programming in general.? I'm trying to > create a simple layout with only 2 elements in the window: a tabbook and a > statusbar. Add statusbar first and make it go to the bottom of window (LAYOUT_SIDE_BOTTOM IIRC), then add the tabbook and make it fill what is left (LAYOUT_FILL). -- Matma Rex - http://matma-rex.prv.pl/ From tester.paul at gmail.com Tue Feb 23 16:28:36 2010 From: tester.paul at gmail.com (Paul Carvalho) Date: Tue, 23 Feb 2010 16:28:36 -0500 Subject: [fxruby-users] GUI Layout question In-Reply-To: References: <37c405481002231016q4402233dsf0b73400f23e5f5d@mail.gmail.com> Message-ID: <37c405481002231328o6c638d0fsc90e90d6662e4daf@mail.gmail.com> That worked! Wow. I never would have guessed that changing the order would make a difference. Thanks. 2010/2/23 Bartosz Dziewo?ski > > Add statusbar first and make it go to the bottom of window > (LAYOUT_SIDE_BOTTOM IIRC), then add the tabbook and make it fill what > is left (LAYOUT_FILL). > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tester.paul at gmail.com Tue Feb 23 16:45:43 2010 From: tester.paul at gmail.com (Paul Carvalho) Date: Tue, 23 Feb 2010 16:45:43 -0500 Subject: [fxruby-users] Enabling/disabling checkbuttons Message-ID: <37c405481002231345t1fc708cax555147c04db44dc1@mail.gmail.com> Hi there, I have some nested check boxes (checkbuttons) in a group that I want to enable/disable based on when another checkbutton is set. This is what I want to do.. (1) Before/unchecked - sub item disabled: ----- [ ] include options? [ ] _sub-checkbox_ (greyed/disabled) ----- (2) After/checked - sub item enabled: ----- [v] include options? [ ] sub-checkbox (enabled) ----- I googled for help or examples but didn't find anything. Suggestions? -------------- next part -------------- An HTML attachment was scrubbed... URL: From matma.rex at gmail.com Thu Feb 25 03:31:26 2010 From: matma.rex at gmail.com (=?UTF-8?Q?Bartosz_Dziewo=C5=84ski?=) Date: Thu, 25 Feb 2010 09:31:26 +0100 Subject: [fxruby-users] Enabling/disabling checkbuttons In-Reply-To: <37c405481002231345t1fc708cax555147c04db44dc1@mail.gmail.com> References: <37c405481002231345t1fc708cax555147c04db44dc1@mail.gmail.com> Message-ID: 2010/2/23 Paul Carvalho : > Hi there, > > I have some nested check boxes (checkbuttons) in a group that I want to > enable/disable based on when another checkbutton is set. Just connect event handler to the main one and make it gray/degray the other one. -- Matma Rex - http://matma-rex.prv.pl/ From tester.paul at gmail.com Thu Feb 25 12:17:21 2010 From: tester.paul at gmail.com (Paul Carvalho) Date: Thu, 25 Feb 2010 12:17:21 -0500 Subject: [fxruby-users] Enabling/disabling checkbuttons In-Reply-To: References: <37c405481002231345t1fc708cax555147c04db44dc1@mail.gmail.com> Message-ID: <37c405481002250917u3a570backf1c43a7c30001dcf@mail.gmail.com> 2010/2/25 Bartosz Dziewo?ski wrote: > > I have some nested check boxes (checkbuttons) in a group that I want to > > enable/disable based on when another checkbutton is set. > > Just connect event handler to the main one and make it gray/degray the > other one. > > Sorry, I'm a beginner. Do you know if there are any example scripts that show this behaviour? To be honest, I have no idea how to do what you describe. I googled for hours to try and find something to help me. I even skimmed through the FXRuby book but didn't find an example like this. Granted, I haven't read the whole book yet, so it's possible the answer might be in there somewhere. To make it more interesting, I actually want to do this twice in the same list. That is: ----- [ ] include all (enables/disables all below) [] item 1 [] item 2, include sub-list (enables/disables nested sub-items) [] sub-item 1 [] sub-item 2 [] item 3 ----- Thanks for the reply. Cheers! Paul. -------------- next part -------------- An HTML attachment was scrubbed... URL: From matma.rex at gmail.com Thu Feb 25 14:34:18 2010 From: matma.rex at gmail.com (=?UTF-8?Q?Bartosz_Dziewo=C5=84ski?=) Date: Thu, 25 Feb 2010 20:34:18 +0100 Subject: [fxruby-users] Enabling/disabling checkbuttons In-Reply-To: <37c405481002250917u3a570backf1c43a7c30001dcf@mail.gmail.com> References: <37c405481002231345t1fc708cax555147c04db44dc1@mail.gmail.com> <37c405481002250917u3a570backf1c43a7c30001dcf@mail.gmail.com> Message-ID: Here: http://pastebin.com/rPKJLC9r (I hate pasting code into emails) Actually, disabling something turned out to be more complicated than I thought, so I borrowed a bit of code from http://www.fxruby.org/examples/scribble.rb. Sorry for confusing you. -- Matma Rex - http://matma-rex.prv.pl/ From tester.paul at gmail.com Fri Feb 26 11:01:03 2010 From: tester.paul at gmail.com (Paul Carvalho) Date: Fri, 26 Feb 2010 11:01:03 -0500 Subject: [fxruby-users] Enabling/disabling checkbuttons In-Reply-To: References: <37c405481002231345t1fc708cax555147c04db44dc1@mail.gmail.com> <37c405481002250917u3a570backf1c43a7c30001dcf@mail.gmail.com> Message-ID: <37c405481002260801we04cde5t86ebdd76aa7331d6@mail.gmail.com> Terrific! Thank you for the example. It gives me enough to learn from and play with. Thanks. Have a great weekend! 2010/2/25 Bartosz Dziewo?ski > Here: http://pastebin.com/rPKJLC9r (I hate pasting code into emails) > > Actually, disabling something turned out to be more complicated than I > thought, so I borrowed a bit of code from > http://www.fxruby.org/examples/scribble.rb. Sorry for confusing you. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From stuart_clarke86 at yahoo.com Fri Feb 26 14:38:06 2010 From: stuart_clarke86 at yahoo.com (Stuart Clarke) Date: Fri, 26 Feb 2010 19:38:06 +0000 (GMT) Subject: [fxruby-users] Class with looping objects Message-ID: <639320.47948.qm@web86602.mail.ird.yahoo.com> Hi all, Apologies if this is a stupid question but it is getting the best of me. I have a class which contains a GUI object which has serveral text fields and buttons which when used trigger the use of further objects which all loop through data, the structure is as follows: class def GUI GUI calls object1 end def object1 loops through some data one entry at a time and for each entry passes to a new object end def object2 loops through passed data and does stuff end then the next bit of data does the same thing in object1 What I need is a gui that pops up when my script runs through all of objects for each bit of data. Any ideas? I just need to know when the loop is complete, at present I press the go button on my fx GUI and it stays pressed in until all processing is done then pops back out. At this point I need a Gui. I hope this makes sense, Many thanks From wbparsons at cshore.com Fri Feb 26 20:39:50 2010 From: wbparsons at cshore.com (Will Parsons) Date: Fri, 26 Feb 2010 20:39:50 -0500 (EST) Subject: [fxruby-users] Accessing SQLite database in FXRuby application Message-ID: <20100226.203950.02305108.wbparsons@cshore.com> I'm trying to develop an application that accesses an SQLite database and am running into problems related to using getApp (probably because of some simple misunderstanding of how FXRuby works on my part). The following is a stripped-down version of my (non-functioning) program: ======================================================================== #!/usr/bin/env ruby require 'fox16' require 'sqlite3' include Fox class TestApp < FXApp def initialize super('Test', 'Test') @db = SQLite3::Database.new('test.db3') @db || raise("can't connect to database") end def db @db end end class TestTable < FXTable def initialize(p) super(p, :opts => LAYOUT_FILL|PACK_UNIFORM_WIDTH|TABLE_COL_SIZABLE) db = getApp.db db || raise("can't access DB") # <---- this condition is raised setTableSize(3, 3) # fill table with data from database... end end class TopLevelWindow < FXMainWindow def initialize(app) super(app, 'Test', :width => 400, :height => 100) TestTable.new(self) end def create super show(PLACEMENT_SCREEN) end end TestApp.new do |app| TopLevelWindow.new(app) app.create app.run end ======================================================================== When run, the condition "can't access DB" is raised. This is probably simple, but I can't seem to figure out what I'm doing wrong. -- Will From natarajsn at gmail.com Sat Feb 27 05:39:22 2010 From: natarajsn at gmail.com (Nataraj S Narayan) Date: Sat, 27 Feb 2010 16:09:22 +0530 Subject: [fxruby-users] Accessing SQLite database in FXRuby application In-Reply-To: <20100226.203950.02305108.wbparsons@cshore.com> References: <20100226.203950.02305108.wbparsons@cshore.com> Message-ID: <630286c71002270239w310e737bj125897a2c7d95ebf@mail.gmail.com> Hi Should'nt it be like this? class TestApp < FXApp def initialize super('Test', 'Test') end def db @db = SQLite3::Database.new('test.db3') @db || raise("can't connect to database") end end regards Nataraj On Sat, Feb 27, 2010 at 7:09 AM, Will Parsons wrote: > I'm trying to develop an application that accesses an SQLite database and > am running into problems related to using getApp (probably because of some > simple misunderstanding of how FXRuby works on my part). The following is > a stripped-down version of my (non-functioning) program: > > ======================================================================== > #!/usr/bin/env ruby > > require 'fox16' > require 'sqlite3' > > include Fox > > class TestApp < FXApp > def initialize > super('Test', 'Test') > @db = SQLite3::Database.new('test.db3') > @db || raise("can't connect to database") > end > > def db > @db > end > end > > class TestTable < FXTable > def initialize(p) > super(p, :opts => LAYOUT_FILL|PACK_UNIFORM_WIDTH|TABLE_COL_SIZABLE) > > db = getApp.db > db || raise("can't access DB") # <---- this condition is raised > > setTableSize(3, 3) > # fill table with data from database... > end > end > > class TopLevelWindow < FXMainWindow > def initialize(app) > super(app, 'Test', :width => 400, :height => 100) > TestTable.new(self) > end > > def create > super > show(PLACEMENT_SCREEN) > end > end > > TestApp.new do |app| > TopLevelWindow.new(app) > app.create > app.run > end > > ======================================================================== > > When run, the condition "can't access DB" is raised. This is probably simple, > but I can't seem to figure out what I'm doing wrong. > > -- > Will > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users > From jkinsella at ancillaryservices.com Sat Feb 27 09:34:04 2010 From: jkinsella at ancillaryservices.com (Joey Kinsella) Date: Sat, 27 Feb 2010 09:34:04 -0500 Subject: [fxruby-users] Accessing SQLite database in FXRuby application In-Reply-To: <20100226.203950.02305108.wbparsons@cshore.com> References: <20100226.203950.02305108.wbparsons@cshore.com> Message-ID: <39b4b9791002270634n666f1549v863bd6e32a95e327@mail.gmail.com> Try changing the following block: TestApp.new do |app| TopLevelWindow.new(app) app.create app.run end to: app = TestApp.new TopLevelWindow.new(app) app.create app.run I think (but I could be mistaken) when you pass a block to FXApp.new it's more like this: if block_given? yield(FXApp.new(name, vendor)) else # .... end If this is the case, then @db would never get initialized, since the overloaded initialized method would never be called. On Fri, Feb 26, 2010 at 8:39 PM, Will Parsons wrote: > I'm trying to develop an application that accesses an SQLite database and > am running into problems related to using getApp (probably because of some > simple misunderstanding of how FXRuby works on my part). The following is > a stripped-down version of my (non-functioning) program: > > ======================================================================== > #!/usr/bin/env ruby > > require 'fox16' > require 'sqlite3' > > include Fox > > class TestApp < FXApp > def initialize > super('Test', 'Test') > @db = SQLite3::Database.new('test.db3') > @db || raise("can't connect to database") > end > > def db > @db > end > end > > class TestTable < FXTable > def initialize(p) > super(p, :opts => LAYOUT_FILL|PACK_UNIFORM_WIDTH|TABLE_COL_SIZABLE) > > db = getApp.db > db || raise("can't access DB") # <---- this condition is raised > > setTableSize(3, 3) > # fill table with data from database... > end > end > > class TopLevelWindow < FXMainWindow > def initialize(app) > super(app, 'Test', :width => 400, :height => 100) > TestTable.new(self) > end > > def create > super > show(PLACEMENT_SCREEN) > end > end > > TestApp.new do |app| > TopLevelWindow.new(app) > app.create > app.run > end > > ======================================================================== > > When run, the condition "can't access DB" is raised. This is probably > simple, > but I can't seem to figure out what I'm doing wrong. > > -- > Will > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users > -- If you are not the intended recipient, you are hereby notified that any dissemination, distribution, copying or other use of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately. -------------- next part -------------- An HTML attachment was scrubbed... URL: From wbparsons at cshore.com Sat Feb 27 10:21:39 2010 From: wbparsons at cshore.com (Will Parsons) Date: Sat, 27 Feb 2010 10:21:39 -0500 (EST) Subject: [fxruby-users] Accessing SQLite database in FXRuby application In-Reply-To: <630286c71002270239w310e737bj125897a2c7d95ebf@mail.gmail.com> References: <20100226.203950.02305108.wbparsons@cshore.com> <630286c71002270239w310e737bj125897a2c7d95ebf@mail.gmail.com> Message-ID: <20100227.102139.02304561.wbparsons@cshore.com> From: Nataraj S Narayan Subject: Re: [fxruby-users] Accessing SQLite database in FXRuby application Date: Sat, 27 Feb 2010 16:09:22 +0530 > Hi > > Should'nt it be like this? > > > class TestApp < FXApp > def initialize > super('Test', 'Test') > > > end > > def db > @db = SQLite3::Database.new('test.db3') > @db || raise("can't connect to database") > end > end I don't think so, since that would give me a different database connexion each time I invoke getApp.db, but that gave me the idea that a slight variation might work: class TestApp < FXApp #... def db @db ||= SQLite3::Database.new('test.db3') @db || raise("can't connect to database") end end It looks like that should defer opening the database until it is actually needed and keep the handle for later invocations. Still, it seems less straightforward than opening the database as part of the application initialization. Thanks for the suggestion. > > On Sat, Feb 27, 2010 at 7:09 AM, Will Parsons wrote: > > I'm trying to develop an application that accesses an SQLite database and > > am running into problems related to using getApp (probably because of some > > simple misunderstanding of how FXRuby works on my part). The following is > > a stripped-down version of my (non-functioning) program: > > > > ======================================================================== > > #!/usr/bin/env ruby > > > > require 'fox16' > > require 'sqlite3' > > > > include Fox > > > > class TestApp < FXApp > > def initialize > > super('Test', 'Test') > > @db = SQLite3::Database.new('test.db3') > > @db || raise("can't connect to database") > > end > > > > def db > > @db > > end > > end > > > > class TestTable < FXTable > > def initialize(p) > > super(p, :opts => LAYOUT_FILL|PACK_UNIFORM_WIDTH|TABLE_COL_SIZABLE) > > > > db = getApp.db > > db || raise("can't access DB") # <---- this condition is raised > > > > setTableSize(3, 3) > > # fill table with data from database... > > end > > end > > > > class TopLevelWindow < FXMainWindow > > def initialize(app) > > super(app, 'Test', :width => 400, :height => 100) > > TestTable.new(self) > > end > > > > def create > > super > > show(PLACEMENT_SCREEN) > > end > > end > > > > TestApp.new do |app| > > TopLevelWindow.new(app) > > app.create > > app.run > > end > > > > ======================================================================== > > > > When run, the condition "can't access DB" is raised. This is probably simple, > > but I can't seem to figure out what I'm doing wrong. From wbparsons at cshore.com Sat Feb 27 10:37:04 2010 From: wbparsons at cshore.com (William B. Parsons) Date: Sat, 27 Feb 2010 10:37:04 -0500 Subject: [fxruby-users] Accessing SQLite database in FXRuby application In-Reply-To: <39b4b9791002270634n666f1549v863bd6e32a95e327@mail.gmail.com> References: <20100226.203950.02305108.wbparsons@cshore.com> <39b4b9791002270634n666f1549v863bd6e32a95e327@mail.gmail.com> Message-ID: <20100227103704.5f721f08.wbparsons@cshore.com> On Sat, 27 Feb 2010 09:34:04 -0500 Joey Kinsella wrote: > Try changing the following block: > > TestApp.new do |app| > TopLevelWindow.new(app) > app.create > app.run > end > > to: > > app = TestApp.new > TopLevelWindow.new(app) > app.create > app.run > > I think (but I could be mistaken) when you pass a block to FXApp.new it's > more like this: > > if block_given? > yield(FXApp.new(name, vendor)) > else > # .... > end > > If this is the case, then @db would never get initialized, since the > overloaded initialized method would never be called. Thanks! That does indeed seem to be the case, so it looks like I have a solution. -- Will