From stuart_clarke86 at yahoo.com Wed Apr 1 03:45:37 2009 From: stuart_clarke86 at yahoo.com (Stuart Clarke) Date: Wed, 1 Apr 2009 00:45:37 -0700 (PDT) Subject: [fxruby-users] Data formating - Text Frame In-Reply-To: <57cf8f720903310932l25fe6c3m2e728d0751d67da7@mail.gmail.com> Message-ID: <184769.54531.qm@web86611.mail.ird.yahoo.com> I have output the data to the GUI. I have just one question. Can you turn of the individual scroll bars on each column and have just one scroll bar to control all of the columns? Many thanks --- On Tue, 31/3/09, Lyle Johnson wrote: From: Lyle Johnson Subject: Re: [fxruby-users] Data formating - Text Frame To: fxruby-users at rubyforge.org Date: Tuesday, 31 March, 2009, 5:32 PM On Tue, Mar 31, 2009 at 10:18 AM, Stuart Clarke wrote: > I have just noticed FXList and have added this to my GUI. > It is possible to break my array down to fit into this list structure using appendItem? You are the only person who can answer this question. If you have a list of items that you'd like to display, so that the user can pick one or more items from that list, then yes, you might want to use FXList. Based on your earlier e-mail, it sort-of looked like you were trying to display tabular data (i.e. multiple rows and columns). If that's the case, you might want to use FXTable instead. _______________________________________________ fxruby-users mailing list fxruby-users at rubyforge.org http://rubyforge.org/mailman/listinfo/fxruby-users -------------- next part -------------- An HTML attachment was scrubbed... URL: From drocco at westga.edu Wed Apr 1 14:33:13 2009 From: drocco at westga.edu (Daniel Rocco) Date: Wed, 01 Apr 2009 14:33:13 -0400 Subject: [fxruby-users] fonts & rotated text redux Message-ID: <49D3B369.4000500@westga.edu> hi folks, I'm a new FXRuby user using the library as part of an introductory CS course. I'd like to offer a huge "thank you" to Lyle and the other contributors to the example programs, which make getting started surprisingly easy. I have a few questions I was hoping someone would be able to shed some light on: 1. Is there a repository of snippets, recipes, or links to programs using FXRuby? In particular, I'd be interested in any FXRuby games, particularly simpler ones, since I like to smuggle practice with CS concepts into interesting projects but don't want to write everything from scratch if I don't have to. 2. Is there a particular search path used for font files? I'd like to distribute some custom fonts with one or two projects, but couldn't find any information about how fonts are located. (We are on Windows, using the bundled FXRuby that comes with the one click installer for Ruby 1.8.x) 3. Concerning rotating fonts, the information I've found suggests that not all fonts on Windows can be rotated, but that TrueType fonts can be. Does this include OpenType fonts? Is there any way to determine if a particular font can be rotated or not (aside from trying it!)? 4. I can't seem to get rotated text to work. I've attempted to follow Jeroen's steps from an earlier post (Feb. 2008), but the text stubbornly insists on appearing in its original orientation. Here is what I've got at the moment: class ParchmentMap < FXMainWindow # initialize the main map GUI and the instance variables for the map def initialize(app) # Invoke base class initialize method first super(app, "CS 1300 Parchment Map Environment", nil, nil, DECOR_ALL, 0, 0, 1024, 768) # Sunken border for map canvas frame = FXHorizontalFrame.new(self, FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y, :padLeft => 0, :padRight => 0, :padTop => 0, :padBottom => 0) # Make canvas @canvas = FXCanvas.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y) # load parchment background background = load_image('./images/parchment.jpg') background.create() @canvas.connect(SEL_PAINT) do |sender, sel, event| FXDCWindow.new(@canvas, event) do |dc| dc.drawImage(background, 0, 0) dc.foreground = "black" font = FXFont.new(app, 'Arial', 16) font.setAngle(5760) font.create() dc.font = font dc.drawText(10, 30, "CS 1300 programming DRY divide and conquer Ruby") end end end I've tried several different fonts including both TrueType and OpenType varieties, and while the fonts change appearance, the rotation does not happen. Thanks in advance for any insight you can offer! dan From lyle at lylejohnson.name Wed Apr 8 10:37:55 2009 From: lyle at lylejohnson.name (Lyle Johnson) Date: Wed, 8 Apr 2009 09:37:55 -0500 Subject: [fxruby-users] Fox stable 1.6.36 In-Reply-To: References: Message-ID: <57cf8f720904080737i7ed71111sd2d786fe51711663@mail.gmail.com> On Wed, Apr 8, 2009 at 1:28 AM, Philippe Lang wrote: > I have just seen that the latest Fox version 1.6.36 corrects a bug with > the FXTable startInput() call. > > I'm not sure at all, but I think it might correct one of the pending > problem, when a modal dialog is called while a cell is being edited. > > You certainly have a lot to do, but if you have a few minutes during the > next weeks, it would be great to have a new release. Sure. I didn't realize that Jeroen had released this bug fix. > By the way, what about numbering in the future the FXRuby releases like the Fox release, > plus an extra version: 1.6.36.1, 1.6.36.2...? I'm not sure I understand what you mean. Because the FOX 1.6 API is frozen, the idea is that any release of FXRuby 1.6 can be built against any release of FOX 1.6. In other words, FXRuby depends only on the public API of FOX. To date I've been in the habit of only making a new release of FXRuby 1.6 when something about the FXRuby code has changed (whether it's a bug fix or a feature addition). I don't make a new release of FXRuby 1.6 for every new release of FOX 1.6, because there's no need---if you want to take advantage of a FOX bug fix (such as the one in FOX 1.6.36), you just recompile the latest FXRuby 1.6 against the latest FOX 1.6 release. The binary releases, where we include some precompiled version of FOX in the gem, are a special case, and I'm wondering if that's what you're referring to? From kwicher at gmail.com Sun Apr 12 23:49:34 2009 From: kwicher at gmail.com (kwicher) Date: Sun, 12 Apr 2009 20:49:34 -0700 (PDT) Subject: [fxruby-users] Strange behaviour of FXDataTarget connected to FXTextField Message-ID: <95beed56-202d-4036-90bb-bf44a7a16aad@k2g2000yql.googlegroups.com> Hi I have a following small program in which I am enabling or disabling a button depending on the presence of text in the text filed. I am using the FXDataTarget connected to the text field. I also want to add possibility to paste the data into text filed upon pressing right mouse button etc. Now, everything works fine until I try to connect the mouse button action to the text field, then the FXDataTarget stops working. I am attaching the program; the mouse staff is commented out. Please have a look test the program with un- and commented lines. #---------- require "rubygems" require "fox16" include Fox class MyProject < FXMainWindow def initialize (app, title) super(app,title, :opts=>DECOR_ALL^(DECOR_SHRINKABLE| DECOR_STRETCHABLE|DECOR_RESIZE)| LAYOUT_EXPLICIT,:width=>400,:height=>300) @female_target = FXDataTarget.new("") female_text = FXTextField.new(self, 25,:target => @female_target, :selector => FXDataTarget::ID_VALUE, :opts => TEXTFIELD_NORMAL|TEXTFIELD_ENTER_ONLY| LAYOUT_EXPLICIT,:x=>85, :y=>12,:width=>120, :height=>25) #female_text.connect(SEL_RIGHTBUTTONRELEASE) do |sender, sel, event| # end @female_target.connect(SEL_CHANGED) do |sender, sel, data| if data.size>0 and @number_target.value.size>0 @submit_button.enable else @submit_button.disable end end @number_target = FXDataTarget.new("") number_text = FXTextField.new(self, 25,:target => @number_target, :selector => FXDataTarget::ID_VALUE, :opts => FRAME_NORMAL|TEXTFIELD_ENTER_ONLY| LAYOUT_EXPLICIT,:x=>85, :y=>47,:width=>90, :height=>25) @number_target.connect(SEL_CHANGED) do |sender, sel, data| if data.size >0 and @female_target.value.size>0 @submit_button.enable else @submit_button.disable end end @submit_button=FXButton.new (self,"Submit",:x=>85, :y=>180, :width=>300, :height=>24,:opts=>LAYOUT_EXPLICIT| BUTTON_NORMAL) @submit_button.connect(SEL_COMMAND) do end @submit_button.disable end def create super show(PLACEMENT_SCREEN) end end app = FXApp.new MyProject.new(app, "test") app.create app.run #--------- Thanks Krzys From lyle at lylejohnson.name Mon Apr 13 10:10:24 2009 From: lyle at lylejohnson.name (Lyle Johnson) Date: Mon, 13 Apr 2009 09:10:24 -0500 Subject: [fxruby-users] Strange behaviour of FXDataTarget connected to FXTextField In-Reply-To: <95beed56-202d-4036-90bb-bf44a7a16aad@k2g2000yql.googlegroups.com> References: <95beed56-202d-4036-90bb-bf44a7a16aad@k2g2000yql.googlegroups.com> Message-ID: <57cf8f720904130710r6e0431deqab00c26182c218e1@mail.gmail.com> On Sun, Apr 12, 2009 at 10:49 PM, kwicher wrote: > I have a following small program in which I am enabling or disabling a > button depending on the presence of text in the text filed. I am using > the FXDataTarget connected to the text field. I also want to add > possibility to paste the data into text filed upon pressing right > mouse button etc. Now, everything works fine until I try to connect > the mouse button action to the text field, then the FXDataTarget stops > working. Right. A widget (such as FXTextField) can only have one message target at a time. The FXTextField cannot be connected to both the FXDataTarget and the SEL_CHANGED handler (or the commented-out SEL_RIGHTBUTTONPRESS handler). From kwicher at gmail.com Mon Apr 13 19:26:36 2009 From: kwicher at gmail.com (XY$) Date: Mon, 13 Apr 2009 16:26:36 -0700 (PDT) Subject: [fxruby-users] Strange behaviour of FXDataTarget connected to FXTextField In-Reply-To: <57cf8f720904130710r6e0431deqab00c26182c218e1@mail.gmail.com> References: <95beed56-202d-4036-90bb-bf44a7a16aad@k2g2000yql.googlegroups.com> <57cf8f720904130710r6e0431deqab00c26182c218e1@mail.gmail.com> Message-ID: <29665a52-6c87-4ecd-96f1-3fa1a69ae002@w9g2000yqa.googlegroups.com> Thanks I see ... .. but if I connect my SEL_RIGHTBUTTONRELEASE handler to the FXDataTarget instead it should receive the message from FXText (I found out that FXTextField does not sends right button messages) , shouldn't it? I rewrote the application and SEL_CHANGED handler works but SEL_RIGHTBUTTONRELEASE - does not. Do I not understand something? :) Regards K require "rubygems" require "fox16" include Fox class MyProject < FXMainWindow def initialize (app, title) super(app,title, :opts=>DECOR_ALL^(DECOR_SHRINKABLE| DECOR_STRETCHABLE|DECOR_RESIZE)| LAYOUT_EXPLICIT,:width=>400,:height=>300) @female_target = FXDataTarget.new("") female_text = FXText.new(self,:target => @female_target, :selector => FXDataTarget::ID_VALUE, :opts => TEXTFIELD_NORMAL| TEXTFIELD_ENTER_ONLY| LAYOUT_EXPLICIT,:x=>85, :y=>12,:width=>120, :height=>25) @female_target.connect(SEL_RIGHTBUTTONRELEASE) do |sender, sel, event| puts "ooo" end @female_target.connect(SEL_CHANGED) do |sender, sel, data| if data.size>0 and @number_target.value.size>0 @submit_button.enable else @submit_button.disable end end @number_target = FXDataTarget.new("") number_text = FXTextField.new(self, 25,:target => @number_target, :selector => FXDataTarget::ID_VALUE, :opts => FRAME_NORMAL|TEXTFIELD_ENTER_ONLY| LAYOUT_EXPLICIT,:x=>85, :y=>47,:width=>90, :height=>25) @number_target.connect(SEL_CHANGED) do |sender, sel, data| if data.size >0 and @female_target.value.size>0 @submit_button.enable else @submit_button.disable end end @submit_button=FXButton.new (self,"Submit",:x=>85, :y=>180, :width=>300, :height=>24,:opts=>LAYOUT_EXPLICIT| BUTTON_NORMAL) @submit_button.connect(SEL_COMMAND) do end @submit_button.disable end def create super show(PLACEMENT_SCREEN) end end app = FXApp.new MyProject.new(app, "test") app.create app.run On Apr 13, 3:10?pm, Lyle Johnson wrote: > On Sun, Apr 12, 2009 at 10:49 PM, kwicher wrote: > > I have a following small program in which I am enabling or disabling a > > button depending on the presence of text in the text filed. I am using > > the FXDataTarget connected to the text field. I also want to add > > possibility to paste the data into text filed upon pressing right > > mouse button etc. Now, everything works fine until I try to connect > > the mouse button action to the text field, then the FXDataTarget stops > > working. > > Right. A widget (such as FXTextField) can only have one message target > at a time. The FXTextField cannot be connected to both the > FXDataTarget and the SEL_CHANGED handler (or the commented-out > SEL_RIGHTBUTTONPRESS handler). > _______________________________________________ > fxruby-users mailing list > fxruby-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/fxruby-users From lyle at lylejohnson.name Tue Apr 14 09:04:12 2009 From: lyle at lylejohnson.name (Lyle Johnson) Date: Tue, 14 Apr 2009 08:04:12 -0500 Subject: [fxruby-users] Strange behaviour of FXDataTarget connected to FXTextField In-Reply-To: <29665a52-6c87-4ecd-96f1-3fa1a69ae002@w9g2000yqa.googlegroups.com> References: <95beed56-202d-4036-90bb-bf44a7a16aad@k2g2000yql.googlegroups.com> <57cf8f720904130710r6e0431deqab00c26182c218e1@mail.gmail.com> <29665a52-6c87-4ecd-96f1-3fa1a69ae002@w9g2000yqa.googlegroups.com> Message-ID: <4FF27800-4D1E-457F-8E98-05E9C454FB09@lylejohnson.name> On Apr 13, 2009, at 6:26 PM, XY$ wrote: > Thanks I see ... > .. but if I connect my SEL_RIGHTBUTTONRELEASE handler to the > FXDataTarget instead it should receive the message from FXText (I > found out that FXTextField does not sends right button messages) , > shouldn't it? I'm pretty sure that FXDataTarget only forwards SEL_COMMAND and SEL_CHANGED messages to its target, so no, you wouldn't get the SEL_RIGHTBUTTONRELEASE message. From kwicher at gmail.com Tue Apr 14 12:24:54 2009 From: kwicher at gmail.com (XY$) Date: Tue, 14 Apr 2009 09:24:54 -0700 (PDT) Subject: [fxruby-users] Strange behaviour of FXDataTarget connected to FXTextField In-Reply-To: <4FF27800-4D1E-457F-8E98-05E9C454FB09@lylejohnson.name> References: <95beed56-202d-4036-90bb-bf44a7a16aad@k2g2000yql.googlegroups.com> <57cf8f720904130710r6e0431deqab00c26182c218e1@mail.gmail.com> <29665a52-6c87-4ecd-96f1-3fa1a69ae002@w9g2000yqa.googlegroups.com> <4FF27800-4D1E-457F-8E98-05E9C454FB09@lylejohnson.name> Message-ID: If it is like that, what should be the target for the FXText so that I can handle SEL_RIGHTBUTTONRELEASE message sent by it? Should the target be self? Thanks K On Apr 14, 2:04?pm, Lyle Johnson wrote: > On Apr 13, 2009, at 6:26 PM, XY$ wrote: > > > Thanks I see ... > > .. but if I connect my SEL_RIGHTBUTTONRELEASE handler to the > > FXDataTarget instead it should receive the message from FXText (I > > found out that FXTextField does not sends right button messages) , > > shouldn't it? > > I'm pretty sure that FXDataTarget only forwards SEL_COMMAND and ? > SEL_CHANGED messages to its target, so no, you wouldn't get the ? > SEL_RIGHTBUTTONRELEASE message. > _______________________________________________ > fxruby-users mailing list > fxruby-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/fxruby-users From lyle at lylejohnson.name Tue Apr 14 13:48:27 2009 From: lyle at lylejohnson.name (Lyle Johnson) Date: Tue, 14 Apr 2009 12:48:27 -0500 Subject: [fxruby-users] Strange behaviour of FXDataTarget connected to FXTextField In-Reply-To: References: <95beed56-202d-4036-90bb-bf44a7a16aad@k2g2000yql.googlegroups.com> <57cf8f720904130710r6e0431deqab00c26182c218e1@mail.gmail.com> <29665a52-6c87-4ecd-96f1-3fa1a69ae002@w9g2000yqa.googlegroups.com> <4FF27800-4D1E-457F-8E98-05E9C454FB09@lylejohnson.name> Message-ID: <57cf8f720904141048m1db9d580t25fdc73526c3eccd@mail.gmail.com> On Tue, Apr 14, 2009 at 11:24 AM, XY$ wrote: > If it is like that, what should be the target for the FXText so that I > can handle SEL_RIGHTBUTTONRELEASE message sent by it? Should the > target be self? Well, there's nothing special about it, but I'd probably just use an anonymous handler, e.g. text_widget.connect(SEL_RIGHTBUTTONRELEASE) do # handle right button release on text widget end Hope this helps, Lyle From kwicher at gmail.com Tue Apr 14 18:24:23 2009 From: kwicher at gmail.com (XY$) Date: Tue, 14 Apr 2009 15:24:23 -0700 (PDT) Subject: [fxruby-users] Strange behaviour of FXDataTarget connected to FXTextField In-Reply-To: <57cf8f720904141048m1db9d580t25fdc73526c3eccd@mail.gmail.com> References: <95beed56-202d-4036-90bb-bf44a7a16aad@k2g2000yql.googlegroups.com> <57cf8f720904130710r6e0431deqab00c26182c218e1@mail.gmail.com> <29665a52-6c87-4ecd-96f1-3fa1a69ae002@w9g2000yqa.googlegroups.com> <4FF27800-4D1E-457F-8E98-05E9C454FB09@lylejohnson.name> <57cf8f720904141048m1db9d580t25fdc73526c3eccd@mail.gmail.com> Message-ID: <1d16f124-0132-47aa-b155-9c432da87b12@j8g2000yql.googlegroups.com> Thanks a lot. I got it and it works. K On 14 Apr, 18:48, Lyle Johnson wrote: > On Tue, Apr 14, 2009 at 11:24 AM, XY$ wrote: > > If it is like that, what should be the target for the FXText so that I > > can handle SEL_RIGHTBUTTONRELEASE message sent by it? Should the > > target be self? > > Well, there's nothing special about it, but I'd probably just use an > anonymous handler, e.g. > > ? ? text_widget.connect(SEL_RIGHTBUTTONRELEASE) do > ? ? ? # handle right button release on text widget > ? ? end > > Hope this helps, > > Lyle > _______________________________________________ > fxruby-users mailing list > fxruby-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/fxruby-users From stuart_clarke86 at yahoo.com Thu Apr 23 14:10:39 2009 From: stuart_clarke86 at yahoo.com (Stuart Clarke) Date: Thu, 23 Apr 2009 18:10:39 +0000 (GMT) Subject: [fxruby-users] File opening alternatives Message-ID: <72692.10280.qm@web86603.mail.ird.yahoo.com> Hi all, IN FX, you can open an individual files using the normal file > open and se= lecting a file. I was wondering if it is possible to drag and drop a file i= nto a GUI and open it that way? Thanks in advance Stuar From eddyhkim at gmail.com Fri Apr 24 19:03:37 2009 From: eddyhkim at gmail.com (eddy) Date: Fri, 24 Apr 2009 16:03:37 -0700 Subject: [fxruby-users] custom widget (event) questions Message-ID: <49F24549.8040709@gmail.com> Hi all, First, kudos to Lyle for the nice work for the work bringing Fox to Ruby. I'm trying to create a custom widget that looks and acts like a regular pushbutton with some additional look and behavior. I don't think I can use a regular FXButton because I can't seem to style the text inside, or have bands of different colors. Eventually it will flash when an alarm goes off. I tried to create a custom widget like this: class PushB < FXVerticalFrame include Responder attr_accessor :header, :footer, :main_text def initialize(parent, dialog, opts = {}) @size = 100 @header_text, @footer_text, @main_text = nil,opts[:timer_type],opts[:main] @child = [] @dialog = dialog @o = opts super(parent, :opts=>FRAME_RAISED|FRAME_THICK|LAYOUT_FILL_Y|LAYOUT_CENTER_X|LAYOUT_CENTER_Y|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT, :width=>@size, :height=>@size, :padding=>0 ) FXMAPFUNC(SEL_LEFTBUTTONPRESS, 0, :on_left_click) @meta_button = self @meta_button.backColor = FXRGB(0,200,0) w = @size - 4 base_disp_opts = LAYOUT_CENTER_X|LAYOUT_SIDE_TOP|LAYOUT_FIX_HEIGHT|LAYOUT_FIX_WIDTH @child << FXLabel.new(@meta_button, @header_text||"", :width=>w, :height=>25, :opts=>base_disp_opts|FRAME_RAISED ) @child.last.connect(SEL_LEFTBUTTONPRESS, method(:on_left_click)) @child << FXLabel.new(@meta_button, @main_text||"", :width=>w,:height=>55, :opts=>base_disp_opts ) @child.last.connect(SEL_LEFTBUTTONPRESS, method(:on_left_click)) @child << FXLabel.new(@meta_button, @footer_text||"", :width=>w, :height=>25, :opts=>base_disp_opts|FRAME_RAISED ) @child.last.connect(SEL_LEFTBUTTONPRESS, method(:on_left_click)) set_normal_state enable end def set_normal_state @child[0].backColor= FXRGB(100,150,0) @child[2].backColor= FXRGB(100,150,0) end def set_alarm_state end def toggle_state end def on_left_click(sender, sel, event) puts "XXX buttonpress - #{sender} #{sel} #{event}" @dialog.execute end end Lots of hardcoded stuff since I'm just experimenting right now. Sorry for the horribly ugly code, but this is my first attempt at a FXRuby program. :) The widget is a square "button", made up of three FXLabel instances. Unfortunately, I haven't hit upon how to make the entire widget respond as one to a mouse click. The FXMAPFUNC call that I found in the list archives only works on the frame itself. Since the child elements take up all the space, they intercept the mouse click. So right now, each child is handling the event independently. How would one get the child elements to pass the click event to their parent? Then the major problem I haven't figured out yet... If I have more than one of these widgets, each one needs to know when it was clicked. Sounds like a good use for FXDataTarget, but passing :target to a label or frame causes mass panic and confusion :) Unrecognized parameter target (ArgumentError) What would the strategy be to get the target of the mouse click? The event object that is passed to on_left_click handler contains an FXEvent which has co-ordinates. That can't be right, but I haven't found any info on how to get the data target working for a fox object that is not expecting it. Is there some way to pass self as a parameter when connecting? ie. .connect(SEL_LEFTBUTTONPRESS, method(:xxx), self) Any pointers or tips greatly appreciated. TIA, Ed From lyle at lylejohnson.name Sat Apr 25 07:45:58 2009 From: lyle at lylejohnson.name (Lyle Johnson) Date: Sat, 25 Apr 2009 06:45:58 -0500 Subject: [fxruby-users] File opening alternatives In-Reply-To: <72692.10280.qm@web86603.mail.ird.yahoo.com> References: <72692.10280.qm@web86603.mail.ird.yahoo.com> Message-ID: On Apr 23, 2009, at 1:10 PM, Stuart Clarke wrote: > IN FX, you can open an individual files using the normal file > open > and se= > lecting a file. I was wondering if it is possible to drag and drop a > file i= > nto a GUI and open it that way? I know that that feature has been requested in the past, but as far as I know, you still can't drag a file from the Windows explorer and drop it onto a FOX (or FXRuby) application. This would require some changes in FOX to add support for that. From eddyhkim at gmail.com Sat Apr 25 15:20:59 2009 From: eddyhkim at gmail.com (eddy) Date: Sat, 25 Apr 2009 12:20:59 -0700 Subject: [fxruby-users] custom widget (Event) q's Message-ID: <49F3629B.1010802@gmail.com> Hi again, I think my example is probably not a good one for my question, as I *can* figure out what the parent is by looking up the instance variables, and do what I need to there. However, I'm am still curious as to the best way to use the fox message passing framework to send messages in general. As I understand it, the connect method is for specifying when receiving a message and I found a reference to sending or delegating messages in the regular Fox docs, using ->handle which doesn't work in ruby land. Thanks, Ed From rschaeff at comcast.net Sun Apr 26 17:12:39 2009 From: rschaeff at comcast.net (Rick Schaeffer) Date: Sun, 26 Apr 2009 14:12:39 -0700 (PDT) Subject: [fxruby-users] FXDialogBox - how to close Message-ID: <23236392.post@talk.nabble.com> I have an FXDialogBox that I want to programmatically close. I have been unable to figure out how to do it and am baffled! If I add an "Accept" button using this code: accept = FXButton.new(buttons, "&Accept", nil, self, ID_ACCEPT, FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y) the dialog exits properly when I hit the button. BUT...I don't want to have a button in the dialog. When the user selects an item from a listbox, I just want to do the same thing as "Accept". I have tried having the dialog close itself. The window closes but the parent window thinks it still exists (The dialog is "modal"). Nothing I have tried closes the dialog box and lets the parent window function normally. -- View this message in context: http://www.nabble.com/FXDialogBox---how-to-close-tp23236392p23236392.html Sent from the FXRuby Users mailing list archive at Nabble.com. From jeroen at fox-toolkit.org Sun Apr 26 23:47:23 2009 From: jeroen at fox-toolkit.org (Jeroen van der Zijp) Date: Sun, 26 Apr 2009 22:47:23 -0500 Subject: [fxruby-users] File opening alternatives In-Reply-To: <72692.10280.qm@web86603.mail.ird.yahoo.com> References: <72692.10280.qm@web86603.mail.ird.yahoo.com> Message-ID: <200904262247.23465.jeroen@fox-toolkit.org> On Thursday 23 April 2009, Stuart Clarke wrote: > > Hi all, > > IN FX, you can open an individual files using the normal file > open and se= > lecting a file. I was wondering if it is possible to drag and drop a file i= > nto a GUI and open it that way? Yes, but only under Unix/X11 when the other application [the one doing the dragging] supports XDND. The exception is if the other application is a FOX application; then it works on all platforms. - Jeroen -- +----------------------------------------------------------------------------+ | Copyright (C) 22:40 04/26/2009 Jeroen van der Zijp. All Rights Reserved. | +----------------------------------------------------------------------------+ From philippe.lang at attiksystem.ch Mon Apr 27 01:54:54 2009 From: philippe.lang at attiksystem.ch (Philippe Lang) Date: Mon, 27 Apr 2009 07:54:54 +0200 Subject: [fxruby-users] FXDialogBox - how to close References: <23236392.post@talk.nabble.com> Message-ID: fxruby-users-bounces at rubyforge.org wrote: > I have an FXDialogBox that I want to programmatically close. I have > been unable to figure out how to do it and am baffled! > > If I add an "Accept" button using this code: > > accept = FXButton.new(buttons, "&Accept", nil, self, ID_ACCEPT, > FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y) > > the dialog exits properly when I hit the button. BUT...I don't want > to have a button in the dialog. When the user selects an item from a > listbox, I just want to do the same thing as "Accept". I have tried > having the dialog close itself. The window closes but the parent > window thinks it still exists (The dialog is "modal"). Nothing I > have tried closes the dialog box and lets the parent window function > normally. Hi, Maybe you can try this: # Closes the dialog. def closeDialog close $app.stopModal end ... where $app is your application object. Best regards, Philippe Lang Attik System From rschaeff at comcast.net Mon Apr 27 10:21:20 2009 From: rschaeff at comcast.net (Frederick Schaeffer) Date: Mon, 27 Apr 2009 07:21:20 -0700 Subject: [fxruby-users] FXDialogBox - how to close In-Reply-To: References: <23236392.post@talk.nabble.com> Message-ID: <000f01c9c743$6f9d8420$4ed88c60$@net> That WORKS!!!!! Thank you SOOOOOO much!! It never occurred to me to look in the FXApp class!! Rick Schaeffer -----Original Message----- From: fxruby-users-bounces at rubyforge.org [mailto:fxruby-users-bounces at rubyforge.org] On Behalf Of Philippe Lang Sent: Sunday, April 26, 2009 10:55 PM To: fxruby-users at rubyforge.org Subject: Re: [fxruby-users] FXDialogBox - how to close fxruby-users-bounces at rubyforge.org wrote: > I have an FXDialogBox that I want to programmatically close. I have > been unable to figure out how to do it and am baffled! > > If I add an "Accept" button using this code: > > accept = FXButton.new(buttons, "&Accept", nil, self, ID_ACCEPT, > FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y) > > the dialog exits properly when I hit the button. BUT...I don't want > to have a button in the dialog. When the user selects an item from a > listbox, I just want to do the same thing as "Accept". I have tried > having the dialog close itself. The window closes but the parent > window thinks it still exists (The dialog is "modal"). Nothing I > have tried closes the dialog box and lets the parent window function > normally. Hi, Maybe you can try this: # Closes the dialog. def closeDialog close $app.stopModal end ... where $app is your application object. Best regards, Philippe Lang Attik System _______________________________________________ fxruby-users mailing list fxruby-users at rubyforge.org http://rubyforge.org/mailman/listinfo/fxruby-users From lyle at lylejohnson.name Mon Apr 27 14:47:20 2009 From: lyle at lylejohnson.name (Lyle Johnson) Date: Mon, 27 Apr 2009 13:47:20 -0500 Subject: [fxruby-users] custom widget (Event) q's In-Reply-To: <49F3629B.1010802@gmail.com> References: <49F3629B.1010802@gmail.com> Message-ID: <5557D89E-9A2F-4752-83B5-D3F672620D13@lylejohnson.name> On Apr 25, 2009, at 2:20 PM, eddy wrote: > However, I'm am still curious as to the best way to use the fox > message passing framework to send messages in general. As I > understand it, the connect method is for specifying when receiving a > message and I found a reference to sending or delegating messages in > the regular Fox docs, using ->handle which doesn't work in ruby land. When you call connect(), e.g. widget.connect(SEL_COMMAND) { ... } what happens is that FXRuby creates an "anonymous" target object who responds to the SEL_COMMAND message by executing your passed-in code block. It then makes this newly-created object the target of "widget". A call to connect() is thus a quick-and-dirty way to provide a message handler for the message(s) sent by a widget. If you want to send a message to a widget (or more generally any FOX object), you should be able to use handle(): receiver.handle(sender, FXSEL(SEL_COMMAND, message_identifier), message_data) Here, "receiver" is the object that will receive the message. There are admittedly a bunch of different combinations of how this could work, and we probably don't cover all of those cases in the FXRuby-to- FOX binding. If you discover that a particular combination of interest isn't working, please submit a bug report and (preferably) a patch to fix it. Hope this helps, Lyle From eddyhkim at gmail.com Mon Apr 27 16:15:20 2009 From: eddyhkim at gmail.com (eddy) Date: Mon, 27 Apr 2009 13:15:20 -0700 Subject: [fxruby-users] custom widget (Event) q's In-Reply-To: <5557D89E-9A2F-4752-83B5-D3F672620D13@lylejohnson.name> References: <49F3629B.1010802@gmail.com> <5557D89E-9A2F-4752-83B5-D3F672620D13@lylejohnson.name> Message-ID: <49F61258.30602@gmail.com> Thanks for the info. That explanation makes it simple. As I get further into this, I'm sure I'll get confused again :) Good book btw, any plans on a vol 2, for advanced FXRuby? From lyle at lylejohnson.name Mon Apr 27 17:19:23 2009 From: lyle at lylejohnson.name (Lyle Johnson) Date: Mon, 27 Apr 2009 16:19:23 -0500 Subject: [fxruby-users] custom widget (Event) q's In-Reply-To: <49F61258.30602@gmail.com> References: <49F3629B.1010802@gmail.com> <5557D89E-9A2F-4752-83B5-D3F672620D13@lylejohnson.name> <49F61258.30602@gmail.com> Message-ID: <8FA3E0A4-6C83-47EE-A16D-44F32FED1C71@lylejohnson.name> On Apr 27, 2009, at 3:15 PM, eddy wrote: > Thanks for the info. That explanation makes it simple. As I get > further into this, I'm sure I'll get confused again :) > > Good book btw, any plans on a vol 2, for advanced FXRuby? Thanks, I'm glad you enjoyed the FXRuby book. I'd like to find some time to publish some articles on advanced FXRuby topics, but a follow- up book seems unlikely. The first book has sold better than I ever hoped it would, but it's not exactly a bestseller either. I'm doubtful that the publisher would be interested in a "sequel". ;) From rps at salas.com Tue Apr 28 10:53:15 2009 From: rps at salas.com (Pito Salas) Date: Tue, 28 Apr 2009 10:53:15 -0400 Subject: [fxruby-users] Install question on Mac Message-ID: Hi all, This question has come through before, but I can't come up with a solution based on reading many threads etc so please bear with me with a simple question. I am on Mac, and manage my installs via port and gems. Here's the state of things: ... I seem to have Fox itself properly installed: $ port info foxfox @1.6.34, Revision 1 (x11) Variants: universal FOX is a C++ based Toolkit for developing Graphical User Interfaces easily and effectively. Homepage: http://www.fox-toolkit.org/ Build Dependencies: pkgconfig Library Dependencies: tiff, libpng, jpeg, xorg-libXcursor, Xft2, xorg-libXrandr, freetype Platforms: darwin Maintainers: lyle at lylejohnson.name ... I also seem to have the gem properly installed: $gem list fxruby *** LOCAL GEMS *** fxruby (1.6.19) $ ... and yet when I run this hello world example: require 'fox16' include Fox theApp = FXApp.new theMainWindow = FXMainWindow.new(theApp, "Hello") theApp.create theMainWindow.show theApp.run ... I get this obnoxious error $ ruby play1.rb /opt/local/lib/ruby/gems/1.8/gems/fxruby-1.6.19-universal-darwin-9/ext/fox16/fox16.bundle: dlopen(/opt/local/lib/ruby/gems/1.8/gems/fxruby-1.6.19-universal-darwin-9/ext/fox16/fox16.bundle, 9): Library not loaded: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/libruby.1.dylib (LoadError) Referenced from: /opt/local/lib/ruby/gems/1.8/gems/fxruby-1.6.19-universal-darwin-9/ext/fox16/fox16.bundle Reason: image not found - /opt/local/lib/ruby/gems/1.8/gems/fxruby-1.6.19-universal-darwin-9/ext/fox16/fox16.bundle from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require' from play1.rb:1 $ QUESTIONS: - can anyone see what's wrong? - is the fact that the port install of Fox says "X11" mean that there's no native mac binding for fox? Thanks!! Pito From eddyhkim at gmail.com Tue Apr 28 11:38:04 2009 From: eddyhkim at gmail.com (eddy) Date: Tue, 28 Apr 2009 08:38:04 -0700 Subject: [fxruby-users] Install question on Mac In-Reply-To: References: Message-ID: <49F722DC.1000006@gmail.com> I don't have a mac, but on my linux setups I need to require 'rubygems' before require 'fox16'. Maybe it's the same on macos? Hmmm maybe I should go buy a mac and find out. Pito Salas wrote: > Hi all, > > This question has come through before, but I can't come up with a > solution based on reading many threads etc so please bear with me with > a simple question. I am on Mac, and manage my installs via port and > gems. Here's the state of things: > From lyle at lylejohnson.name Tue Apr 28 11:48:39 2009 From: lyle at lylejohnson.name (Lyle Johnson) Date: Tue, 28 Apr 2009 10:48:39 -0500 Subject: [fxruby-users] Install question on Mac In-Reply-To: References: Message-ID: On Apr 28, 2009, at 9:53 AM, Pito Salas wrote: > This question has come through before, but I can't come up with a > solution based on reading many threads etc so please bear with me with > a simple question. I am on Mac, and manage my installs via port and > gems. Here's the state of things: Based on the error messages, it looks like: * You're running the MacPorts version of Ruby (not the Ruby that's included with OS X Leopard) * You've installed the (binary) FXRuby gem for OS X, which is built against the regular OS X Leopard. In other words: The gem that you've installed depends on the OS X Ruby, and since that's not the same Ruby that you're using to load it, it breaks. So you have a couple of options here. One option is to drop back to using the Ruby that's included with OS X. In this case you just need to uninstall Ruby from your MacPorts installation (or at least monkey with the PATH settings so that it finds the OS X version of Ruby before it finds the MacPorts version), then install the FXRuby gem into that environment. Since you're a MacPorts fan (as am I), I'm guessing you don't want that option. In that case, you should first uninstall the FXRuby binary gem (since that's not going to work anyways). Next, the easiest path is probably to install FXRuby from the MacPorts package: sudo port install rb-fxruby If you'd rather install it from the sources, you'll need to make sure to specify the "ruby" platform when invoking the "gem install" command, e.g. sudo gem install fxruby --platform ruby Note that this option is somewhat more fragile, since you have to take care of all the dependencies yourself. I'd recommend just using the MacPorts port since you're already set up for that anyways. > - is the fact that the port install of Fox says "X11" mean that > there's no native mac binding for fox? Correct, there's no "native" OS X port of FOX. From lyle at lylejohnson.name Tue Apr 28 12:12:13 2009 From: lyle at lylejohnson.name (Lyle Johnson) Date: Tue, 28 Apr 2009 11:12:13 -0500 Subject: [fxruby-users] Install question on Mac In-Reply-To: <49F722DC.1000006@gmail.com> References: <49F722DC.1000006@gmail.com> Message-ID: <3F7A71AA-086F-4B29-8C8C-66608BE97211@lylejohnson.name> On Apr 28, 2009, at 10:38 AM, eddy wrote: > I don't have a mac, but on my linux setups I need to require > 'rubygems' before require 'fox16'. Maybe it's the same on macos? That's a separate issue, I think. If you've installed FXRuby (or anything else) via RubyGems, you need to ensure that the Ruby interpreter loads up the RubyGems runtime at startup. One way is to (as you discovered) always include: require 'rubygems' at the top of your programs. An easier way (IMO) is to modify your RUBYOPT environment variable to include this, e.g. export RUBYOPT="-rubygems" Note that this is a "RubyGems thing", and not an "FXRuby thing". Hope this helps, Lyle From rps at salas.com Tue Apr 28 14:09:39 2009 From: rps at salas.com (Pito Salas) Date: Tue, 28 Apr 2009 14:09:39 -0400 Subject: [fxruby-users] Install question on Mac In-Reply-To: References: Message-ID: Lyle Thanks... Your diagnosis sounds correct. Indeed I would prefer to use everything via mac ports. One thing I don't understand though, maybe you can clarify. If I use MacPorts to install FxRuby like you say: $ sudo port install rb-fxruby Am I installing a gem or installing fx ruby in some other place? To keep my sanity I've tried to install with gem everything that's a gem, and with ports everything else. That way when I uninstall I know where to go and in theory I have one less possible path problem. Thanks! - Pito On Tue, Apr 28, 2009 at 11:48 AM, Lyle Johnson wrote: > > On Apr 28, 2009, at 9:53 AM, Pito Salas wrote: > >> This question has come through before, but I can't come up with a >> solution based on reading many threads etc so please bear with me with >> a simple question. I am on Mac, and manage my installs via port and >> gems. Here's the state of things: > > > > Based on the error messages, it looks like: > > ?* You're running the MacPorts version of Ruby (not the Ruby that's included > with OS X Leopard) > ?* You've installed the (binary) FXRuby gem for OS X, which is built against > the regular OS X Leopard. > > In other words: The gem that you've installed depends on the OS X Ruby, and > since that's not the same Ruby that you're using to load it, it breaks. So > you have a couple of options here. > > One option is to drop back to using the Ruby that's included with OS X. In > this case you just need to uninstall Ruby from your MacPorts installation > (or at least monkey with the PATH settings so that it finds the OS X version > of Ruby before it finds the MacPorts version), then install the FXRuby gem > into that environment. > > Since you're a MacPorts fan (as am I), I'm guessing you don't want that > option. In that case, you should first uninstall the FXRuby binary gem > (since that's not going to work anyways). Next, the easiest path is probably > to install FXRuby from the MacPorts package: > > ? ? ? ?sudo port install rb-fxruby > > If you'd rather install it from the sources, you'll need to make sure to > specify the "ruby" platform when invoking the "gem install" command, e.g. > > ? ? ? ?sudo gem install fxruby --platform ruby > > Note that this option is somewhat more fragile, since you have to take care > of all the dependencies yourself. I'd recommend just using the MacPorts port > since you're already set up for that anyways. > >> - is the fact that the port install of Fox says "X11" mean that there's no >> native mac binding for fox? > > Correct, there's no "native" OS X port of FOX. > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users > From lyle at lylejohnson.name Tue Apr 28 14:53:08 2009 From: lyle at lylejohnson.name (Lyle Johnson) Date: Tue, 28 Apr 2009 13:53:08 -0500 Subject: [fxruby-users] Install question on Mac In-Reply-To: References: Message-ID: <57cf8f720904281153w10e660ffvcb091b28eaf86ddc@mail.gmail.com> On Tue, Apr 28, 2009 at 1:09 PM, Pito Salas wrote: > Thanks... Your diagnosis sounds correct. Indeed I would prefer to use > everything via mac ports. > > One thing I don't understand though, maybe you can clarify. > > If I use MacPorts to install FxRuby like you say: > > $ sudo port install rb-fxruby > > Am I installing a gem or installing fx ruby in some other place? Ah, good question. If you install FXRuby via MacPorts, you are indeed installing it in "some other place", namely, under: /opt/local/lib/ruby/site_ruby/1.8 > To keep my sanity I've tried to install with gem everything that's a > gem, and with ports everything else. That way when I uninstall I know > where to go and in theory I have one less possible path problem. Sure, I understand. Well, you can cross your fingers and try installing via the source gem, then. For some people this works very smoothly and for others it's sort of a disaster. export CPPFLAGS="-I/opt/local/include" export ARCHFLAGS="-arch i386 -L/opt/local/lib" sudo gem install fxruby --platform ruby The first two lines set up some environment variables so that the build from source code knows to look in MacPorts for the FOX (and related) dependencies (instead of in, say, /usr/local). By passing the "--platform ruby" command line switch to the "gem install" command, you're telling RubyGems to pick the source gem instead of the binary gem (which, per my earlier e-mail, is incompatible with Ruby from MacPorts). Good luck, and let me know how it goes, Lyle From rps at salas.com Wed Apr 29 10:12:32 2009 From: rps at salas.com (Pito Salas) Date: Wed, 29 Apr 2009 10:12:32 -0400 Subject: [fxruby-users] Install question on Mac In-Reply-To: <57cf8f720904281153w10e660ffvcb091b28eaf86ddc@mail.gmail.com> References: <57cf8f720904281153w10e660ffvcb091b28eaf86ddc@mail.gmail.com> Message-ID: Lyle Thanks for your help. I ended up installing it via ports like you originally suggested. Seemed the safer and easier way to go. And it worked flawlessly and so I am up and running. As a general rule, as a ruby developer, do you use ports instead of gems or what is your policy? Another question, it looks like the X Window package is launched on Mac to display UI. Is that the way FX always works or is it just a mac thing? I am assessing what gui package to make the effort to learn and at this point I have it down to WxRyby and FxRuby. Any words of advice? Thanks! Pito On Tue, Apr 28, 2009 at 2:53 PM, Lyle Johnson wrote: > On Tue, Apr 28, 2009 at 1:09 PM, Pito Salas wrote: > >> Thanks... Your diagnosis sounds correct. Indeed I would prefer to use >> everything via mac ports. >> >> One thing I don't understand though, maybe you can clarify. >> >> If I use MacPorts to install FxRuby like you say: >> >> $ sudo port install rb-fxruby >> >> Am I installing a gem or installing fx ruby in some other place? > > Ah, good question. If you install FXRuby via MacPorts, you are indeed > installing it in "some other place", namely, under: > > ? ?/opt/local/lib/ruby/site_ruby/1.8 > >> To keep my sanity I've tried to install with gem everything that's a >> gem, and with ports everything else. That way when I uninstall I know >> where to go and in theory I have one less possible path problem. > > Sure, I understand. Well, you can cross your fingers and try > installing via the source gem, then. For some people this works very > smoothly and for others it's sort of a disaster. > > ? ?export CPPFLAGS="-I/opt/local/include" > ? ?export ARCHFLAGS="-arch i386 -L/opt/local/lib" > ? ?sudo gem install fxruby --platform ruby > > The first two lines set up some environment variables so that the > build from source code knows to look in MacPorts for the FOX (and > related) dependencies (instead of in, say, /usr/local). By passing the > "--platform ruby" command line switch to the "gem install" command, > you're telling RubyGems to pick the source gem instead of the binary > gem (which, per my earlier e-mail, is incompatible with Ruby from > MacPorts). > > Good luck, and let me know how it goes, > > Lyle > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users > From lyle at lylejohnson.name Wed Apr 29 11:00:50 2009 From: lyle at lylejohnson.name (Lyle Johnson) Date: Wed, 29 Apr 2009 10:00:50 -0500 Subject: [fxruby-users] Install question on Mac In-Reply-To: References: <57cf8f720904281153w10e660ffvcb091b28eaf86ddc@mail.gmail.com> Message-ID: <7D31A3E6-73EA-473A-842D-6B7B283BD93A@lylejohnson.name> On Apr 29, 2009, at 9:12 AM, Pito Salas wrote: > Thanks for your help. I ended up installing it via ports like you > originally suggested. Seemed the safer and easier way to go. And it > worked flawlessly and so I am up and running. > > As a general rule, as a ruby developer, do you use ports instead of > gems or what is your policy? No, I actually use gems most of the time. It's the more flexible option (in my opinion), although it occasionally requires a little more work on my part (in terms of tracking down dependencies and things like that). > Another question, it looks like the X Window package is launched on > Mac to display UI. Is that the way FX always works or is it just a mac > thing? It's a Mac thing. I'm not sure exactly when it gets triggered, but I'm guessing that as soon as you call XOpenDisplay(), if the X server isn't running yet, it gets launched. > I am assessing what gui package to make the effort to learn and at > this point I have it down to WxRuby and FxRuby. Any words of advice? I am a lousy evangelist, so I'm not going to try to convince you either way. WxRuby is a fine GUI toolkit for Ruby (as are Shoes and several others). I like FOX because it's lightweight, and very fast, and easy to extend. I've also spent a lot of time poring over FOX's source code, and I know how good it is. So for various reasons, FOX is what clicked with me. But my advice for you is that you write one or two non-trivial sample applications using each (WxRuby and FXRuby) and then go with your gut. Which one makes more sense to you as a developer, that sort of thing. I mean, that's what I would do if I were in your shoes.