From lyle at lylejohnson.name Sat Dec 1 17:34:39 2007 From: lyle at lylejohnson.name (Lyle Johnson) Date: Sat, 1 Dec 2007 16:34:39 -0600 Subject: [fxruby-users] FOX on Mac OS 10.5.1 (Leopard) Message-ID: All, Apparently, the X11 server shipped with Mac OS 10.5 (Leopard) is pretty broken. This has several adverse affects on FOX under Leopard. Fortunately, the Xquartz project is providing more up-to-date builds which seem to work better. Visit this page: http://trac.macosforge.org/projects/xquartz and download their latest pre-built binary for Xquartz (the X server application) and then replace the stock X server with this one: bunzip ~/Downloads/Xquartz-1.3a1.bz2 sudo cp ~/Downloads/Xquartz-1.3a1 /usr/X11/bin/Xquartz I think you'll find that FOX works much better after this change! Hope this helps, Lyle From philippe.lang at attiksystem.ch Tue Dec 4 02:48:37 2007 From: philippe.lang at attiksystem.ch (Philippe Lang) Date: Tue, 4 Dec 2007 08:48:37 +0100 Subject: [fxruby-users] FXApp & Time localization Message-ID: <6C0CF58A187DA5479245E0830AF84F4218CF9D@poweredge.attiksystem.ch> Hi, Here is small test program: ---------------- require 'rubygems' require 'fox16' puts Time.now $app = Fox::FXApp.new puts Time.now ---------------- Here is what it gives on my computer: ---------------- Tue Dec 04 08:40:14 +0100 2007 mar. d?c. 04 08:40:14 +0100 2007 ---------------- After FXApp is instanciated, the Time class is suddenly being localized, and this breaks a few things elsewhere is my program. I'm a french speaker, and second line means that the week day is "mardi", and month is "d?cembre". Unfortunately, "?" is not printed correctly in my windows console. You get this "?" instead. Can anyone tell me me what happens here? Is there a workaround? Philippe From philippe.lang at attiksystem.ch Tue Dec 4 03:53:29 2007 From: philippe.lang at attiksystem.ch (Philippe Lang) Date: Tue, 4 Dec 2007 09:53:29 +0100 Subject: [fxruby-users] FXApp & Time localization References: <6C0CF58A187DA5479245E0830AF84F4218CF9D@poweredge.attiksystem.ch> Message-ID: <6C0CF58A187DA5479245E0830AF84F42337F0E@poweredge.attiksystem.ch> Philippe Lang wrote: > Hi, > > Here is small test program: > > ---------------- > require 'rubygems' > require 'fox16' > > puts Time.now > > $app = Fox::FXApp.new > > puts Time.now > ---------------- > > Here is what it gives on my computer: > > ---------------- > Tue Dec 04 08:40:14 +0100 2007 > mar. d?c. 04 08:40:14 +0100 2007 > ---------------- > > After FXApp is instanciated, the Time class is suddenly being > localized, and this breaks a few things elsewhere in my program. > > I'm a french speaker, and second line means that the week day is > "mardi", and month is "d?cembre". Unfortunately, "?" is not printed > correctly in my windows console. You get this "?" instead. > > Can anyone tell me me what happens here? Is there a workaround? I have found a workaround with class DateTime, instead of Time: ---------------- require 'rubygems' require 'fox16' puts DateTime.now $app = Fox::FXApp.new puts DateTime.now ---------------- This gives: ---------------- 2007-12-04T09:23:35+01:00 2007-12-04T09:23:35+01:00 ---------------- ... which looks better! Philippe From lyle.johnson at gmail.com Tue Dec 4 12:16:11 2007 From: lyle.johnson at gmail.com (Lyle Johnson) Date: Tue, 4 Dec 2007 11:16:11 -0600 Subject: [fxruby-users] FxRuby In-Reply-To: <3250c4c746d56c56635b5c68b4824e64@ruby-forum.com> References: <3250c4c746d56c56635b5c68b4824e64@ruby-forum.com> Message-ID: On Dec 4, 2007, at 9:58 AM, Ernst Tanaka wrote: > I have managed to build a demo screen with FoxGui (see below), but > I am > struggling to write a program that handles this window. > > Let the program handle the following actions. > At Init move value '1' to button one, '2' to button '2' and '3' to > button '3', 'a' to text1, 'b' to text2 and 'c' to text3. The code is difficult to follow because (1) it was automatically generated and (2) it uses a lot of non-standard APIs. If you're asking how to change the label text for an FXButton or FXTextField widget, however, you can use: @button1.text = "1" @button2.text = "2" @button3.text = "3" @text1.text = "a" @text2.text = "b" @text3.text = "c" > On click of button1. Swap the strings from button2 and button3 and > text2 > and text3. @button1.connect(SEL_COMMAND) do tmp = @button2.text @button2.text = @button3.text @button3.text = tmp tmp = @text2.text @text2.text = @text3.text @text3.text = tmp end > On click of button2. swap the strings from button1 and button3 plus > text1 and text3. @button2.connect(SEL_COMMAND) do tmp = @button1.text @button1.text = @button3.text @button3.text = tmp tmp = @text1.text @text1.text = @text3.text @text3.text = tmp end > On click of button3. swap 1 and 2. @button3.connect(SEL_COMMAND) do tmp = @button1.text @button1.text = @button2.text @button2.text = tmp tmp = @text1.text @text1.text = @text2.text @text2.text = tmp end > A picture is worth a 1000 words equals to an example hold the value > of a > book. Keep your feet on the ground, but keeping reaching for the stars. > Thanks a million in advance. Hope this helps, Lyle From lyle at lylejohnson.name Wed Dec 5 10:31:07 2007 From: lyle at lylejohnson.name (Lyle Johnson) Date: Wed, 5 Dec 2007 09:31:07 -0600 Subject: [fxruby-users] [Foxgui-users] Stopping a FOX popup window In-Reply-To: <03B62622BF273442912A2E486B799DD2058299F7@AEROMSG3.AERO.BALL.COM> References: <03B62622BF273442912A2E486B799DD2058299F7@AEROMSG3.AERO.BALL.COM> Message-ID: <57cf8f720712050731n7cedf3d4g6eb1814862219d17@mail.gmail.com> On 12/4/07, Thomas, Jason M (Software) wrote: > I'm using the FXRuby bindings to FOX and trying to use the unit test > framework to do some testing. I've been able to create and tear down my FOX > applications successfully but I'm having trouble programmatically closing a > dialog box. I've tried (FXApp) stop and stopModal but they don't seem to > have any effect. Closing and destroying the window works but the code is > still stuck in the application loop. Your code doesn't create a dialog box, it creates a second main window. Is that what you meant to do? At any rate, you should be able to break out of the runPopup() loop by calling hide() on the window: def test_exception_popup() Thread.new do sleep(2) app = FXApp.instance app.activeWindow.hide end ... end Hope this helps, Lyle From lyle at lylejohnson.name Wed Dec 5 10:43:57 2007 From: lyle at lylejohnson.name (Lyle Johnson) Date: Wed, 5 Dec 2007 09:43:57 -0600 Subject: [fxruby-users] FXApp & Time localization In-Reply-To: <6C0CF58A187DA5479245E0830AF84F4218CF9D@poweredge.attiksystem.ch> References: <6C0CF58A187DA5479245E0830AF84F4218CF9D@poweredge.attiksystem.ch> Message-ID: <57cf8f720712050743k183fa365q3ad29a8624d0fd17@mail.gmail.com> On 12/4/07, Philippe Lang wrote: > After FXApp is instanciated, the Time class is suddenly being localized, > and this breaks a few things elsewhere is my program. > > Can anyone tell me me what happens here? Is there a workaround? You are correct that when the FXApp instance is initialized, it calls the setlocale() function (from the C library) to set the locale to the native environment (presumably, "fr-FR" in your case). Then Ruby's Time class uses the strftime() function from the C library to provide the stringified version of the time, and strftime() uses the current locale in that process. So that's why you're getting localized day and month names. I know that you've already found a workaround, using the DateTime class instead of the Time class, but I *think* another workaround would be to set the LC_ALL environment variable to "en_US" (or some other English-language locale). Then, when FOX calls setlocale(), it would pick up this value instead of the default "fr_FR" value that it's currently getting. Hope this helps, Lyle From lyle at lylejohnson.name Wed Dec 5 13:14:02 2007 From: lyle at lylejohnson.name (Lyle Johnson) Date: Wed, 5 Dec 2007 12:14:02 -0600 Subject: [fxruby-users] [Foxgui-users] Stopping a FOX popup window In-Reply-To: <03B62622BF273442912A2E486B799DD2058299FA@AEROMSG3.AERO.BALL.COM> References: <03B62622BF273442912A2E486B799DD2058299F7@AEROMSG3.AERO.BALL.COM> <57cf8f720712050731n7cedf3d4g6eb1814862219d17@mail.gmail.com> <03B62622BF273442912A2E486B799DD2058299FA@AEROMSG3.AERO.BALL.COM> Message-ID: <57cf8f720712051014s4b316c7ele7ee8e068b0464c3@mail.gmail.com> On 12/5/07, Thomas, Jason M (Software) wrote: > That worked great! I'm just curious why I was going down the wrong path. > Was it because I called runPopup with a FXMainWindow? Yes. > Does runPopup only work with a FXPopup? Well, it's only meant to work with popups, but since it accepts an FXWindow argument, you can (as you discovered) pass in any kind of window. runPopup() is one of those methods that I think probably shouldn't be public, because it's really sort of a special purpose method that FOX only uses internally (as best I can tell). Maybe Jeroen will interject with some words of wisdom on this point. ;) > When should FXApp.stop be called? stop() breaks out of all of the (possibly many) nested event loops, to the very top one, which eventually causes your program to fall out of the top-level run(). > I tried the following: > popup = FXPopup.new(window) > popup.popup(nil, 0, 0) > application.runPopup(popup) > > At this point the popup window appeared. Then in my other thread I did: > sleep(2) > app = FXApp.instance > app.stop > > This results in a Segmentation fault. Any ideas? Well, I'm not really sure what it is that you're trying to do. For example, I don't understand why you've fixated on popups (which are primarily used for things like tooltips and menu panes). But since runPopup() starts a modal event loop for the popup window, the way to shut it down would be to either call stopModal(), or to just hide the popup (as I showed earlier). If you're wanting to display a little informational message to the user, I think you want to take a look at FXMessageBox. Or maybe FXDialogBox, if FXMessageBox doesn't quite give you all of the control that you need. > Thanks again for helping me. Right now I'm just trying to understand how > FOX works. No problem! We're all learning. ;) From jeroen at fox-toolkit.org Wed Dec 5 15:09:56 2007 From: jeroen at fox-toolkit.org (Jeroen van der Zijp) Date: Wed, 5 Dec 2007 14:09:56 -0600 Subject: [fxruby-users] [Foxgui-users] Stopping a FOX popup window In-Reply-To: <57cf8f720712051014s4b316c7ele7ee8e068b0464c3@mail.gmail.com> References: <03B62622BF273442912A2E486B799DD2058299F7@AEROMSG3.AERO.BALL.COM> <03B62622BF273442912A2E486B799DD2058299FA@AEROMSG3.AERO.BALL.COM> <57cf8f720712051014s4b316c7ele7ee8e068b0464c3@mail.gmail.com> Message-ID: <200712051409.56266.jeroen@fox-toolkit.org> On Wednesday 05 December 2007, Lyle Johnson wrote: > On 12/5/07, Thomas, Jason M (Software) wrote: > > > That worked great! I'm just curious why I was going down the wrong path. > > Was it because I called runPopup with a FXMainWindow? > > Yes. > > > Does runPopup only work with a FXPopup? > > Well, it's only meant to work with popups, but since it accepts an > FXWindow argument, you can (as you discovered) pass in any kind of > window. runPopup() is one of those methods that I think probably > shouldn't be public, because it's really sort of a special purpose > method that FOX only uses internally (as best I can tell). Maybe > Jeroen will interject with some words of wisdom on this point. ;) I do think we would be able to change the type from FXWindow to FXPopup, to kill any possible confusion about what its supposed to be used for. > > When should FXApp.stop be called? > > stop() breaks out of all of the (possibly many) nested event loops, to > the very top one, which eventually causes your program to fall out of > the top-level run(). Right! All the recursive invocations of event loops are added into a linked list, with the head being the innermost loop. FXApp::stop() sets the stop flag on all the loops; FXApp::stopModal(window) stops all loops up to and including the one associated with the given window. It will appear to the application as if all modal dialogs have been cancelled. - Jeroen From jmthomas at ball.com Wed Dec 5 10:49:29 2007 From: jmthomas at ball.com (Thomas, Jason M (Software)) Date: Wed, 5 Dec 2007 08:49:29 -0700 Subject: [fxruby-users] [Foxgui-users] Stopping a FOX popup window In-Reply-To: <57cf8f720712050731n7cedf3d4g6eb1814862219d17@mail.gmail.com> References: <03B62622BF273442912A2E486B799DD2058299F7@AEROMSG3.AERO.BALL.COM> <57cf8f720712050731n7cedf3d4g6eb1814862219d17@mail.gmail.com> Message-ID: <03B62622BF273442912A2E486B799DD2058299FA@AEROMSG3.AERO.BALL.COM> That worked great! I'm just curious why I was going down the wrong path. Was it because I called runPopup with a FXMainWindow? Does runPopup only work with a FXPopup? When should FXApp.stop be called? I tried the following: popup = FXPopup.new(window) popup.popup(nil, 0, 0) application.runPopup(popup) At this point the popup window appeared. Then in my other thread I did: sleep(2) app = FXApp.instance app.stop This results in a Segmentation fault. Any ideas? Thanks again for helping me. Right now I'm just trying to understand how FOX works. Jason -----Original Message----- From: Lyle Johnson [mailto:lyle at lylejohnson.name] Sent: Wednesday, December 05, 2007 8:31 AM To: Thomas, Jason M (Software) Cc: foxgui-users at lists.sourceforge.net; fxruby-users at rubyforge.org Subject: Re: [Foxgui-users] Stopping a FOX popup window On 12/4/07, Thomas, Jason M (Software) wrote: > I'm using the FXRuby bindings to FOX and trying to use the unit test > framework to do some testing. I've been able to create and tear down > my FOX applications successfully but I'm having trouble > programmatically closing a dialog box. I've tried (FXApp) stop and > stopModal but they don't seem to have any effect. Closing and > destroying the window works but the code is still stuck in the application loop. Your code doesn't create a dialog box, it creates a second main window. Is that what you meant to do? At any rate, you should be able to break out of the runPopup() loop by calling hide() on the window: def test_exception_popup() Thread.new do sleep(2) app = FXApp.instance app.activeWindow.hide end ... end Hope this helps, Lyle This message and any enclosures are intended only for the addressee. Please notify the sender by email if you are not the intended recipient. If you are not the intended recipient, you may not use, copy, disclose, or distribute this message or its contents or enclosures to any other person and any such actions may be unlawful. Ball reserves the right to monitor and review all messages and enclosures sent to or from this email address. From ralph at grayskies.net Sun Dec 9 20:48:41 2007 From: ralph at grayskies.net (Ralph Douglass) Date: Sun, 9 Dec 2007 20:48:41 -0500 Subject: [fxruby-users] deleting children and then adding new ones Message-ID: <71767b800712091748h4521161aue0f6953588d08a66@mail.gmail.com> Hi all! I'm having a small problem, which is probably really easy to deal with, but I'm just missing how to do it, and I haven't had any luck looking in the docs or the examples. I'm trying to delete the contents of a frame (using removeChild), and then add new contents to that frame. Whenever I do this, it deletes stuff just fine, but then the new thing doesn't show up. Here is a short example: require 'fox16' include Fox app = FXApp.new() main = FXMainWindow.new(app, "Window") vf = FXVerticalFrame.new(main) button = FXButton.new(vf, "Old Button") button.connect(SEL_COMMAND) do vf.removeChild(button) FXButton.new(vf, "New Button") end app.create main.show() app.run Click the button... and then there's nothing at all. Is there some sort of magic incantation I need to call to get the frame to redraw itself or something? I tried a few that looked like they did that from the docs, but no luck Thanks, Ralph -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/fxruby-users/attachments/20071209/1f6841a5/attachment.html From lyle at lylejohnson.name Mon Dec 10 11:23:53 2007 From: lyle at lylejohnson.name (Lyle Johnson) Date: Mon, 10 Dec 2007 10:23:53 -0600 Subject: [fxruby-users] deleting children and then adding new ones In-Reply-To: <71767b800712091748h4521161aue0f6953588d08a66@mail.gmail.com> References: <71767b800712091748h4521161aue0f6953588d08a66@mail.gmail.com> Message-ID: <57cf8f720712100823x7a87a95bh18340f7b7d095b4d@mail.gmail.com> On 12/9/07, Ralph Douglass wrote: > I'm trying to delete the contents of a frame (using removeChild), and then > add new contents to that frame. Whenever I do this, it deletes stuff just > fine, but then the new thing doesn't show up. Here is a short example: > > require 'fox16' > > include Fox > app = FXApp.new() > main = FXMainWindow.new(app, "Window") > vf = FXVerticalFrame.new(main) > button = FXButton.new(vf, "Old Button") > button.connect (SEL_COMMAND) do > vf.removeChild(button) > FXButton.new(vf, "New Button") > end > > app.create > main.show() > app.run > > Click the button... and then there's nothing at all. > > Is there some sort of magic incantation I need to call to get the frame to > redraw itself or something? Yes, you need to call create() on the button and then recalc() on the button's parent: buttton.connect(SEL_COMMAND) do vf.removeChild(button) btn = FXButton.new(vf, "New Button") btn.create btn.recalc end Note that I'm not sure it's a good idea to destroy an object while you're executing a message handler for it (as in this example). What is it that you're trying to accomplish by removing the old button and creating a new one? If you're just wanting to change the button's label (for example), you can just do: button.connect(SEL_COMMAND) do button.text = "New Button Text" end Hope this helps, Lyle From ralph at grayskies.net Mon Dec 10 13:38:56 2007 From: ralph at grayskies.net (Ralph Douglass) Date: Mon, 10 Dec 2007 13:38:56 -0500 Subject: [fxruby-users] deleting children and then adding new ones In-Reply-To: <57cf8f720712100823x7a87a95bh18340f7b7d095b4d@mail.gmail.com> References: <71767b800712091748h4521161aue0f6953588d08a66@mail.gmail.com> <57cf8f720712100823x7a87a95bh18340f7b7d095b4d@mail.gmail.com> Message-ID: <71767b800712101038r5a8a3c81xabe8f4c2de5b2ad2@mail.gmail.com> I'm working on the ui for a little video game. On the left in a map of the game's galaxy, and on the right in a panel. When a planet on the left in clicked on, I want the panel on the right to change to display information and options for that planet. When a user clicks on a fleet of ships, I want it to change to display information and options for the fleet. Is there perhaps a better way to do this than destroying the contents of the frame on the right every time? Thanks, Ralph On 12/10/07, Lyle Johnson wrote: > > On 12/9/07, Ralph Douglass wrote: > > > I'm trying to delete the contents of a frame (using removeChild), and > then > > add new contents to that frame. Whenever I do this, it deletes stuff > just > > fine, but then the new thing doesn't show up. Here is a short example: > > > > require 'fox16' > > > > include Fox > > app = FXApp.new() > > main = FXMainWindow.new(app, "Window") > > vf = FXVerticalFrame.new(main) > > button = FXButton.new(vf, "Old Button") > > button.connect (SEL_COMMAND) do > > vf.removeChild(button) > > FXButton.new(vf, "New Button") > > end > > > > app.create > > main.show() > > app.run > > > > Click the button... and then there's nothing at all. > > > > Is there some sort of magic incantation I need to call to get the frame > to > > redraw itself or something? > > Yes, you need to call create() on the button and then recalc() on the > button's parent: > > buttton.connect(SEL_COMMAND) do > vf.removeChild(button) > btn = FXButton.new(vf, "New Button") > btn.create > btn.recalc > end > > Note that I'm not sure it's a good idea to destroy an object while > you're executing a message handler for it (as in this example). What > is it that you're trying to accomplish by removing the old button and > creating a new one? If you're just wanting to change the button's > label (for example), you can just do: > > button.connect(SEL_COMMAND) do > button.text = "New Button Text" > end > > Hope this helps, > > Lyle > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users > -- Ralph -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/fxruby-users/attachments/20071210/98b354f4/attachment-0001.html From lyle at lylejohnson.name Mon Dec 10 14:06:09 2007 From: lyle at lylejohnson.name (Lyle Johnson) Date: Mon, 10 Dec 2007 13:06:09 -0600 Subject: [fxruby-users] deleting children and then adding new ones In-Reply-To: <71767b800712101038r5a8a3c81xabe8f4c2de5b2ad2@mail.gmail.com> References: <71767b800712091748h4521161aue0f6953588d08a66@mail.gmail.com> <57cf8f720712100823x7a87a95bh18340f7b7d095b4d@mail.gmail.com> <71767b800712101038r5a8a3c81xabe8f4c2de5b2ad2@mail.gmail.com> Message-ID: <57cf8f720712101106u5a3e7904yc1f659818cfe0fb7@mail.gmail.com> On 12/10/07, Ralph Douglass wrote: > I'm working on the ui for a little video game. On the left in a map of the > game's galaxy, and on the right in a panel. When a planet on the left in > clicked on, I want the panel on the right to change to display information > and options for that planet. When a user clicks on a fleet of ships, I want > it to change to display information and options for the fleet. > > Is there perhaps a better way to do this than destroying the contents of the > frame on the right every time? Is the information associated with a planet always the same set of widgets, just with different values? If so, I'd just update the widgets' values whenever the user clicks on a new planet, e.g. planet_button.connect(SEL_COMMAND) do planet_name_label.text = planet.name planet_size_label.text = planet.size end Now, I'm assuming that you're displaying completely different kinds of information when the user clicks on a fleet of ships, so you'd need to do something different in that case. One option would be to implement the right-hand side information panel as a switcher (FXSwitcher), with one page for "planet information", another page for "fleet information", etc. See the shutter.rb example for an idea of how you might do that. Hope this helps, Lyle From ralph at grayskies.net Mon Dec 10 22:50:47 2007 From: ralph at grayskies.net (Ralph Douglass) Date: Mon, 10 Dec 2007 22:50:47 -0500 Subject: [fxruby-users] deleting children and then adding new ones In-Reply-To: <57cf8f720712101106u5a3e7904yc1f659818cfe0fb7@mail.gmail.com> References: <71767b800712091748h4521161aue0f6953588d08a66@mail.gmail.com> <57cf8f720712100823x7a87a95bh18340f7b7d095b4d@mail.gmail.com> <71767b800712101038r5a8a3c81xabe8f4c2de5b2ad2@mail.gmail.com> <57cf8f720712101106u5a3e7904yc1f659818cfe0fb7@mail.gmail.com> Message-ID: <71767b800712101950ld303d9cyaa00696f8e83c7a5@mail.gmail.com> Thanks, the recalc and create worked really well. I saw the example of the FXSwitcher widget on the website, but thought it wasn't really what I wanted at the time. I'll give it a second look now. On 12/10/07, Lyle Johnson wrote: > > On 12/10/07, Ralph Douglass wrote: > > > I'm working on the ui for a little video game. On the left in a map of > the > > game's galaxy, and on the right in a panel. When a planet on the left > in > > clicked on, I want the panel on the right to change to display > information > > and options for that planet. When a user clicks on a fleet of ships, I > want > > it to change to display information and options for the fleet. > > > > Is there perhaps a better way to do this than destroying the contents of > the > > frame on the right every time? > > Is the information associated with a planet always the same set of > widgets, just with different values? If so, I'd just update the > widgets' values whenever the user clicks on a new planet, e.g. > > planet_button.connect(SEL_COMMAND) do > planet_name_label.text = planet.name > planet_size_label.text = planet.size > end > > Now, I'm assuming that you're displaying completely different kinds of > information when the user clicks on a fleet of ships, so you'd need to > do something different in that case. One option would be to implement > the right-hand side information panel as a switcher (FXSwitcher), with > one page for "planet information", another page for "fleet > information", etc. See the shutter.rb example for an idea of how you > might do that. > > Hope this helps, > > Lyle > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users > -- Ralph -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/fxruby-users/attachments/20071210/13eb7364/attachment.html From jeroen at fox-toolkit.org Mon Dec 10 23:48:17 2007 From: jeroen at fox-toolkit.org (Jeroen van der Zijp) Date: Mon, 10 Dec 2007 22:48:17 -0600 Subject: [fxruby-users] deleting children and then adding new ones In-Reply-To: <71767b800712101950ld303d9cyaa00696f8e83c7a5@mail.gmail.com> References: <71767b800712091748h4521161aue0f6953588d08a66@mail.gmail.com> <57cf8f720712101106u5a3e7904yc1f659818cfe0fb7@mail.gmail.com> <71767b800712101950ld303d9cyaa00696f8e83c7a5@mail.gmail.com> Message-ID: <200712102248.17725.jeroen@fox-toolkit.org> On Monday 10 December 2007, Ralph Douglass wrote: > Thanks, the recalc and create worked really well. I saw the example of the > FXSwitcher widget on the website, but thought it wasn't really what I wanted > at the time. I'll give it a second look now. FXSwitcher is probably recommended for something like this; however, it is not forbidden to destroy windows in response to SEL_COMMAND callback from FXButton. But please note, many callback messages are generated in the middle of a user-transaction, and not at the end of one. In such cases, the widget is expected to exist upon return from the callback. We take great pains to ensure that for the SEL_COMMAND callback, no further references to the originating widgets are made. So its true that for *most* widgets, you are allowed to do anything in the SEL_COMMAND, including deleteing the originating widget. But I do suggest not to make a habit of it. - Jeroen -- +----------------------------------------------------------------------------+ | Copyright (C) 22:40 12/ 3/2007 Jeroen van der Zijp. All Rights Reserved. | +----------------------------------------------------------------------------+ From ernst at tanakasite.com Wed Dec 12 16:12:42 2007 From: ernst at tanakasite.com (Ernst J. Tanaka) Date: Wed, 12 Dec 2007 16:12:42 -0500 Subject: [fxruby-users] fxruby and framecontrole Message-ID: <47604ECA.7010808@tanakasite.com> I am new to (FX)ruby and am wrestling with the following question. In my application I have a three frame split by two splitters. One frame on the left side with a treelist and two frames above each other on the right side. The editable content of the right top frame depends on the item clicked in the treelist. The editable content of the right bottom frame depends on data enter in the right top frame. I maganged to program all this for the first click on a tree-item. My question is how do I reset righttopframe and rightbottomframe after handling treeitem(1) and before click on the next item. I tried righttopframe.destroy but that that does not seems to do the work. Since after a destroy "if righttopframe" still gives value true. in pseudo code my program is now on click tree item { build right topframe righttopframe.create righttopframe.show } on click righttopframe_button { build right bottomframe rigthbottomframe.create rightbottomframe.show} on click rightbottomframe-button { edit database} Thank you for any suggestions. Ernst -------------- next part -------------- A non-text attachment was scrubbed... Name: ernst.vcf Type: text/x-vcard Size: 264 bytes Desc: not available Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20071212/30a93ac4/attachment.vcf From lyle at lylejohnson.name Wed Dec 12 18:21:33 2007 From: lyle at lylejohnson.name (Lyle Johnson) Date: Wed, 12 Dec 2007 17:21:33 -0600 Subject: [fxruby-users] fxruby and framecontrole In-Reply-To: <47604ECA.7010808@tanakasite.com> References: <47604ECA.7010808@tanakasite.com> Message-ID: <57cf8f720712121521n4b0cadfwe4e988e7adbc82c9@mail.gmail.com> On 12/12/07, Ernst J. Tanaka wrote: > My question is how do I reset righttopframe and rightbottomframe after > handling treeitem(1) and before click on the next item. I think the important question is what you mean by "reset". Acually, a question very similar to yours came up the other day on the mailing list; here's a link to the first post in that thread: http://rubyforge.org/pipermail/fxruby-users/2007-December/001371.html My advice in that thread was to just update the values associated with the widgets (if possible) instead of removing and re-creating them. For example, suppose the top-right frame contains three widgets. You can update their values by simply setting new values for their text, e.g. on click treeItem button.text = "New button text" label.text = "New label text" textfield.text = "New text field text" end You can do something similar to update the contents of the bottom-right frame at the appropriate time. If, however, you really do need to get rid of the widgets in the top-right frame, use removeChildren() and not destroy(), e.g. parent = righttopframe.parent parent.removeChild(righttopframe) Note that this won't set righttopframe to nil, so you need to be careful not to use that value anymore until you assign some new value to it. Hope this helps, Lyle From meinrad.recheis at gmail.com Thu Dec 13 04:08:45 2007 From: meinrad.recheis at gmail.com (Meinrad Recheis) Date: Thu, 13 Dec 2007 10:08:45 +0100 Subject: [fxruby-users] fxruby and framecontrole In-Reply-To: <47604ECA.7010808@tanakasite.com> References: <47604ECA.7010808@tanakasite.com> Message-ID: <43d756720712130108x4f50c979sc3229971064a4495@mail.gmail.com> On Dec 12, 2007 10:12 PM, Ernst J. Tanaka wrote: [...] > > I tried righttopframe.destroy but that that does not seems to do the > work. Since after a destroy "if righttopframe" still gives value true. > > Sure! The object residing in the variable righttopframe is still there. By calling destroy you tell FOX to release WindowManager-resources etc. but not to destroy the object at hand. This is not possible in Ruby, it is done by the garbage collector automatically. As Lyle pointed out earlier, righttopframe.parent.RemoveChild(righttopframe) is the correct way to do what you attempted to do, even if there are better ways to update content in a UI. After that, if you explicitly set the variable righttopframe = nil then your if statement above also works. hth, -- henon -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/fxruby-users/attachments/20071213/332ac3bd/attachment.html From ernst at tanakasite.com Fri Dec 14 10:44:27 2007 From: ernst at tanakasite.com (Ernst J. Tanaka) Date: Fri, 14 Dec 2007 10:44:27 -0500 Subject: [fxruby-users] FXTabBook / FXTabItem / FXTabBar Message-ID: <4762A4DB.6090507@tanakasite.com> Lyle and Henon; thanks for helping out with 'clearing' the frames. It's working. I end up using; parent.removeChild(righttopframe) righttopframe = nil Am afraid I stumbled on another question. I managed to put my application in a tabbook. I am looking to catch the event 'click on tabitem'. I tried SEL_COMMAND on TabItem but that seems not to work. I also would appreciate some text to explain the difference between Tabbar and Tabbook. Thanks, Ernst T. From ralph at grayskies.net Fri Dec 14 12:38:08 2007 From: ralph at grayskies.net (Ralph Douglass) Date: Fri, 14 Dec 2007 12:38:08 -0500 Subject: [fxruby-users] FXTabBook / FXTabItem / FXTabBar In-Reply-To: <4762A4DB.6090507@tanakasite.com> References: <4762A4DB.6090507@tanakasite.com> Message-ID: <71767b800712140938x61afb2d7r98205c5e0b301bca@mail.gmail.com> This might not be the best way to do it, but the docs say that when you click on a tab item, the tab book sends a SEL_COMMAND to it's target. If you set something to be the target and react on SEL_COMMANDs, then that should do the trick. On 12/14/07, Ernst J. Tanaka wrote: > > Lyle and Henon; thanks for helping out with 'clearing' the frames. It's > working. > I end up using; > parent.removeChild(righttopframe) > righttopframe = nil > > Am afraid I stumbled on another question. > > I managed to put my application in a tabbook. I am looking to catch the > event 'click on tabitem'. > I tried SEL_COMMAND on TabItem but that seems not to work. > > I also would appreciate some text to explain the difference between > Tabbar and Tabbook. > > Thanks, > > Ernst T. > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users > -- Ralph -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/fxruby-users/attachments/20071214/320a39f2/attachment.html From lyle at lylejohnson.name Fri Dec 14 12:48:53 2007 From: lyle at lylejohnson.name (Lyle Johnson) Date: Fri, 14 Dec 2007 11:48:53 -0600 Subject: [fxruby-users] FXTabBook / FXTabItem / FXTabBar In-Reply-To: <4762A4DB.6090507@tanakasite.com> References: <4762A4DB.6090507@tanakasite.com> Message-ID: <57cf8f720712140948n2cf4f6cdw34db353d34e7d221@mail.gmail.com> On 12/14/07, Ernst J. Tanaka wrote: > I managed to put my application in a tabbook. I am looking to catch the > event 'click on tabitem'. I tried SEL_COMMAND on TabItem but that seems > not to work. The FXTabBook widget should send a SEL_COMMAND message whenever you select a new tab: tabBook.connect(SEL_COMMAND) do puts "User selected tab number #{tabBook.current}" end Hope this helps, Lyle From jeroen at fox-toolkit.org Sat Dec 15 09:24:26 2007 From: jeroen at fox-toolkit.org (Jeroen van der Zijp) Date: Sat, 15 Dec 2007 08:24:26 -0600 Subject: [fxruby-users] FXTabBook / FXTabItem / FXTabBar In-Reply-To: <4762A4DB.6090507@tanakasite.com> References: <4762A4DB.6090507@tanakasite.com> Message-ID: <200712150824.34102.jeroen@fox-toolkit.org> On Friday 14 December 2007, Ernst J. Tanaka wrote: > Lyle and Henon; thanks for helping out with 'clearing' the frames. It's > working. > I end up using; > parent.removeChild(righttopframe) > righttopframe = nil > > Am afraid I stumbled on another question. > > I managed to put my application in a tabbook. I am looking to catch the > event 'click on tabitem'. > I tried SEL_COMMAND on TabItem but that seems not to work. > > I also would appreciate some text to explain the difference between > Tabbar and Tabbook. FXTabBook is a row of tabs with a number of panes below it; the children of FXTabBook are tabitem, panel, tabitem, panel, ... So usually an even number of children. The FXTabBar is just a number of FXTabItems on a row. Its useful if you want tabbook-like behaviour but the content being switched is done in some other way [e.g. changing the content of a GL window by drawing a different object]. Hope this helps, - Jeroen -- +----------------------------------------------------------------------------+ | Copyright (C) 22:40 12/ 3/2007 Jeroen van der Zijp. All Rights Reserved. | +----------------------------------------------------------------------------+ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part. Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20071215/4959871f/attachment.bin From devi.webmaster at gmail.com Sat Dec 15 13:49:40 2007 From: devi.webmaster at gmail.com (Daniel Brumbaugh Keeney) Date: Sat, 15 Dec 2007 12:49:40 -0600 Subject: [fxruby-users] mixing editable text with not editable Message-ID: <3bceeb2d0712151049s64284cfan9a3a52daac5b5dd7@mail.gmail.com> What's the best way in fxruby to have text, some of which you can edit, and some of which you can't? Best summed up by Bash username at compname:~$ you can write anything here, but not left of the $ Daniel Brumbaugh Keeney From lyle at lylejohnson.name Sat Dec 15 18:37:05 2007 From: lyle at lylejohnson.name (Lyle Johnson) Date: Sat, 15 Dec 2007 17:37:05 -0600 Subject: [fxruby-users] mixing editable text with not editable In-Reply-To: <3bceeb2d0712151049s64284cfan9a3a52daac5b5dd7@mail.gmail.com> References: <3bceeb2d0712151049s64284cfan9a3a52daac5b5dd7@mail.gmail.com> Message-ID: <2D949CB9-9854-4F4E-AFC8-A5EA68649341@lylejohnson.name> Within a given FXTextField or FXText widget, editability is an all or nothing setting. I guess you could try using the SEL_VERIFY callback to prevent some edits if it's a textfield; I don't know that that's an option for FXText, though. Sent from my iPhone On Dec 15, 2007, at 12:49 PM, "Daniel Brumbaugh Keeney" wrote: > What's the best way in fxruby to have text, some of which you can > edit, and some of which you can't? > > Best summed up by Bash > > username at compname:~$ you can write anything here, but not left of > the $ > > > Daniel Brumbaugh Keeney > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users From jmthomas at ball.com Tue Dec 18 14:08:50 2007 From: jmthomas at ball.com (Thomas, Jason M (Software)) Date: Tue, 18 Dec 2007 12:08:50 -0700 Subject: [fxruby-users] programmatically "pushing" a button Message-ID: <03B62622BF273442912A2E486B799DD205829A1A@AEROMSG3.AERO.BALL.COM> I'm trying to use the Ruby unit test framework to exercise my FxRuby application. I have access to my button but I don't know how to programmatically "push" it. I tried the following: button.handle(button, MKUINT(FXWindow::ID_ENABLE, SEL_COMMAND), nil) This appears to have no effect at all. What am I doing wrong? Jason This message and any enclosures are intended only for the addressee. Please notify the sender by email if you are not the intended recipient. If you are not the intended recipient, you may not use, copy, disclose, or distribute this message or its contents or enclosures to any other person and any such actions may be unlawful. Ball reserves the right to monitor and review all messages and enclosures sent to or from this email address. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/fxruby-users/attachments/20071218/818938b1/attachment.html From philippe.lang at attiksystem.ch Wed Dec 19 02:19:53 2007 From: philippe.lang at attiksystem.ch (Philippe Lang) Date: Wed, 19 Dec 2007 08:19:53 +0100 Subject: [fxruby-users] programmatically "pushing" a button References: <03B62622BF273442912A2E486B799DD205829A1A@AEROMSG3.AERO.BALL.COM> Message-ID: <6C0CF58A187DA5479245E0830AF84F42337F6B@poweredge.attiksystem.ch> Hi Jason, Can you try this? button.handle(self, FXSEL(SEL_LEFTBUTTONPRESS, 0), nil) button.handle(self, FXSEL(SEL_LEFTBUTTONRELEASE, 0), nil) It would be a good idea to have a look at these classes too: pseudokeyboard.rb pseudomouse.rb (You might find them here, more or less: C:\ruby\lib\ruby\gems\1.8\gems\fxruby-1.6.13-mswin32\lib\fox16) I think it does exactly what you need. Regards, Philippe Lang ________________________________ De : fxruby-users-bounces at rubyforge.org [mailto:fxruby-users-bounces at rubyforge.org] De la part de Thomas, Jason M (Software) Envoy? : mardi, 18. d?cembre 2007 20:09 ? : fxruby-users at rubyforge.org Objet : [fxruby-users] programmatically "pushing" a button I'm trying to use the Ruby unit test framework to exercise my FxRuby application. I have access to my button but I don't know how to programmatically "push" it. I tried the following: button.handle(button, MKUINT(FXWindow::ID_ENABLE, SEL_COMMAND), nil) This appears to have no effect at all. What am I doing wrong? Jason This message and any enclosures are intended only for the addressee. Please notify the sender by email if you are not the intended recipient. If you are not the intended recipient, you may not use, copy, disclose, or distribute this message or its contents or enclosures to any other person and any such actions may be unlawful. Ball reserves the right to monitor and review all messages and enclosures sent to or from this email address. From lyle at lylejohnson.name Wed Dec 19 08:28:07 2007 From: lyle at lylejohnson.name (Lyle Johnson) Date: Wed, 19 Dec 2007 07:28:07 -0600 Subject: [fxruby-users] programmatically "pushing" a button In-Reply-To: <03B62622BF273442912A2E486B799DD205829A1A@AEROMSG3.AERO.BALL.COM> References: <03B62622BF273442912A2E486B799DD205829A1A@AEROMSG3.AERO.BALL.COM> Message-ID: <1A0194D4-30F6-4B7E-9031-1CFE594CD59A@lylejohnson.name> On Dec 18, 2007, at 1:08 PM, Thomas, Jason M ((Software)) wrote: > I'm trying to use the Ruby unit test framework to exercise my > FxRuby application. I have access to my button but I don't know how > to programmatically "push" it. I tried the following: > > button.handle(button, MKUINT(FXWindow::ID_ENABLE, SEL_COMMAND), nil) > > This appears to have no effect at all. What am I doing wrong? SEL_COMMAND is a message that the button sends to its target after the user presses, then releases the left mouse button. In the code you posted, you're sending a SEL_COMMAND message to the button, with the ID_ENABLE message identifier, which just tells the button to enable itself. It's a valid message to send to the button, but it's not going to accomplish what you're after. I haven't tried this, but I suppose you could simulate a button press and release by sending a SEL_LEFTBUTTONPRESS message to the button, followed by a SEL_LEFTBUTTONRELEASE message, e.g. button.handle(nil, FXSEL(SEL_LEFTBUTTONPRESS, 0), nil) button.handle(nil, FXSEL(SEL_LEFTBUTTONRELEASE, 0), nil) In theory, that ought to then cause the button to fire off its SEL_COMMAND message, just as if someone had pressed and released the button. Hope this helps, Lyle -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/fxruby-users/attachments/20071219/303a71aa/attachment.html From jmthomas at ball.com Wed Dec 19 13:00:07 2007 From: jmthomas at ball.com (Thomas, Jason M (Software)) Date: Wed, 19 Dec 2007 11:00:07 -0700 Subject: [fxruby-users] Programmatically closing a dialog box In-Reply-To: <6C0CF58A187DA5479245E0830AF84F42337F6B@poweredge.attiksystem.ch> References: <03B62622BF273442912A2E486B799DD205829A1A@AEROMSG3.AERO.BALL.COM> <6C0CF58A187DA5479245E0830AF84F42337F6B@poweredge.attiksystem.ch> Message-ID: <03B62622BF273442912A2E486B799DD205829A1F@AEROMSG3.AERO.BALL.COM> Philippe and Lyle both suggested the same solution to pushing the button which works perfectly. I did give pseudokeyboard a try but it didn't work for me in this instance because I needed to pass the button as the sender instead of self. Another thing I needed to do was to close a dialog once it was opened. I tried many things like opening the dialog in a different thread but it seemed like once the dialog was open I could not get access to it to close it. A coworker pointed me to FXApp.addTimeout which worked great. I open the dialog in a different thread and then add the timeout which closes it. app = FXApp.instance buttons = app.activeWindow.instance_variable_get :@buttons dialog = app.activeWindow.instance_variable_get :@dialog_box t = Thread.new do # Launch the dialog box buttons[0].handle(buttons[0], FXSEL(SEL_LEFTBUTTONPRESS, 0), nil) buttons[0].handle(buttons[0], FXSEL(SEL_LEFTBUTTONRELEASE, 0), nil) sleep 2 end app.addTimeout(1000) do |sender, sel, data| dialog.handle(app, MKUINT(FXDialogBox::ID_CANCEL, SEL_COMMAND), nil) end Hope this can help someone else fumbling for a way to do unit testing. Jason -----Original Message----- From: Philippe Lang [mailto:philippe.lang at attiksystem.ch] Sent: Wednesday, December 19, 2007 12:20 AM To: fxruby-users at rubyforge.org Cc: Thomas, Jason M (Software) Subject: RE: [fxruby-users] programmatically "pushing" a button Hi Jason, Can you try this? button.handle(self, FXSEL(SEL_LEFTBUTTONPRESS, 0), nil) button.handle(self, FXSEL(SEL_LEFTBUTTONRELEASE, 0), nil) It would be a good idea to have a look at these classes too: pseudokeyboard.rb pseudomouse.rb (You might find them here, more or less: C:\ruby\lib\ruby\gems\1.8\gems\fxruby-1.6.13-mswin32\lib\fox16) I think it does exactly what you need. Regards, Philippe Lang ________________________________ De : fxruby-users-bounces at rubyforge.org [mailto:fxruby-users-bounces at rubyforge.org] De la part de Thomas, Jason M (Software) Envoy? : mardi, 18. d?cembre 2007 20:09 ? : fxruby-users at rubyforge.org Objet : [fxruby-users] programmatically "pushing" a button I'm trying to use the Ruby unit test framework to exercise my FxRuby application. I have access to my button but I don't know how to programmatically "push" it. I tried the following: button.handle(button, MKUINT(FXWindow::ID_ENABLE, SEL_COMMAND), nil) This appears to have no effect at all. What am I doing wrong? Jason This message and any enclosures are intended only for the addressee. Please notify the sender by email if you are not the intended recipient. If you are not the intended recipient, you may not use, copy, disclose, or distribute this message or its contents or enclosures to any other person and any such actions may be unlawful. Ball reserves the right to monitor and review all messages and enclosures sent to or from this email address. This message and any enclosures are intended only for the addressee. Please notify the sender by email if you are not the intended recipient. If you are not the intended recipient, you may not use, copy, disclose, or distribute this message or its contents or enclosures to any other person and any such actions may be unlawful. Ball reserves the right to monitor and review all messages and enclosures sent to or from this email address.