From philippe.lang at attiksystem.ch Tue Oct 3 06:52:45 2006 From: philippe.lang at attiksystem.ch (Philippe Lang) Date: Tue, 3 Oct 2006 12:52:45 +0200 Subject: [fxruby-users] Add a tab to a tabbok dynamically? Message-ID: <6C0CF58A187DA5479245E0830AF84F421D130B@poweredge.attiksystem.ch> Hi, I cannot figure out how to add a tab to a tabbook dynamically, while the program is running. Does anyone know how to force the tab to appear? I tried calling recalc, repaint, layout or forceRefresh, but no success... Below is a small example. Thanks! Philippe P.S. Windows XP SP2, Ruby 1.8.4, FXRuby-1.6.2-ruby184.exe ----------------------------- #!/usr/bin/ruby require 'fox16' include Fox class MyWindow < FXMainWindow def initialize(app) super(app, "Window", nil, nil, DECOR_ALL, 0, 0, 600, 350) # Menu bar stretched along the top of the main window menubar = FXMenuBar.new(self, LAYOUT_SIDE_TOP|LAYOUT_FILL_X) # File menu filemenu = FXMenuPane.new(self) FXMenuTitle.new(menubar, "&File", nil, filemenu) FXMenuCommand.new(filemenu, "&Quit\tCtl-Q\tQuit the application", nil, app, FXApp::ID_QUIT) # Tab menu tabmenu = FXMenuPane.new(self) FXMenuTitle.new(menubar, "Tab", nil, tabmenu) FXMenuCommand.new(tabmenu, "Add a tab").connect(SEL_COMMAND, method(:onAddTab)) # Tabbook @tabbook = FXTabBook.new(self, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_RIGHT) # First tab FXTabItem.new(@tabbook, "Tab 1", nil) FXVerticalFrame.new(@tabbook, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_THICK|FRAME_RAISED) end def onAddTab(sender, sel, data) puts "A tab is added..." FXTabItem.new(@tabbook, "Another tab", nil) FXVerticalFrame.new(@tabbook, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_THICK|FRAME_RAISED) self.recalc self.repaint self.layout self.forceRefresh @tabbook.recalc @tabbook.repaint @tabbook.layout @tabbook.forceRefresh end def create super show(PLACEMENT_SCREEN) end end if __FILE__ == $0 application = FXApp.new("Attik System", "FXRuby Test") MyWindow.new(application) application.create application.run end --------------- Philippe Lang Attik System -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3125 bytes Desc: not available Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20061003/3312b620/attachment.bin From lyle at knology.net Tue Oct 3 08:48:41 2006 From: lyle at knology.net (Lyle Johnson) Date: Tue, 3 Oct 2006 07:48:41 -0500 Subject: [fxruby-users] Add a tab to a tabbok dynamically? In-Reply-To: <6C0CF58A187DA5479245E0830AF84F421D130B@poweredge.attiksystem.ch> References: <6C0CF58A187DA5479245E0830AF84F421D130B@poweredge.attiksystem.ch> Message-ID: <338A7D4A-BBA7-467A-93C4-E9B5E327152C@knology.net> On Oct 3, 2006, at 5:52 AM, Philippe Lang wrote: > I cannot figure out how to add a tab to a tabbook dynamically, > while the program is running. > > Does anyone know how to force the tab to appear? I tried calling > recalc, repaint, layout or forceRefresh, but no success... Below is > a small example. > def onAddTab(sender, sel, data) > puts "A tab is added..." > FXTabItem.new(@tabbook, "Another tab", nil) > FXVerticalFrame.new(@tabbook, > LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_THICK|FRAME_RAISED) > > self.recalc > self.repaint > self.layout > self.forceRefresh > > @tabbook.recalc > @tabbook.repaint > @tabbook.layout > @tabbook.forceRefresh > end You need to call create() on the new tab item and vertical frame. Another way would be to call create() on their parent (@tabbook). You don't need any of that other stuff (i.e. the calls to recalc, repaint, layout and forceRefresh). From jeroen at fox-toolkit.org Tue Oct 3 09:40:29 2006 From: jeroen at fox-toolkit.org (Jeroen van der Zijp) Date: Tue, 3 Oct 2006 08:40:29 -0500 Subject: [fxruby-users] Add a tab to a tabbok dynamically? In-Reply-To: <6C0CF58A187DA5479245E0830AF84F421D130B@poweredge.attiksystem.ch> References: <6C0CF58A187DA5479245E0830AF84F421D130B@poweredge.attiksystem.ch> Message-ID: <200610030840.29298.jeroen@fox-toolkit.org> On Tuesday 03 October 2006 05:52, Philippe Lang wrote: > Hi, > > I cannot figure out how to add a tab to a tabbook dynamically, while the program is running. > > Does anyone know how to force the tab to appear? I tried calling recalc, repaint, layout or forceRefresh, but no success... Below is a small example. > > Thanks! > > Philippe > > P.S. Windows XP SP2, Ruby 1.8.4, FXRuby-1.6.2-ruby184.exe > > ----------------------------- > > #!/usr/bin/ruby > > require 'fox16' > > include Fox > > class MyWindow < FXMainWindow > > def initialize(app) > > super(app, "Window", nil, nil, DECOR_ALL, 0, 0, 600, 350) > > # Menu bar stretched along the top of the main window > menubar = FXMenuBar.new(self, LAYOUT_SIDE_TOP|LAYOUT_FILL_X) > > # File menu > filemenu = FXMenuPane.new(self) > FXMenuTitle.new(menubar, "&File", nil, filemenu) > FXMenuCommand.new(filemenu, "&Quit\tCtl-Q\tQuit the application", > nil, app, FXApp::ID_QUIT) > > # Tab menu > tabmenu = FXMenuPane.new(self) > FXMenuTitle.new(menubar, "Tab", nil, tabmenu) > FXMenuCommand.new(tabmenu, "Add a tab").connect(SEL_COMMAND, method(:onAddTab)) > > # Tabbook > @tabbook = FXTabBook.new(self, nil, 0, > LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_RIGHT) > > # First tab > FXTabItem.new(@tabbook, "Tab 1", nil) > FXVerticalFrame.new(@tabbook, > LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_THICK|FRAME_RAISED) > > end > > def onAddTab(sender, sel, data) > puts "A tab is added..." > FXTabItem.new(@tabbook, "Another tab", nil) > FXVerticalFrame.new(@tabbook, > LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_THICK|FRAME_RAISED) > > self.recalc > self.repaint > self.layout > self.forceRefresh > > @tabbook.recalc > @tabbook.repaint > @tabbook.layout > @tabbook.forceRefresh > end > > def create > super > show(PLACEMENT_SCREEN) > end > > end > > if __FILE__ == $0 > application = FXApp.new("Attik System", "FXRuby Test") > MyWindow.new(application) > application.create > application.run > end If you add new widgets on the fly, don't forget to .create them. The ones that exist at the time you call application.create will be recursively created, new ones weren't part of the widget tree yet at that time. You were right about recalc, although you should call it on the widget you added the new children to [in this case, tabbook. The call to recalc flags the tabbook's layout as "dirty", and when control returns to the event loop it will perform a layout on the dialog. In FOX, layouts are delayed, which means you can make many changes to your widget tree, but incur the cost of the [expensive] layout only a single time. Its therefore very rare that you want to call layout directly; most of the time recalc suffices. Recalc is cheap because all it does is set dirty flags on a couple of widgets. - Jeroen From philippe.lang at attiksystem.ch Tue Oct 3 09:46:54 2006 From: philippe.lang at attiksystem.ch (Philippe Lang) Date: Tue, 3 Oct 2006 15:46:54 +0200 Subject: [fxruby-users] Add a tab to a tabbok dynamically? Message-ID: <6C0CF58A187DA5479245E0830AF84F421D130D@poweredge.attiksystem.ch> Jeroen van der Zijp wrote: > If you add new widgets on the fly, don't forget to .create > them. The ones that exist at the time you call > application.create will be recursively created, new ones > weren't part of the widget tree yet at that time. > > You were right about recalc, although you should call it on > the widget you added the new children to [in this case, > tabbook. The call to recalc flags the tabbook's layout as > "dirty", and when control returns to the event loop it will > perform a layout on the dialog. > > In FOX, layouts are delayed, which means you can make many > changes to your widget tree, but incur the cost of the > [expensive] layout only a single time. > > Its therefore very rare that you want to call layout > directly; most of the time recalc suffices. Recalc is cheap > because all it does is set dirty flags on a couple of widgets. It works great, thanks a lot for your help. Cheers, --------------- Philippe Lang Attik System -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3125 bytes Desc: not available Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20061003/b468b846/attachment.bin From philippe.lang at attiksystem.ch Tue Oct 3 11:34:13 2006 From: philippe.lang at attiksystem.ch (Philippe Lang) Date: Tue, 3 Oct 2006 17:34:13 +0200 Subject: [fxruby-users] FXDataTarget & widget value update delay Message-ID: <6C0CF58A187DA5479245E0830AF84F421D130E@poweredge.attiksystem.ch> Hi, When assigning a new value to an FXDataTarget programmatically, it takes a certain time for the widget linked to this FXDataTarget to be updated, just as if there was some sort of "polling" inside the framework. Delay can be as long as 1 second sometimes. Why aren't the widgets updated straight away? --------------- Philippe Lang Attik System -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3125 bytes Desc: not available Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20061003/49ae9bb9/attachment.bin From jeroen at fox-toolkit.org Tue Oct 3 14:24:07 2006 From: jeroen at fox-toolkit.org (Jeroen van der Zijp) Date: Tue, 3 Oct 2006 13:24:07 -0500 Subject: [fxruby-users] FXDataTarget & widget value update delay In-Reply-To: <6C0CF58A187DA5479245E0830AF84F421D130E@poweredge.attiksystem.ch> References: <6C0CF58A187DA5479245E0830AF84F421D130E@poweredge.attiksystem.ch> Message-ID: <200610031324.08608.jeroen@fox-toolkit.org> On Tuesday 03 October 2006 10:34, Philippe Lang wrote: > Hi, > > When assigning a new value to an FXDataTarget programmatically, it takes a certain time for the widget linked to this FXDataTarget to be updated, just as if there was some sort of "polling" inside the framework. Delay can be as long as 1 second sometimes. Why aren't the widgets updated straight away? The GUI gets updated when the event loop is about to block for events; as long as there are events [keyboard, mouse, repaints, etc], the event loop processes those with priority. When all queued-up events have been processed, one would normally go to a blocking state [i.e. yield the CPU in some system call waiting on the event queue]. In FOX we don't yield YET; we instead iterate over the widget tree, and send a SEL_UPDATE to the target of each widget. Once we've gone through the entire widget tree, THEN we block and yield the CPU. Of course, each time we update one widget, we check for events again, to ensure that the application reacts instantly when something happens. The updating process is therefore mostly invisible in the sense that interactive performance is not affected by it:- the only time we do updates is when there's nothing else we would be doing anyway. However, this does have a few repercussions on the frequency of updates; in a very busy system with a large number of widgets it may take some time before an entire cycle through the widget tree is completed. For this reason, its important to keep the update-handlers small and to avoid unnecessary work in then whenever possible. The code in getNextEvent() is finely tuned to get great performance, but of course I'm not the one writing the update handlers! That is up to the software developer himself; it helps to know what to do and what to avoid. Hence this mail. Regards - Jeroen From philippe.lang at attiksystem.ch Tue Oct 3 16:40:32 2006 From: philippe.lang at attiksystem.ch (Philippe Lang) Date: Tue, 3 Oct 2006 22:40:32 +0200 Subject: [fxruby-users] FXDataTarget & widget value update delay Message-ID: <6C0CF58A187DA5479245E0830AF84F421D1313@poweredge.attiksystem.ch> Jeroen van der Zijp wrote: > On Tuesday 03 October 2006 10:34, Philippe Lang wrote: >> Hi, >> >> When assigning a new value to an FXDataTarget > programmatically, it takes a certain time for the widget > linked to this FXDataTarget to be updated, just as if there > was some sort of "polling" inside the framework. Delay can be > as long as 1 second sometimes. Why aren't the widgets updated > straight away? > > The GUI gets updated when the event loop is about to block > for events; as long as there are events [keyboard, mouse, > repaints, etc], the event loop processes those with priority. > > When all queued-up events have been processed, one would > normally go to a blocking state [i.e. yield the CPU in some > system call waiting on the event queue]. In FOX we don't > yield YET; we instead iterate over the widget tree, and send > a SEL_UPDATE to the target of each widget. > > Once we've gone through the entire widget tree, THEN we block > and yield the CPU. Of course, each time we update one > widget, we check for events again, to ensure that the > application reacts instantly when something happens. > > The updating process is therefore mostly invisible in the > sense that interactive performance is not affected by it:- > the only time we do updates is when there's nothing else we would be > doing anyway. > > However, this does have a few repercussions on the frequency > of updates; in a very busy system with a large number of > widgets it may take some time before an entire cycle through the > widget tree is completed. > > For this reason, its important to keep the update-handlers > small and to avoid unnecessary work in then whenever possible. > > The code in getNextEvent() is finely tuned to get great > performance, but of course I'm not the one writing the update > handlers! That is up to the software developer himself; it > helps to know what to do and what to avoid. Hence this mail. Hi, thanks for your answer! Following your explanation, I finally decided to refresh my widgets manually, when speed is a concern, simply by sending them a SEL_UPDATE message, just after the data target was changed, programatically: .handle(self, FXSEL(SEL_UPDATE, 0), nil) Works just fine, widgets get updated instantaneously now. But really, I still do not understand why the widget refresh is so slow, and so "random". Sometimes very quick, sometimes near a second. I don't have a Pentium II 166 with 16MB RAM, I can assure you, and the application is not that big for the moment. Maybe it's a "Ruby" effect? --------------- Philippe Lang Attik System -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3125 bytes Desc: not available Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20061003/2d8c5e97/attachment-0001.bin From vjoel at path.berkeley.edu Tue Oct 3 13:18:38 2006 From: vjoel at path.berkeley.edu (Joel VanderWerf) Date: Tue, 03 Oct 2006 10:18:38 -0700 Subject: [fxruby-users] FXDataTarget & widget value update delay In-Reply-To: <6C0CF58A187DA5479245E0830AF84F421D130E@poweredge.attiksystem.ch> References: <6C0CF58A187DA5479245E0830AF84F421D130E@poweredge.attiksystem.ch> Message-ID: <45229B6E.6040907@path.berkeley.edu> Philippe Lang wrote: > Hi, > > When assigning a new value to an FXDataTarget programmatically, it > takes a certain time for the widget linked to this FXDataTarget to be > updated, just as if there was some sort of "polling" inside the > framework. Delay can be as long as 1 second sometimes. Why aren't the > widgets updated straight away? This is one reason I wrote foxtails: http://redshift.sourceforge.net/foxtails/ http://redshift.sourceforge.net/foxtails/doc/api/index.html See the examples dir. Also, it has a more ruby-like interface (IMO). -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407 From philippe.lang at attiksystem.ch Tue Oct 3 17:51:35 2006 From: philippe.lang at attiksystem.ch (Philippe Lang) Date: Tue, 3 Oct 2006 23:51:35 +0200 Subject: [fxruby-users] FXDataTarget & widget value update delay Message-ID: <6C0CF58A187DA5479245E0830AF84F421D1314@poweredge.attiksystem.ch> Jeroen van der Zijp wrote: > On Tuesday 03 October 2006 10:34, Philippe Lang wrote: >> Hi, >> >> When assigning a new value to an FXDataTarget > programmatically, it takes a certain time for the widget > linked to this FXDataTarget to be updated, just as if there > was some sort of "polling" inside the framework. Delay can be > as long as 1 second sometimes. Why aren't the widgets updated > straight away? > > The GUI gets updated when the event loop is about to block > for events; as long as there are events [keyboard, mouse, > repaints, etc], the event loop processes those with priority. > > When all queued-up events have been processed, one would > normally go to a blocking state [i.e. yield the CPU in some > system call waiting on the event queue]. In FOX we don't > yield YET; we instead iterate over the widget tree, and send > a SEL_UPDATE to the target of each widget. > > Once we've gone through the entire widget tree, THEN we block > and yield the CPU. Of course, each time we update one > widget, we check for events again, to ensure that the > application reacts instantly when something happens. > > The updating process is therefore mostly invisible in the > sense that interactive performance is not affected by it:- > the only time we do updates is when there's nothing else we would be > doing anyway. > > However, this does have a few repercussions on the frequency > of updates; in a very busy system with a large number of > widgets it may take some time before an entire cycle through the > widget tree is completed. > > For this reason, its important to keep the update-handlers > small and to avoid unnecessary work in then whenever possible. > > The code in getNextEvent() is finely tuned to get great > performance, but of course I'm not the one writing the update > handlers! That is up to the software developer himself; it > helps to know what to do and what to avoid. Hence this mail. Hi again, I wrote a test application that updates the widget tree with: def update(window) window.handle(self, FXSEL(SEL_UPDATE, 0), nil) window.children().each { |child| update(child) } end This is much faster than waiting for the framework to issue a SEL_UPDATE to the widgets of the window. You can see the difference visually. I'm not sure if this kind of code can be included in FXRuby directly? Cheers, Philippe ----------------------------------------------- #!/usr/bin/ruby require 'fox16' include Fox class MyWindow < FXMainWindow def initialize(app) super(app, "Window", nil, nil, DECOR_ALL, 0, 0, 500, 500) # Menu bar stretched along the top of the main window menubar = FXMenuBar.new(self, LAYOUT_SIDE_TOP|LAYOUT_FILL_X) # File menu filemenu = FXMenuPane.new(self) FXMenuTitle.new(menubar, "&File", nil, filemenu) FXMenuCommand.new(filemenu, "&Quit\tCtl-Q\tQuit the application", nil, app, FXApp::ID_QUIT) # Frames frame1 = FXMatrix.new(self, 4, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_THICK|FRAME_RAISED) frame2 = FXMatrix.new(frame1, 4, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_THICK|FRAME_RAISED) frame3 = FXMatrix.new(frame2, 4, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_THICK|FRAME_RAISED) frame4 = FXMatrix.new(frame3, 4, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_THICK|FRAME_RAISED) frame5 = FXMatrix.new(frame4, 4, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_THICK|FRAME_RAISED) @w1 = FXTextField.new(frame1, 5) FXTextField.new(frame1, 5) FXTextField.new(frame1, 5) FXTextField.new(frame1, 5) FXTextField.new(frame1, 5) FXTextField.new(frame1, 5) FXTextField.new(frame1, 5) @w2 = FXTextField.new(frame2, 5) FXTextField.new(frame2, 5) FXTextField.new(frame2, 5) FXTextField.new(frame2, 5) FXTextField.new(frame2, 5) FXTextField.new(frame2, 5) FXTextField.new(frame2, 5) @w3 = FXTextField.new(frame3, 5) FXTextField.new(frame3, 5) FXTextField.new(frame3, 5) FXTextField.new(frame3, 5) FXTextField.new(frame3, 5) FXTextField.new(frame3, 5) FXTextField.new(frame3, 5) @w4 = FXTextField.new(frame4, 5) FXTextField.new(frame4, 5) FXTextField.new(frame4, 5) FXTextField.new(frame4, 5) FXTextField.new(frame4, 5) FXTextField.new(frame4, 5) FXTextField.new(frame4, 5) @w5 = FXTextField.new(frame5, 5) FXTextField.new(frame5, 5) FXTextField.new(frame5, 5) FXTextField.new(frame5, 5) FXTextField.new(frame5, 5) @dt1 = FXDataTarget.new("1") @dt2 = FXDataTarget.new("1") @dt3 = FXDataTarget.new("1") @dt4 = FXDataTarget.new("1") @dt5 = FXDataTarget.new("1") @w1.target = @dt1 @w1.selector = FXDataTarget::ID_VALUE @w2.target = @dt2 @w2.selector = FXDataTarget::ID_VALUE @w3.target = @dt3 @w3.selector = FXDataTarget::ID_VALUE @w4.target = @dt4 @w4.selector = FXDataTarget::ID_VALUE @w5.target = @dt5 @w5.selector = FXDataTarget::ID_VALUE add_button = FXButton.new(frame5, "Add 1 with individual SEL_UPDATE") add_button.connect(SEL_COMMAND) do |sender, selector, data| @dt1.value = @dt1.value.to_i + 1 @dt2.value = @dt2.value.to_i + 1 @dt3.value = @dt3.value.to_i + 1 @dt4.value = @dt4.value.to_i + 1 @dt5.value = @dt5.value.to_i + 1 @w1.handle(self, FXSEL(SEL_UPDATE, 0), nil) @w2.handle(self, FXSEL(SEL_UPDATE, 0), nil) @w3.handle(self, FXSEL(SEL_UPDATE, 0), nil) @w4.handle(self, FXSEL(SEL_UPDATE, 0), nil) @w5.handle(self, FXSEL(SEL_UPDATE, 0), nil) end add_button2 = FXButton.new(frame5, "Add 1 with recursive SEL_UPDATE") add_button2.connect(SEL_COMMAND) do |sender, selector, data| @dt1.value = @dt1.value.to_i + 1 @dt2.value = @dt2.value.to_i + 1 @dt3.value = @dt3.value.to_i + 1 @dt4.value = @dt4.value.to_i + 1 @dt5.value = @dt5.value.to_i + 1 update(self) end def update(window) window.handle(self, FXSEL(SEL_UPDATE, 0), nil) window.children().each { |child| update(child) } end add_button3 = FXButton.new(frame5, "Add 1 without SEL_UPDATE") add_button3.connect(SEL_COMMAND) do |sender, selector, data| @dt1.value = @dt1.value.to_i + 1 @dt2.value = @dt2.value.to_i + 1 @dt3.value = @dt3.value.to_i + 1 @dt4.value = @dt4.value.to_i + 1 @dt5.value = @dt5.value.to_i + 1 end end def create super show(PLACEMENT_SCREEN) end end if __FILE__ == $0 application = FXApp.new("Attik System", "FXRuby Test") MyWindow.new(application) application.create application.run end --------------- Philippe Lang Attik System -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3125 bytes Desc: not available Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20061003/2a18338a/attachment.bin From jeroen at fox-toolkit.org Tue Oct 3 20:22:42 2006 From: jeroen at fox-toolkit.org (Jeroen van der Zijp) Date: Tue, 3 Oct 2006 19:22:42 -0500 Subject: [fxruby-users] FXDataTarget & widget value update delay In-Reply-To: <6C0CF58A187DA5479245E0830AF84F421D1313@poweredge.attiksystem.ch> References: <6C0CF58A187DA5479245E0830AF84F421D1313@poweredge.attiksystem.ch> Message-ID: <200610031922.48607.jeroen@fox-toolkit.org> On Tuesday 03 October 2006 15:40, Philippe Lang wrote: > Jeroen van der Zijp wrote: > > On Tuesday 03 October 2006 10:34, Philippe Lang wrote: > >> Hi, > >> > >> When assigning a new value to an FXDataTarget > > programmatically, it takes a certain time for the widget > > linked to this FXDataTarget to be updated, just as if there > > was some sort of "polling" inside the framework. Delay can be > > as long as 1 second sometimes. Why aren't the widgets updated > > straight away? > > > > The GUI gets updated when the event loop is about to block > > for events; as long as there are events [keyboard, mouse, > > repaints, etc], the event loop processes those with priority. > > > > When all queued-up events have been processed, one would > > normally go to a blocking state [i.e. yield the CPU in some > > system call waiting on the event queue]. In FOX we don't > > yield YET; we instead iterate over the widget tree, and send > > a SEL_UPDATE to the target of each widget. > > > > Once we've gone through the entire widget tree, THEN we block > > and yield the CPU. Of course, each time we update one > > widget, we check for events again, to ensure that the > > application reacts instantly when something happens. > > > > The updating process is therefore mostly invisible in the > > sense that interactive performance is not affected by it:- > > the only time we do updates is when there's nothing else we would be > > doing anyway. > > > > However, this does have a few repercussions on the frequency > > of updates; in a very busy system with a large number of > > widgets it may take some time before an entire cycle through the > > widget tree is completed. > > > > For this reason, its important to keep the update-handlers > > small and to avoid unnecessary work in then whenever possible. > > > > The code in getNextEvent() is finely tuned to get great > > performance, but of course I'm not the one writing the update > > handlers! That is up to the software developer himself; it > > helps to know what to do and what to avoid. Hence this mail. > > Hi, thanks for your answer! > > Following your explanation, I finally decided to refresh my widgets manually, when speed is a concern, simply by sending them a SEL_UPDATE message, just after the data target was changed, programatically: > > .handle(self, FXSEL(SEL_UPDATE, 0), nil) > > Works just fine, widgets get updated instantaneously now. > > But really, I still do not understand why the widget refresh is so slow, and so "random". Sometimes very quick, sometimes near a second. I don't have a Pentium II 166 with 16MB RAM, I can assure you, and the application is not that big for the moment. Maybe it's a "Ruby" effect? If you want to ensure some sub-tree of the widget tree is fully updated, you can also use window->forceRefresh() to do this. No need to add your own code for it!! The downside is that forceRefresh() doesn't return until ALL widgets have had an update. For a massive application [e.g. CAD system], that may mean ploughing through thousands of update handlers; the way the normal GUI update is done is sort of behind the scenes in a piecemeal fashion; its invisible during normal use because it doesn't impact performance. At any rate, the API is there and you can use it where you need to.... - Jeroen -- +----------------------------------------------------------------------------+ | Copyright (C) 19:10 10/ 3/2006 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: not available Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20061003/c53f9453/attachment.bin From lyle at knology.net Tue Oct 3 14:24:20 2006 From: lyle at knology.net (Lyle Johnson) Date: Tue, 3 Oct 2006 13:24:20 -0500 Subject: [fxruby-users] FXDataTarget & widget value update delay In-Reply-To: <6C0CF58A187DA5479245E0830AF84F421D130E@poweredge.attiksystem.ch> References: <6C0CF58A187DA5479245E0830AF84F421D130E@poweredge.attiksystem.ch> Message-ID: <20D80241-297F-4F7E-A271-536CC51EC834@knology.net> On Oct 3, 2006, at 10:34 AM, Philippe Lang wrote: > When assigning a new value to an FXDataTarget programmatically, it > takes a certain time for the widget linked to this FXDataTarget to > be updated, just as if there was some sort of "polling" inside the > framework. Delay can be as long as 1 second sometimes. Why aren't > the widgets updated straight away? The update of a widget's settings due to a change in a data target's value is handled by FOX's GUI update mechanism, described here: http://www.fox-toolkit.org/guiupdate.html This process only kicks in during idle time in the GUI, so there's inevitably going to be some small delay. The problem is compounded in FXRuby due to the overhead required for converting back and forth between C++ objects and Ruby objects, as well as scheduling Ruby threads. If your FXRuby application doesn't use any threads, you can try turning off FXRuby's support for scheduling Ruby threads by calling the FXApp's disableThreads() method: app.disableThreads Yet another option, but one which sort-of defeats the purpose of the GUI update process, is to call forceRefresh() directly whenever you make a change to the data target's value, e.g. datatarget.value = "Foo" app.forceRefresh Calling forceRefresh() causes the application to immediately start the GUI update process without waiting for idle time. Hope this helps, Lyle From philippe.lang at attiksystem.ch Wed Oct 4 02:26:33 2006 From: philippe.lang at attiksystem.ch (Philippe Lang) Date: Wed, 4 Oct 2006 08:26:33 +0200 Subject: [fxruby-users] FXDataTarget & widget value update delay Message-ID: <6C0CF58A187DA5479245E0830AF84F421D1315@poweredge.attiksystem.ch> fxruby-users-bounces at rubyforge.org wrote: > On Oct 3, 2006, at 10:34 AM, Philippe Lang wrote: > >> When assigning a new value to an FXDataTarget programmatically, it >> takes a certain time for the widget linked to this FXDataTarget to be >> updated, just as if there was some sort of "polling" inside the >> framework. Delay can be as long as 1 second sometimes. Why aren't the >> widgets updated straight away? > Yet another option, but one which sort-of defeats the purpose > of the GUI update process, is to call forceRefresh() directly > whenever you make a change to the data target's value, e.g. > > datatarget.value = "Foo" > app.forceRefresh > > Calling forceRefresh() causes the application to immediately > start the GUI update process without waiting for idle time. I'm developing a client for a database, and in such a scenario, app.forceRefresh is exactly what I need! Again, thanks for your support, and thanks for FOX. That's really a great great tool. Cheers, --------------- Philippe Lang Attik System -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3125 bytes Desc: not available Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20061004/07016a13/attachment-0001.bin From philippe.lang at attiksystem.ch Thu Oct 5 05:38:19 2006 From: philippe.lang at attiksystem.ch (Philippe Lang) Date: Thu, 5 Oct 2006 11:38:19 +0200 Subject: [fxruby-users] FXTable iterators bug Message-ID: <6C0CF58A187DA5479245E0830AF84F421D132D@poweredge.attiksystem.ch> Hi, I'm unable to use the FXTable iterators "each_row" and "each_column". When writing this kind of code: @table.each_row do |r| end I get the error: c:/ruby/lib/ruby/site_ruby/1.8/fox16/iterators.rb:95:in `each_row': undefined local variable or method `getNumCols' for # (NameError) When looking at the documentation, I can see the code for these iterators is: # File lib/fox16/iterators.rb, line 92 def each_row # :yields: itemArray 0.upto(getNumRows - 1) do |i| tableRow = [] 0.upto(getNumCols - 1) do |j| tableRow << getItem(i, j) end yield tableRow end self end # File lib/fox16/iterators.rb, line 107 def each_column # :yields: itemArray 0.upto(getNumCols - 1) do |j| tableCol = [] 0.upto(getNumRows - 1) do |i| tableCol << getItem(i, j) end yield tableCol end self end I cannot find any reference to "getNumRows" and "getNumCols" in FXRuby. I think it should be instead: # File lib/fox16/iterators.rb, line 92 def each_row # :yields: itemArray 0.upto(numRows - 1) do |i| tableRow = [] 0.upto(numColumns - 1) do |j| tableRow << getItem(i, j) end yield tableRow end self end # File lib/fox16/iterators.rb, line 107 def each_column # :yields: itemArray 0.upto(numColumns - 1) do |j| tableCol = [] 0.upto(numRows - 1) do |i| tableCol << getItem(i, j) end yield tableCol end self end Cheers, --------------- Philippe Lang Attik System -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3125 bytes Desc: not available Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20061005/a64bfab2/attachment.bin From lyle at knology.net Thu Oct 5 09:11:11 2006 From: lyle at knology.net (Lyle Johnson) Date: Thu, 5 Oct 2006 08:11:11 -0500 Subject: [fxruby-users] FXTable iterators bug In-Reply-To: <6C0CF58A187DA5479245E0830AF84F421D132D@poweredge.attiksystem.ch> References: <6C0CF58A187DA5479245E0830AF84F421D132D@poweredge.attiksystem.ch> Message-ID: On Oct 5, 2006, at 4:38 AM, Philippe Lang wrote: > I'm unable to use the FXTable iterators "each_row" and > "each_column". When writing this kind of code: Thanks for the patch! I've submitted a bug report on your behalf, and this should get fixed in the next release. From AEtzold at gmx.de Thu Oct 5 17:18:08 2006 From: AEtzold at gmx.de (Axel Etzold) Date: Thu, 05 Oct 2006 23:18:08 +0200 Subject: [fxruby-users] Does FXRuby support SVG icons ? In-Reply-To: <200609291501.50470.jeroen@fox-toolkit.org> References: <6C0CF58A187DA5479245E0830AF84F421D12D3@poweredge.attiksystem.ch> <200609280955.48030.jeroen@fox-toolkit.org> <200609291501.50470.jeroen@fox-toolkit.org> Message-ID: <20061005211808.306990@gmx.net> Dear all, to use bitmap icons, there are commands FXPNGIcon, FXBMPIcon etc. On the Wikipedia, there are some freely available SVG icons. Can these be used in connection with FXRuby ? A vector graphic is so memory-economic .... Thank you in advance, Best regards, Axel -------- Original-Nachricht -------- Datum: Fri, 29 Sep 2006 15:01:50 -0500 Von: Jeroen van der Zijp An: Lyle Johnson Betreff: Re: [fxruby-users] FXRuby and Unicode > On Thursday 28 September 2006 10:00, Lyle Johnson wrote: > > > > On Sep 28, 2006, at 9:55 AM, Jeroen van der Zijp wrote: > > > > > I'm not 100% sure if the FXRuby glue needs to be compiled with this; > > > but certainly, FOX itself should be. > > > > Right. And unless the Visual C++ project file that comes with the FOX > > source distribution already has this flag set, I'm not compiling FOX > > that way (i.e. for the binary distribution of FXRuby for Windows). > > Anyways, I just need to check into this one and see what's what. I've > > added it to my bug list until it's resolved. > > > BTW, I did release the FOX 1.6.15 the other day, with the suggested > patches for FXTopWindow and FXMDIChild. > > > - Jeroen > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users -- GMX DSL-Flatrate 0,- Euro* - ?berall, wo DSL verf?gbar ist! NEU: Jetzt bis zu 16.000 kBit/s! http://www.gmx.net/de/go/dsl From lyle at knology.net Thu Oct 5 22:14:02 2006 From: lyle at knology.net (Lyle Johnson) Date: Thu, 5 Oct 2006 21:14:02 -0500 Subject: [fxruby-users] Does FXRuby support SVG icons ? In-Reply-To: <20061005211808.306990@gmx.net> References: <6C0CF58A187DA5479245E0830AF84F421D12D3@poweredge.attiksystem.ch> <200609280955.48030.jeroen@fox-toolkit.org> <200609291501.50470.jeroen@fox-toolkit.org> <20061005211808.306990@gmx.net> Message-ID: On Oct 5, 2006, at 4:18 PM, Axel Etzold wrote: > to use bitmap icons, there are commands > FXPNGIcon, FXBMPIcon etc. > On the Wikipedia, there are some freely available > SVG icons. Can these be used in connection with > FXRuby ? A vector graphic is so memory-economic .... Neither FOX nor FXRuby supports SVG icons. That would be a great thing for someone to develop (hint, hint)! From bjorn.bergqvist at gmail.com Fri Oct 6 01:17:44 2006 From: bjorn.bergqvist at gmail.com (=?ISO-8859-1?Q?Bj=F6rn_Bergqvist?=) Date: Fri, 6 Oct 2006 07:17:44 +0200 Subject: [fxruby-users] FXPopup change active child Message-ID: <44936e730610052217lb72ed5bmbb2522acae720895@mail.gmail.com> Hello, When I use FXPopup there would be nice to be able to change which option that is selected. I had no success. Can someone tell me how I can do that. Some incomplete code: fxpopup=FXPopup.new option1 option2 option3 # here I tried every method I could find without success. fxpopup.setActiveChild(2) This is annoying and I use FXRadioButton instead. Regards Bj?rn Bergqvist (http://www.discretizer.org) From philippe.lang at attiksystem.ch Fri Oct 6 09:51:52 2006 From: philippe.lang at attiksystem.ch (Philippe Lang) Date: Fri, 6 Oct 2006 15:51:52 +0200 Subject: [fxruby-users] Default double-click in FXTable? Message-ID: <6C0CF58A187DA5479245E0830AF84F421D133E@poweredge.attiksystem.ch> Hi, The default action when double-clicking on an editable cell in an FXTable is to drop into "edit" mode for that cell. I would like to override that for a specific column in an FXTable, which contains a date. Double-clicking in that column launch a calendar editor. I have done that: @table.connect(SEL_DOUBLECLICKED) do |sender, selector, data| row = @table.selStartRow col = @table.selStartColumn case col when 1 CellEditorCalendar.new(self, @lignes, row, col).execute else # Use default double-click of FXTable? end end It works pretty well, except that I cannot figure out how to call the default FXTable code when double-click is done in a column != 1. Does anybody know how to do that? Thanks! --------------- Philippe Lang Attik System -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3125 bytes Desc: not available Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20061006/2b37f90d/attachment.bin From philippe.lang at attiksystem.ch Sat Oct 7 08:15:15 2006 From: philippe.lang at attiksystem.ch (Philippe Lang) Date: Sat, 7 Oct 2006 14:15:15 +0200 Subject: [fxruby-users] Data Targets and message handlers [was: Default double-click in FXTable?] Message-ID: <6C0CF58A187DA5479245E0830AF84F421D1347@poweredge.attiksystem.ch> Hi, I have read that message handlers can return a value, either true or false, depending on if the handler actually did something, or not. In the latter case, the message is forwarded to the default message handler. I have tried this, and found something strange: in this code, decommenting: @data_widget.connect(SEL_KEYPRESS) do |sender, selector, data| puts d.code false end ... breaks the update of the textfield. The handler returns false in every case, it should have no effect at all, no? I'm I missing something maybe? Philippe ---------------------------- #!/usr/bin/ruby require 'fox16' include Fox class MyWindow < FXMainWindow def initialize(app) super(app, "Window", nil, nil, DECOR_ALL, 0, 0, 200, 100) # Menu bar stretched along the top of the main window menubar = FXMenuBar.new(self, LAYOUT_SIDE_TOP|LAYOUT_FILL_X) # File menu filemenu = FXMenuPane.new(self) FXMenuTitle.new(menubar, "&File", nil, filemenu) FXMenuCommand.new(filemenu, "&Quit\tCtl-Q\tQuit the application", nil, app, FXApp::ID_QUIT) # Frames frame = FXMatrix.new(self, 4, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_THICK|FRAME_RAISED) # Data target @data_target = FXDataTarget.new() # Widget @data_widget = FXTextField.new(frame, 5, @data_target, FXDataTarget::ID_VALUE) # We put some data into the data target @data_target.value = 123 # We add a message handler #@data_widget.connect(SEL_KEYPRESS) do |sender, selector, data| # puts d.code # false #end end def create super show(PLACEMENT_SCREEN) end end if __FILE__ == $0 application = FXApp.new("Attik System", "FXRuby Test") MyWindow.new(application) application.create application.run end --------------- Philippe Lang Attik System -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3125 bytes Desc: not available Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20061007/1b2af216/attachment-0001.bin From philippe.lang at attiksystem.ch Sat Oct 7 11:26:03 2006 From: philippe.lang at attiksystem.ch (Philippe Lang) Date: Sat, 7 Oct 2006 17:26:03 +0200 Subject: [fxruby-users] Data Targets and message handlers [was: Default double-click in FXTable?] Message-ID: <6C0CF58A187DA5479245E0830AF84F421D1348@poweredge.attiksystem.ch> I wrote: > Hi, > > I have read that message handlers can return a value, either > true or false, depending on if the handler actually did > something, or not. In the latter case, the message is > forwarded to the default message handler. > > I have tried this, and found something strange: in this code, > decommenting: > > @data_widget.connect(SEL_KEYPRESS) do |sender, selector, data| > puts d.code false > end > > ... breaks the update of the textfield. The handler returns > false in every case, it should have no effect at all, no? > > I'm I missing something maybe? > > Philippe > > > ---------------------------- > #!/usr/bin/ruby > > require 'fox16' > > include Fox > > class MyWindow < FXMainWindow > > def initialize(app) > > super(app, "Window", nil, nil, DECOR_ALL, 0, 0, 200, 100) > > # Menu bar stretched along the top of the main window > menubar = FXMenuBar.new(self, LAYOUT_SIDE_TOP|LAYOUT_FILL_X) > > # File menu > filemenu = FXMenuPane.new(self) > FXMenuTitle.new(menubar, "&File", nil, filemenu) > FXMenuCommand.new(filemenu, "&Quit\tCtl-Q\tQuit the application", > nil, app, FXApp::ID_QUIT) > > # Frames > frame = FXMatrix.new(self, 4, > LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_THICK|FRAME_RAISED) > > # Data target > @data_target = FXDataTarget.new() > > # Widget > @data_widget = FXTextField.new(frame, 5, @data_target, > FXDataTarget::ID_VALUE) > > # We put some data into the data target > @data_target.value = 123 > > # We add a message handler > #@data_widget.connect(SEL_KEYPRESS) do |sender, selector, data| > # puts d.code # false > #end > > end > > def create > super > show(PLACEMENT_SCREEN) > end > > end > > if __FILE__ == $0 > application = FXApp.new("Attik System", "FXRuby Test") > MyWindow.new(application) application.create > application.run > end Hi again, I understand more or less what happens here. The link between the data target and the widget works here: ---------------------------------------- #!/usr/bin/ruby require 'fox16' include Fox class MyWindow < FXMainWindow def initialize(app) super(app, "Window", nil, nil, DECOR_ALL, 0, 0, 200, 100) # Menu bar stretched along the top of the main window menubar = FXMenuBar.new(self, LAYOUT_SIDE_TOP|LAYOUT_FILL_X) # File menu filemenu = FXMenuPane.new(self) FXMenuTitle.new(menubar, "&File", nil, filemenu) FXMenuCommand.new(filemenu, "&Quit\tCtl-Q\tQuit the application", nil, app, FXApp::ID_QUIT) # Frames frame = FXMatrix.new(self, 4, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_THICK|FRAME_RAISED) # Data target @data_target = FXDataTarget.new() # Widget #@data_widget = FXTextField.new(frame, 5, @data_target, FXDataTarget::ID_VALUE) @data_widget = FXTextField.new(frame, 5) # We put some data into the data target @data_target.value = 123 # We add a message handler @data_widget.connect(SEL_KEYPRESS) do |sender, selector, data| puts data.code 0 end # We connect the data target to the widget @data_widget.target = @data_target @data_widget.selector = FXDataTarget::ID_VALUE end def create super show(PLACEMENT_SCREEN) end end if __FILE__ == $0 application = FXApp.new("Attik System", "FXRuby Test") MyWindow.new(application) application.create application.run end ---------------------------------------- But here it does not: ---------------------------------------- #!/usr/bin/ruby require 'fox16' include Fox class MyWindow < FXMainWindow def initialize(app) super(app, "Window", nil, nil, DECOR_ALL, 0, 0, 200, 100) # Menu bar stretched along the top of the main window menubar = FXMenuBar.new(self, LAYOUT_SIDE_TOP|LAYOUT_FILL_X) # File menu filemenu = FXMenuPane.new(self) FXMenuTitle.new(menubar, "&File", nil, filemenu) FXMenuCommand.new(filemenu, "&Quit\tCtl-Q\tQuit the application", nil, app, FXApp::ID_QUIT) # Frames frame = FXMatrix.new(self, 4, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_THICK|FRAME_RAISED) # Data target @data_target = FXDataTarget.new() # Widget #@data_widget = FXTextField.new(frame, 5, @data_target, FXDataTarget::ID_VALUE) @data_widget = FXTextField.new(frame, 5) # We put some data into the data target @data_target.value = 123 # We connect the data target to the widget @data_widget.target = @data_target @data_widget.selector = FXDataTarget::ID_VALUE # We add a message handler @data_widget.connect(SEL_KEYPRESS) do |sender, selector, data| puts data.code 0 end end def create super show(PLACEMENT_SCREEN) end end if __FILE__ == $0 application = FXApp.new("Attik System", "FXRuby Test") MyWindow.new(application) application.create application.run end ---------------------------------------- To say things briefly, we have to connect the data target to it's widget AFTER we have added our first handler. Otherwise the link between the data target and the widget gets deleted: The problem comes from here: ---------------------------------------- module Responder2 # # Assign a "handler" for all FOX messages of type _messageType_ # sent from this widget. When called with only one argument, # a block is expected, e.g. # # aButton.connect(SEL_COMMAND) { |sender, selector, data| # ... code to handle this event ... # } # # The arguments passed into the block are the _sender_ of the # message (i.e. the widget), the _selector_ for the message, and # any message-specific _data_. # # When #connect is called with two arguments, the second argument # should be some callable object such as a Method or Proc instance, e.g. # # aButton.connect(SEL_COMMAND, method(:onCommand)) # # As with the one-argument form of #connect, the callable object # will be "called" with three arguments (the sender, selector and # message data). # def connect(messageType, callableObject=nil, &block) unless instance_variables.include?('@pseudoTarget') @pseudoTarget = Fox::FXPseudoTarget.new self.target = @pseudoTarget end @pseudoTarget.pconnect(messageType, callableObject, block) end End ---------------------------------------- When calling @data_widget.connect(SEL_KEYPRESS) do |sender, selector, data| puts data.code 0 end ... A pseudoTarget is being created, and the target starts pointing at it. I don't know how to handle that. For now, I have just added an exception, like this: ---------------------------------------- module Responder2 # # Assign a "handler" for all FOX messages of type _messageType_ # sent from this widget. When called with only one argument, # a block is expected, e.g. # # aButton.connect(SEL_COMMAND) { |sender, selector, data| # ... code to handle this event ... # } # # The arguments passed into the block are the _sender_ of the # message (i.e. the widget), the _selector_ for the message, and # any message-specific _data_. # # When #connect is called with two arguments, the second argument # should be some callable object such as a Method or Proc instance, e.g. # # aButton.connect(SEL_COMMAND, method(:onCommand)) # # As with the one-argument form of #connect, the callable object # will be "called" with three arguments (the sender, selector and # message data). # def connect(messageType, callableObject=nil, &block) unless instance_variables.include?('@pseudoTarget') # We check if another target is already registered. # This might be true for a widget already linked to an # FXDataTarget object. if self.target raise "A target is already registered for this object." end @pseudoTarget = Fox::FXPseudoTarget.new self.target = @pseudoTarget end @pseudoTarget.pconnect(messageType, callableObject, block) end End ---------------------------------------- Cheers, --------------- Philippe Lang Attik System -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3125 bytes Desc: not available Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20061007/1909ede3/attachment.bin From philippe.lang at attiksystem.ch Mon Oct 9 02:31:14 2006 From: philippe.lang at attiksystem.ch (Philippe Lang) Date: Mon, 9 Oct 2006 08:31:14 +0200 Subject: [fxruby-users] FXRuby and Unicode Message-ID: <6C0CF58A187DA5479245E0830AF84F421D1349@poweredge.attiksystem.ch> fxruby-users-bounces at rubyforge.org wrote: > On Sep 28, 2006, at 9:55 AM, Jeroen van der Zijp wrote: > >> I'm not 100% sure if the FXRuby glue needs to be compiled with this; >> but certainly, FOX itself should be. > > Right. And unless the Visual C++ project file that comes with > the FOX source distribution already has this flag set, I'm > not compiling FOX that way (i.e. for the binary distribution of > FXRuby for Windows). Anyways, I just need to check into this one and > see what's what. I've added it to my bug list until it's resolved. Hi, I was just wondering what was the state of this discussion regarding unicode. I'm unable to have french accents in a widget, like an FXLabel for example. Using: $KCODE = 'UTF8' require 'jcode' ... Does not help. On the opposite, I can read an accentuated characters string in an FXTextField, and store it into Postgresql, through Active Record. Is all that supposed to be corrected in the next version? --------------- Philippe Lang Attik System -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3125 bytes Desc: not available Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20061009/fe2b12be/attachment.bin From jeroen at fox-toolkit.org Tue Oct 10 10:59:56 2006 From: jeroen at fox-toolkit.org (Jeroen van der Zijp) Date: Tue, 10 Oct 2006 09:59:56 -0500 Subject: [fxruby-users] Data Targets and message handlers [was: Default double-click in FXTable?] In-Reply-To: <6C0CF58A187DA5479245E0830AF84F421D1347@poweredge.attiksystem.ch> References: <6C0CF58A187DA5479245E0830AF84F421D1347@poweredge.attiksystem.ch> Message-ID: <200610100959.56178.jeroen@fox-toolkit.org> On Saturday 07 October 2006 07:15, Philippe Lang wrote: > Hi, > > I have read that message handlers can return a value, either true or false, depending on if the handler actually did something, or not. In the latter case, the message is forwarded to the default message handler. > > I have tried this, and found something strange: in this code, decommenting: > > @data_widget.connect(SEL_KEYPRESS) do |sender, selector, data| > puts d.code > false > end > > ... breaks the update of the textfield. The handler returns false in every case, it should have no effect at all, no? > > I'm I missing something maybe? Do the same for the SEL_KEYRELEASE and it will work.... - Jeroen From philippe.lang at attiksystem.ch Tue Oct 10 12:17:48 2006 From: philippe.lang at attiksystem.ch (Philippe Lang) Date: Tue, 10 Oct 2006 18:17:48 +0200 Subject: [fxruby-users] Data Targets and message handlers [was: Default double-click in FXTable?] Message-ID: <6C0CF58A187DA5479245E0830AF84F421D135F@poweredge.attiksystem.ch> Jeroen van der Zijp wrote: > On Saturday 07 October 2006 07:15, Philippe Lang wrote: >> Hi, >> >> I have read that message handlers can return a value, > either true or false, depending on if the handler actually > did something, or not. In the latter case, the message is > forwarded to the default message handler. >> >> I have tried this, and found something strange: in this code, >> decommenting: >> >> @data_widget.connect(SEL_KEYPRESS) do |sender, selector, data| >> puts d.code false >> end >> >> ... breaks the update of the textfield. The handler returns > false in every case, it should have no effect at all, no? >> >> I'm I missing something maybe? > > Do the same for the SEL_KEYRELEASE and it will work.... Hi, I'm convinced it is not the problem: under FXRuby, message handling has been implemented using "PseudoTargets", in order to simplify the way you write message handlers. Connecting a handler to a widget changes its target (the new target is the pseudo target!). So if you previously set the target of widget to an FXDataTarget, the link gets lost after you connect the handler. This makes FXDataTarget objects pretty useless under FXRuby... --------------- Philippe Lang Attik System -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3125 bytes Desc: not available Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20061010/b4c40f4c/attachment-0001.bin From vjoel at path.berkeley.edu Tue Oct 10 18:15:30 2006 From: vjoel at path.berkeley.edu (Joel VanderWerf) Date: Tue, 10 Oct 2006 15:15:30 -0700 Subject: [fxruby-users] Data Targets and message handlers [was: Default double-click in FXTable?] In-Reply-To: <6C0CF58A187DA5479245E0830AF84F421D135F@poweredge.attiksystem.ch> References: <6C0CF58A187DA5479245E0830AF84F421D135F@poweredge.attiksystem.ch> Message-ID: <452C1B82.2090306@path.berkeley.edu> Philippe Lang wrote: > This makes FXDataTarget objects pretty useless under FXRuby... Have you looked at FoxTails/Observable? FoxTails subclasses some of the Fox/FXRuby classes and defines an initialize method that (typically) takes an object and an attribute name instead of the usual target arguments. The attribute name is used to keep that attr in sync when the widget is used. FoxTails uses Fox's #connect mechanism for this functionality (typically, using SEL_COMMAND, SEL_FOCUSOUT, etc) rather than data targets. This means you can still use connect (with other messages) for other purposes. You can also use the #when_foo methods to register blocks of code to execute when the attr changes or matches a pattern. Here's a simple combobox example that lets you select an object (in terms of its string representation using #inspect) and then changes a label to display the class of the object. #!/usr/bin/env ruby require 'foxtails' include Fox include FoxTails class ComboWindow < FXMainWindow observable :items, :selected def initialize(*args) super self.items = [:foo, "Bar", String, 3, ["a", "b"], 1.23] self.selected = items[3] FXStatusBar.new(self, LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|STATUSBAR_WITH_DRAGCORNER) mb = FXMenuBar.new(self, LAYOUT_SIDE_TOP|LAYOUT_FILL_X) file_menu = FXMenuPane.new(self) FXMenuTitle.new(mb, "&File", nil, file_menu) FXMenuCommand.new(file_menu, "&Quit\tCtl-Q\tQuit the application."). connect(SEL_COMMAND) { getApp().exit } combo = FTComboBox.new(self, 20, self, :items, :selected, COMBOBOX_STATIC|FRAME_THICK) def combo.display(item); item.inspect; end label = FXLabel.new(self, "") when_selected CHANGES do label.setText("Class of item is #{selected.class}") end end def create super show end end class ComboApp < FTApp def initialize super("Combo", "TEST") FoxTails.get_standard_icons ComboWindow.new(self, "Combo") end end ComboApp.new.run -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407 From philippe.lang at attiksystem.ch Wed Oct 11 02:37:44 2006 From: philippe.lang at attiksystem.ch (Philippe Lang) Date: Wed, 11 Oct 2006 08:37:44 +0200 Subject: [fxruby-users] Data Targets and message handlers [was: Default double-click in FXTable?] Message-ID: <6C0CF58A187DA5479245E0830AF84F421D1361@poweredge.attiksystem.ch> fxruby-users-bounces at rubyforge.org wrote: >> This makes FXDataTarget objects pretty useless under FXRuby... > > Have you looked at FoxTails/Observable? FoxTails subclasses > some of the Fox/FXRuby classes and defines an initialize > method that (typically) takes an object and an attribute name > instead of the usual target arguments. The attribute name is > used to keep that attr in sync when the widget is used. > > FoxTails uses Fox's #connect mechanism for this functionality > (typically, using SEL_COMMAND, SEL_FOCUSOUT, etc) rather than > data targets. This means you can still use connect (with > other messages) for other purposes. You can also use the > #when_foo methods to register blocks of code to execute when > the attr changes or matches a pattern. > > Here's a simple combobox example that lets you select an > object (in terms of its string representation using #inspect) > and then changes a label to display the class of the object. > > #!/usr/bin/env ruby > > require 'foxtails' ... Thanks Joel, I have to check your library. Otherwise, Lyle, do you think it would be possible to implement messaging in FXRuby differently, without the FXPseudoTarget? I'm wondering why the content of the FXPseudoTarget class cannot be included directly, at run-time, in the object itself, rather than in in a separate class. This would avoid modifying the target of an object when connecting a handler to it. class FXPseudoTarget < FXObject include Responder @@targets_of_pending_timers = {} @@targets_of_pending_chores = {} @@targets_of_pending_signals = {} @@targets_of_pending_inputs = {} # # Returns an initialized FXPseudoTarget object. # def initialize super @blocks = {} end # # Store an association between a message of type # _messageType_ with a callable object or a block. # def pconnect(messageType, callableObject, block) if callableObject.nil? @blocks[messageType] = block else @blocks[messageType] = callableObject end FXMAPTYPE(messageType, :onHandleMsg) case messageType when SEL_TIMEOUT @@targets_of_pending_timers[self] = self when SEL_CHORE @@targets_of_pending_chores[self] = self when SEL_SIGNAL @@targets_of_pending_signals[self] = self when SEL_IO_READ, SEL_IO_WRITE, SEL_IO_EXCEPT @@targets_of_pending_inputs[self] = self end end # # Handle a message from _sender_, with selector _sel_ and # message data _ptr_. # def onHandleMsg(sender, sel, ptr) messageType = Fox.FXSELTYPE(sel) result = @blocks[messageType].call(sender, sel, ptr) case messageType when SEL_TIMEOUT @@targets_of_pending_timers.delete(self) when SEL_CHORE @@targets_of_pending_chores.delete(self) end result end end --------------- Philippe Lang Attik System -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3125 bytes Desc: not available Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20061011/dfdd7ae7/attachment.bin From lyle at knology.net Wed Oct 11 10:51:34 2006 From: lyle at knology.net (Lyle Johnson) Date: Wed, 11 Oct 2006 09:51:34 -0500 Subject: [fxruby-users] Data Targets and message handlers [was: Default double-click in FXTable?] In-Reply-To: <6C0CF58A187DA5479245E0830AF84F421D135F@poweredge.attiksystem.ch> References: <6C0CF58A187DA5479245E0830AF84F421D135F@poweredge.attiksystem.ch> Message-ID: <10896CD6-03E2-41D8-A5A2-B467E84A5291@knology.net> On Oct 10, 2006, at 11:17 AM, Philippe Lang wrote: > I'm convinced it is not the problem: under FXRuby, message handling > has been implemented using "PseudoTargets", in order to simplify > the way you write message handlers. Connecting a handler to a > widget changes its target (the new target is the pseudo target!). > So if you previously set the target of widget to an FXDataTarget, > the link gets lost after you connect the handler. > > This makes FXDataTarget objects pretty useless under FXRuby... Unless I'm misunderstanding what it is that you're trying to do, this has nothing to do with FXRuby. A FOX widget (such a FXTextField) can only have a single message target. That target object can be an FXDataTarget, or it can be some other object that responds to messages, but there can only be one. You can't (directly) connect an FXTextField to, say, both an FXDataTarget and some other object that handles SEL_KEYPRESS and SEL_KEYRELEASE messages sent from the FXTextField. From lyle at knology.net Wed Oct 11 21:49:29 2006 From: lyle at knology.net (Lyle Johnson) Date: Wed, 11 Oct 2006 20:49:29 -0500 Subject: [fxruby-users] Default double-click in FXTable? In-Reply-To: <6C0CF58A187DA5479245E0830AF84F421D133E@poweredge.attiksystem.ch> References: <6C0CF58A187DA5479245E0830AF84F421D133E@poweredge.attiksystem.ch> Message-ID: On Oct 6, 2006, at 8:51 AM, Philippe Lang wrote: > Hi, > > The default action when double-clicking on an editable cell in an > FXTable is to drop into "edit" mode for that cell. > > I would like to override that for a specific column in an FXTable, > which contains a date. Double-clicking in that column launch a > calendar editor. > > I have done that: > > @table.connect(SEL_DOUBLECLICKED) do |sender, selector, data| > row = @table.selStartRow > col = @table.selStartColumn > > case col > when 1 > CellEditorCalendar.new(self, @lignes, row, > col).execute > else > # Use default double-click of FXTable? > end > end > > It works pretty well, except that I cannot figure out how to call > the default FXTable code when double-click is done in a column != 1. > > Does anybody know how to do that? Try sending the ID_START_INPUT command to the table: @table.handle(@table, FXSEL(SEL_COMMAND, FXTable::ID_START_INPUT), nil) Hope this helps, Lyle From philippe.lang at attiksystem.ch Thu Oct 12 02:07:03 2006 From: philippe.lang at attiksystem.ch (Philippe Lang) Date: Thu, 12 Oct 2006 08:07:03 +0200 Subject: [fxruby-users] Data Targets and message handlers [was: Defaultdouble-click in FXTable?] Message-ID: <6C0CF58A187DA5479245E0830AF84F421D136B@poweredge.attiksystem.ch> fxruby-users-bounces at rubyforge.org wrote: > On Oct 10, 2006, at 11:17 AM, Philippe Lang wrote: > >> I'm convinced it is not the problem: under FXRuby, message handling >> has been implemented using "PseudoTargets", in order to simplify the >> way you write message handlers. Connecting a handler to a widget >> changes its target (the new target is the pseudo target!). >> So if you previously set the target of widget to an FXDataTarget, the >> link gets lost after you connect the handler. >> >> This makes FXDataTarget objects pretty useless under FXRuby... > > Unless I'm misunderstanding what it is that you're trying to > do, this has nothing to do with FXRuby. A FOX widget (such a > FXTextField) can only have a single message target. That > target object can be an FXDataTarget, or it can be some other > object that responds to messages, but there can only be one. > You can't (directly) connect an FXTextField to, say, both an > FXDataTarget and some other object that handles SEL_KEYPRESS > and SEL_KEYRELEASE messages sent from the FXTextField. Hi, Unless I'M misunderstanding something (probably!), I see things this way: 1) An object, let's say an FXTextField, can have a target, for example an FXDataTarget. This is fine. Something happens in the widget, and the target is called. 2) This same FXTextField should also be able to process messages in the same time, when it is the target of another object. The solution is to use the "connect" method, and add the handler to the object. Unfortunately, under FXRuby, both options are not possible in the same time: connect changes the target of the FXTextField, and sets it to a new object, called "PseudoTarget". This is a pure FXRuby thing, as far as I know. So I was wondering if we could not get rid of this Pseudo Target, so an object can independently HAVE a target, and BE a target (process messages). This is possible under Fox C++, right? --------------- Philippe Lang Attik System -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3125 bytes Desc: not available Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20061012/d2615618/attachment.bin From lyle at knology.net Thu Oct 12 10:12:52 2006 From: lyle at knology.net (Lyle Johnson) Date: Thu, 12 Oct 2006 09:12:52 -0500 Subject: [fxruby-users] Data Targets and message handlers [was: Defaultdouble-click in FXTable?] In-Reply-To: <6C0CF58A187DA5479245E0830AF84F421D136B@poweredge.attiksystem.ch> References: <6C0CF58A187DA5479245E0830AF84F421D136B@poweredge.attiksystem.ch> Message-ID: <76E625AE-6CED-4F22-BCDB-F916054EA062@knology.net> On Oct 12, 2006, at 1:07 AM, Philippe Lang wrote: > Unless I'M misunderstanding something (probably!), I see things > this way: > > 1) An object, let's say an FXTextField, can have a target, for > example an FXDataTarget. This is fine. Something happens in the > widget, and the target is called. Correct. > 2) This same FXTextField should also be able to process messages in > the same time, when it is the target of another object. The > solution is to use the "connect" method, and add the handler to the > object. No, this is not correct. Calling connect() on an FXTextField doesn't make it the target of some other object. Calling connect() on an FXTextField, like this: textfield.connect(SEL_KEYPRESS) do |sender, sel, data| # ... handle key press event ... end is *roughly* equivalent to this: class FXPseudoTarget < FXObject def initialize FXMAPFUNC(SEL_KEYPRESS, 0, :onKeyPress) end def onKeyPress(sender, sel, data) # ... handle key press event ... end end textfield.target = FXPseudoTarget.new textfield.selector = 0 In other words, the result of calling connect() on the FXTextField is to assign a new target to it (thus replacing the text field's previous target). Subsequent calls to connect() for the same text field will just add new message handlers to the existing FXPseudoTarget. > Unfortunately, under FXRuby, both options are not possible in the > same time: connect changes the target of the FXTextField, and sets > it to a new object, called "PseudoTarget". This is a pure FXRuby > thing, as far as I know. > > So I was wondering if we could not get rid of this Pseudo Target, > so an object can independently HAVE a target, and BE a target > (process messages). This is possible under Fox C++, right? Per the previous discussion, there's nothing in FOX (or FXRuby) that prevents an object from both being a target and having a target. But I think I understand what you're getting at, and that is that you want to have the text field's content tied to some variable in your application, but you'd also like to be able to catch certain messages (like SEL_KEYPRESS and SEL_KEYRELEASE) generated by the text field. Is that right? If that's the case, I don't think you'll be able to use FXDataTarget directly, but that's not a big tragedy. You would instead do something like this: textfield.connect(SEL_UPDATE) { # Update the text field's content from a variable textfield.text = my_variable } textfield.connect(SEL_COMMAND) { # Update the variable based on new text field content my_variable = textfield.text } textfield.connect(SEL_KEYPRESS) { # ... handle key press event ... } Hope this helps, Lyle From philippe.lang at attiksystem.ch Fri Oct 13 01:38:08 2006 From: philippe.lang at attiksystem.ch (Philippe Lang) Date: Fri, 13 Oct 2006 07:38:08 +0200 Subject: [fxruby-users] Data Targets and message handlers [was: Defaultdouble-click in FXTable?] Message-ID: <6C0CF58A187DA5479245E0830AF84F421D1380@poweredge.attiksystem.ch> Lyle Johnson wrote: > But I think I understand what you're getting > at, and that is that you want to have the text field's > content tied to some variable in your application, but you'd > also like to be able to catch certain messages (like > SEL_KEYPRESS and SEL_KEYRELEASE) generated by the text field. Is that > right? Why didn't I say like this before! Yes, exactly. > If that's the case, I don't think you'll be able to use > FXDataTarget directly, but that's not a big tragedy. No, that's not a big tragedy at all. I noticed that in my application, I actually don't absolutely need data objects, so I simply dropped them. But IMHO, there might be something to improve in the framework regarding messages. Fox Tails is apprently just doing that. Thanks for your notes, and for FXRuby by the way... Bye --------------- Philippe Lang Attik System -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3125 bytes Desc: not available Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20061013/585ca6ba/attachment.bin From steviedizzle at gmail.com Fri Oct 13 10:03:14 2006 From: steviedizzle at gmail.com (Steve D.) Date: Fri, 13 Oct 2006 10:03:14 -0400 Subject: [fxruby-users] Canvas Rubberband Selection Message-ID: Hi, I'm porting a QtRuby (4.1) app over to FxRuby cause I need the cross-platform compatibility and was wondering if there was a Rubberband (http://doc.trolltech.com/4.1/qrubberband.html) type class for Fox or if I will have to roll my own. Thanks, Steven Davidovitz From jeroen at fox-toolkit.org Fri Oct 13 11:53:51 2006 From: jeroen at fox-toolkit.org (Jeroen van der Zijp) Date: Fri, 13 Oct 2006 10:53:51 -0500 Subject: [fxruby-users] Canvas Rubberband Selection In-Reply-To: References: Message-ID: <200610131053.51705.jeroen@fox-toolkit.org> On Friday 13 October 2006 09:03, Steve D. wrote: > Hi, > I'm porting a QtRuby (4.1) app over to FxRuby cause I need the > cross-platform compatibility and was wondering if there was a > Rubberband (http://doc.trolltech.com/4.1/qrubberband.html) type class > for Fox or if I will have to roll my own. There are only two widgets which have "rubberband-style" selection: FXGLViewer and FXIconList. Both have built-in selection, but its implemented differently; the FXGLViewer implements the drawing using OpenGL, whereas the FXIconList does it using 2D drawing API's. If it appears generally useful, we could implement FXRubberBand; perhaps you just give an example of how you would use such a thing in your code [assuming you need it outside of the FOX widgets which have this already built in]... - Jeroen From steviedizzle at gmail.com Fri Oct 13 14:33:34 2006 From: steviedizzle at gmail.com (Steve D.) Date: Fri, 13 Oct 2006 14:33:34 -0400 Subject: [fxruby-users] Canvas Rubberband Selection In-Reply-To: References: <200610131053.51705.jeroen@fox-toolkit.org> Message-ID: On 10/13/06, Jeroen van der Zijp wrote: > On Friday 13 October 2006 09:03, Steve D. wrote: > > Hi, > > I'm porting a QtRuby (4.1) app over to FxRuby cause I need the > > cross-platform compatibility and was wondering if there was a > > Rubberband (http://doc.trolltech.com/4.1/qrubberband.html) type class > > for Fox or if I will have to roll my own. > > There are only two widgets which have "rubberband-style" selection: FXGLViewer > and FXIconList. Both have built-in selection, but its implemented differently; > the FXGLViewer implements the drawing using OpenGL, whereas the FXIconList does > it using 2D drawing API's. > > If it appears generally useful, we could implement FXRubberBand; perhaps you > just give an example of how you would use such a thing in your code [assuming > you need it outside of the FOX widgets which have this already built in]... > > > > - Jeroen > > > In the previous program I was using the rubberband to create rectangles on a 2D Canvas so that they could be stored, etc. In the end I don't really need anything specific I would just like a click and drag type rectangle to be displayed on an FXCanvas instance. Thanks, Steven From wconrad at yagni.com Fri Oct 13 23:30:22 2006 From: wconrad at yagni.com (Wayne Conrad) Date: Fri, 13 Oct 2006 20:30:22 -0700 Subject: [fxruby-users] Build error: Debian testing, libfox1.4, FXRuby-1.4.7 Message-ID: <20061014033022.GB24552@yagni.com> I'm getting compile errors when attempting to build FXRuby 1.4.7. This happens when installing using gems, or when installing from source: g++ -I. -I. -I/usr/lib/ruby/1.8/i486-linux -I/home/wayne/lab/fox/FXRuby-1.4.7/ext/fox14 -DHAVE_SYS_TIME_H -DHAVE_SIGNAL_H -I/usr/local/include/fxscintilla -I/usr/local/include/fox-1.4 -I/usr/include/fox-1.4 -fPIC -Wall -g -fno-strict-aliasing -O2 -fPIC -O0 -Iinclude -c fx3d_wrap.cpp fx3d_wrap.cpp: In function 'FX::FXVec3f FXVec3f_normal(const FX::FXVec3f&, const FX::FXVec3f&, const FX::FXVec3f&)': fx3d_wrap.cpp:705: error: no matching function for call to 'normal(const FX::FXVec3f&, const FX::FXVec3f&, const FX::FXVec3f&)' fx3d_wrap.cpp: In function 'FX::FXVec3f FXVec3f_normal(const FX::FXVec3f&, const FX::FXVec3f&, const FX::FXVec3f&, const FX::FXVec3f&)': fx3d_wrap.cpp:708: error: no matching function for call to 'normal(const FX::FXVec3f&, const FX::FXVec3f&, const FX::FXVec3f&, const FX::FXVec3f&)' ... My environment: Debian testing Ruby 1.8.2-1 Fox 1.4, from Debian packages libfox1.4 and libfox1.4-dev (package versions 1.4.31-2+b1) Any idea what's up? No doubt I've left off the one thing that would help you figure out what I'm doing wrong. Requests for more information will be gladly acted upon. RTFM's including a link to the FM would be most welcome. And clues, should you have any, will be gratefully received. Wayne Conrad From lyle at knology.net Sat Oct 14 08:47:54 2006 From: lyle at knology.net (Lyle Johnson) Date: Sat, 14 Oct 2006 07:47:54 -0500 Subject: [fxruby-users] Build error: Debian testing, libfox1.4, FXRuby-1.4.7 In-Reply-To: <20061014033022.GB24552@yagni.com> References: <20061014033022.GB24552@yagni.com> Message-ID: <1B895E5B-1A08-4434-A718-5DB21027D482@knology.net> On Oct 13, 2006, at 10:30 PM, Wayne Conrad wrote: > I'm getting compile errors when attempting to build FXRuby 1.4.7. > This happens when installing using gems, or when installing from > source: > > g++ -I. -I. -I/usr/lib/ruby/1.8/i486-linux -I/home/wayne/lab/fox/ > FXRuby-1.4.7/ext/fox14 -DHAVE_SYS_TIME_H -DHAVE_SIGNAL_H -I/usr/ > local/include/fxscintilla -I/usr/local/include/fox-1.4 -I/usr/ > include/fox-1.4 -fPIC -Wall -g -fno-strict-aliasing -O2 -fPIC -O0 - > Iinclude -c fx3d_wrap.cpp > fx3d_wrap.cpp: In function 'FX::FXVec3f FXVec3f_normal(const > FX::FXVec3f&, const FX::FXVec3f&, const FX::FXVec3f&)': > fx3d_wrap.cpp:705: error: no matching function for call to 'normal > (const FX::FXVec3f&, const FX::FXVec3f&, const FX::FXVec3f&)' > fx3d_wrap.cpp: In function 'FX::FXVec3f FXVec3f_normal(const > FX::FXVec3f&, const FX::FXVec3f&, const FX::FXVec3f&, const > FX::FXVec3f&)': > fx3d_wrap.cpp:708: error: no matching function for call to 'normal > (const FX::FXVec3f&, const FX::FXVec3f&, const FX::FXVec3f&, const > FX::FXVec3f&)' > ... > > My environment: > > Debian testing > Ruby 1.8.2-1 > Fox 1.4, from Debian packages libfox1.4 and libfox1.4-dev > (package versions 1.4.31-2+b1) > > Any idea what's up? Well, I guess for starters, can you confirm that Debian installs the FOX include files into either /usr/local/include/fox-1.4 or /usr/ include/fox-1.4? I think the compiler is in fact seeing the include files, but I just wanted to rule out that possibility up front. I'm also wondering if it has to do with the "friend injection" change made in GCC 4.1, which I know broke some earlier versions of FOX. Jeroen put a patch in FOX 1.4.32 to address this problem. Do you know which version of FOX Debian is using for their libfox1.4 packages? From wconrad at yagni.com Sat Oct 14 10:15:01 2006 From: wconrad at yagni.com (Wayne Conrad) Date: Sat, 14 Oct 2006 07:15:01 -0700 Subject: [fxruby-users] Build error: Debian testing, libfox1.4, FXRuby-1.4.7 In-Reply-To: <1B895E5B-1A08-4434-A718-5DB21027D482@knology.net> References: <20061014033022.GB24552@yagni.com> <1B895E5B-1A08-4434-A718-5DB21027D482@knology.net> Message-ID: <20061014141501.GA16035@yagni.com> On Sat, Oct 14, 2006 at 07:47:54AM -0500, Lyle Johnson wrote: > On Oct 13, 2006, at 10:30 PM, Wayne Conrad wrote: > > fx3d_wrap.cpp:705: error: no matching function for call to 'normal > > (const FX::FXVec3f&, const FX::FXVec3f&, const FX::FXVec3f&)' > Well, I guess for starters, can you confirm that Debian installs the > FOX include files into either /usr/local/include/fox-1.4 or /usr/ > include/fox-1.4? I think the compiler is in fact seeing the include > files, but I just wanted to rule out that possibility up front. I find bunches of files in /usr/include/fox-1.4 > I'm also wondering if it has to do with the "friend injection" change > made in GCC 4.1, which I know broke some earlier versions of FOX. > Jeroen put a patch in FOX 1.4.32 to address this problem. Do you know > which version of FOX Debian is using for their libfox1.4 packages? My g++ is version 4.1.1. Fox 1.4.31. With Debian version numbers, everything before the dash is the original package's version. I see that Fox version 1.4.34 is in Debian unstable. I'll install it, see if it fixes things, and let you know. Wayne Conrad From wconrad at yagni.com Sat Oct 14 10:44:50 2006 From: wconrad at yagni.com (Wayne Conrad) Date: Sat, 14 Oct 2006 07:44:50 -0700 Subject: [fxruby-users] Build error: Debian testing, libfox1.4, FXRuby-1.4.7 In-Reply-To: <20061014141501.GA16035@yagni.com> References: <20061014033022.GB24552@yagni.com> <1B895E5B-1A08-4434-A718-5DB21027D482@knology.net> <20061014141501.GA16035@yagni.com> Message-ID: <20061014144450.GA27625@yagni.com> On Sat, Oct 14, 2006 at 07:15:01AM -0700, Wayne Conrad wrote: > I see that Fox version 1.4.34 is in Debian unstable. I'll install it, > see if it fixes things, and let you know. That did it. After installing Fox 1.4.34, FXRuby 1.4.7 compiled from source and installed alright. "require 'fox14'" now works. Strangely, I couldn't get it to install using gem, which complained "make: Nothing to be done for 'install'.". No worries, since it installed from source alright. Thanks for the help! Wayne Conrad From lyle at knology.net Sat Oct 14 12:52:32 2006 From: lyle at knology.net (Lyle Johnson) Date: Sat, 14 Oct 2006 11:52:32 -0500 Subject: [fxruby-users] Build error: Debian testing, libfox1.4, FXRuby-1.4.7 In-Reply-To: <20061014144450.GA27625@yagni.com> References: <20061014033022.GB24552@yagni.com> <1B895E5B-1A08-4434-A718-5DB21027D482@knology.net> <20061014141501.GA16035@yagni.com> <20061014144450.GA27625@yagni.com> Message-ID: <59FA0D7D-DE72-4E33-B6E0-0E3262999038@knology.net> On Oct 14, 2006, at 9:44 AM, Wayne Conrad wrote: > That did it. After installing Fox 1.4.34, FXRuby 1.4.7 compiled from > source and installed alright. "require 'fox14'" now works. Great! > Strangely, I couldn't get it to install using gem, which complained > "make: Nothing to be done for 'install'.". No worries, since > it installed from source alright. There is a known (and reported) bug with the latest release of RubyGems: http://rubyforge.org/tracker/? func=detail&aid=4948&group_id=126&atid=575 I believe that a fix for this problem has been checked into the RubyGems CVS, so it should be corrected in the next RubyGems release. From lyle at knology.net Sat Oct 14 17:58:29 2006 From: lyle at knology.net (Lyle Johnson) Date: Sat, 14 Oct 2006 16:58:29 -0500 Subject: [fxruby-users] FXRuby and Unicode In-Reply-To: <6C0CF58A187DA5479245E0830AF84F421D1349@poweredge.attiksystem.ch> References: <6C0CF58A187DA5479245E0830AF84F421D1349@poweredge.attiksystem.ch> Message-ID: <1F717933-AA41-49A9-A9A1-BA5753600520@knology.net> On Oct 9, 2006, at 1:31 AM, Philippe Lang wrote: > I was just wondering what was the state of this discussion > regarding unicode. > > I'm unable to have french accents in a widget, like an FXLabel for > example. > > Using: > > $KCODE = 'UTF8' > require 'jcode' > > ... Does not help. Philippe (and anyone else who's interested), I wonder if you can try the attached example program on your computer and tell me what you see. As far as I can tell, the versions of FOX and FXRuby that I distribute for Windows was compiled correctly (i.e. with the UNICODE setting). When I run the attached example, the Unicode text inside the label is displayed properly. Thanks, Lyle -------------- next part -------------- A non-text attachment was scrubbed... Name: unicode.rb Type: text/x-ruby-script Size: 779 bytes Desc: not available Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20061014/d64f2175/attachment-0001.bin -------------- next part -------------- From philippe.lang at attiksystem.ch Sun Oct 15 03:48:47 2006 From: philippe.lang at attiksystem.ch (Philippe Lang) Date: Sun, 15 Oct 2006 09:48:47 +0200 Subject: [fxruby-users] FXRuby and Unicode Message-ID: <6C0CF58A187DA5479245E0830AF84F421D1390@poweredge.attiksystem.ch> fxruby-users-bounces at rubyforge.org wrote: > On Oct 9, 2006, at 1:31 AM, Philippe Lang wrote: > >> I was just wondering what was the state of this discussion regarding >> unicode. >> >> I'm unable to have french accents in a widget, like an FXLabel for >> example. >> >> Using: >> >> $KCODE = 'UTF8' >> require 'jcode' >> >> ... Does not help. > > Philippe (and anyone else who's interested), > > I wonder if you can try the attached example program on your > computer and tell me what you see. As far as I can tell, the > versions of FOX and FXRuby that I distribute for Windows was compiled > correctly (i.e. with the UNICODE setting). When I run the attached > example, the Unicode text inside the label is displayed properly. Hi, It works fine, thanks. But instead of this program, wouldn't it be possible to write a program where your include the accents directly in the source coude, just like with other languages? ------------------------ #!/usr/bin/env ruby require 'fox16' require 'jcode' $KCODE = 'UTF8' include Fox # Prepare a string label = "Les enfants vont ? l'?cole.\nLa boulang?re vend-elle le pain en ao?t?" FXApp.new("Unicode Example", "FoxTest") do |app| main = FXMainWindow.new(app, "Unicode Text", nil, nil, DECOR_ALL) FXLabel.new(main, label) app.create main.show(PLACEMENT_SCREEN) app.run End --------------- Philippe Lang Attik System -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3125 bytes Desc: not available Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20061015/ba63fe30/attachment.bin From lyle at knology.net Sun Oct 15 08:54:05 2006 From: lyle at knology.net (Lyle Johnson) Date: Sun, 15 Oct 2006 07:54:05 -0500 Subject: [fxruby-users] FXRuby and Unicode In-Reply-To: <6C0CF58A187DA5479245E0830AF84F421D1390@poweredge.attiksystem.ch> References: <6C0CF58A187DA5479245E0830AF84F421D1390@poweredge.attiksystem.ch> Message-ID: <607007B6-F439-4372-8DD2-A8A3A86E9843@knology.net> On Oct 15, 2006, at 2:48 AM, Philippe Lang wrote: > It works fine, thanks. But instead of this program, wouldn't it be > possible to write a program where your include the accents directly > in the source coude, just like with other languages? Jeroen will hopefully correct me if I'm wrong on this, but FOX can't just guess how a string (with some accented characters) is encoded. For that reason, FOX only directly accepts UTF-8 encoded Unicode strings. In the program you attached to your message (where you included the accents directly in the source code), the string "looks" correct when I see it in my Mail program. But I don't know how those accented characters were originally encoded. If they are UTF-8 encoded in the version you're trying to run on your computer, then yes, that should work properly. For that to be true, the "?", which is Unicode U+00E0, would need to appear as the bytes (C3, A0). That's how that character is encoded in UTF-8. If on the other hand, the characters are encoded in the ISO Latin 1 character set (a.k.a. ISO 8859-1) -- which is a distinct possibility, as a lot of editors use that by default -- your "?" character is probably encoded using the single byte E0. That single byte doesn't make any sense in UTF-8 encoding, and that why you'd see a square (or some other error character) in a program that was trying to decode it as if it were UTF-8. So the question is, what to do if you have strings encoded in some format other than UTF-8? I think we might be able to use Ruby's Iconv library for this. FOX also has a number of codecs that I have not yet exposed in FXRuby, but those might be good candidates too... From ggarra at advancedsl.com.ar Sun Oct 15 06:04:37 2006 From: ggarra at advancedsl.com.ar (Gonzalo Garramuno) Date: Sun, 15 Oct 2006 07:04:37 -0300 Subject: [fxruby-users] FXRuby and Unicode In-Reply-To: <6C0CF58A187DA5479245E0830AF84F421D1390@poweredge.attiksystem.ch> References: <6C0CF58A187DA5479245E0830AF84F421D1390@poweredge.attiksystem.ch> Message-ID: <453207B5.70108@advancedsl.com.ar> Philippe Lang escribi?: > > Hi, > > It works fine, thanks. But instead of this program, wouldn't it be possible to write a program where your include the accents directly in the source coude, just like with other languages? You can do just that. Make sure you use a modern editor that saves out Unicode UTF-8 text files (notepad, emacs, etc), not iso-8859-1 (Western encoding) text files. Alternatively, use the iconv.so module, like, passing the result of utf8 strings over to fxruby: #!/bin/env ruby require 'iconv' class String # Take text from iso-8859-1 to utf-8 @@utf = Iconv.new( 'utf-8', 'iso-8859-1' ) # Take text from Unicode utf-8 to iso-8859-1 @@iso = Iconv.new( 'iso-8859-1', 'utf-8' ) def from_utf8 @@iso.iconv( self ) end def to_utf8 @@utf.iconv( self ) end end text = 'Voici est un exemple fran?ais avec iso-8859-1' puts text puts 'Le m?me texte avec utf-8:' puts text.to_utf8 From philippe.lang at attiksystem.ch Sun Oct 15 16:41:33 2006 From: philippe.lang at attiksystem.ch (Philippe Lang) Date: Sun, 15 Oct 2006 22:41:33 +0200 Subject: [fxruby-users] FXRuby and Unicode Message-ID: <6C0CF58A187DA5479245E0830AF84F421D1395@poweredge.attiksystem.ch> fxruby-users-bounces at rubyforge.org wrote: > Philippe Lang escribi?: >> >> Hi, >> >> It works fine, thanks. But instead of this program, > wouldn't it be possible to write a program where your include > the accents directly in the source coude, just like with other > languages? > > You can do just that. Make sure you use a modern editor that > saves out Unicode UTF-8 text files (notepad, emacs, etc), not > iso-8859-1 (Western encoding) text files. > > Alternatively, use the iconv.so module, like, passing the > result of utf8 strings over to fxruby: > ... Thanks, both solutions work just fine! I'm using Komodo as an editor, it is particularly simple to change the encoding of the source files. With UTF-8, all french accents are here... Cheers, --------------- Philippe Lang Attik System -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3125 bytes Desc: not available Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20061015/e82358ad/attachment.bin From lyle at knology.net Sun Oct 15 17:50:40 2006 From: lyle at knology.net (Lyle Johnson) Date: Sun, 15 Oct 2006 16:50:40 -0500 Subject: [fxruby-users] FXRuby and Unicode In-Reply-To: <6C0CF58A187DA5479245E0830AF84F421D1395@poweredge.attiksystem.ch> References: <6C0CF58A187DA5479245E0830AF84F421D1395@poweredge.attiksystem.ch> Message-ID: <8A84D204-89A9-49B3-8898-CB7C7B2801E3@knology.net> On Oct 15, 2006, at 3:41 PM, Philippe Lang wrote: > Thanks, both solutions work just fine! I'm using Komodo as an > editor, it is particularly simple to change the encoding of the > source files. With UTF-8, all french accents are here... Great news! I'm glad this is working for you now. From Ray at Bovet.org Wed Oct 18 00:17:02 2006 From: Ray at Bovet.org (Ray Bovet) Date: Tue, 17 Oct 2006 22:17:02 -0600 Subject: [fxruby-users] Trouble updating image in an icon Message-ID: <4535AABE.1090808@Bovet.org> Okay, I've tried to figure this out on my own, but I'm not getting very far. I'm sure I've made some utterly dumb newbie mistake - hopefully it won't take long for someone who understands FXRuby better than I do to set me straight. I'm trying to write a program to display an image in a window. Then, when you click on the window it should display the next image. The FXRuby User's Guide has great information about setting up an icon and loading an image into it. It also shows how to tie a command to a button press. But I seem to be having lots of trouble displaying the new image after the button press. Any comments on how to improve the code would be gratefully accepted! The code below results in the messages below as soon as I click on the image once: This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. Got a click on the image testicon.rb:28: [BUG] Segmentation fault ruby 1.8.4 (2006-04-14) [i386-mswin32] >Exit code: 3 Here's the code: require 'rubygems' require 'fox16' include Fox myViewFile = "starEdit.gif" def displayImage( myViewFile, theApp, theImage) iconFile = File.open( myViewFile, "rb") theImage.icon = FXGIFIcon.new(theApp, iconFile.read) iconFile.close end theApp = FXApp.new theMainWindow = FXMainWindow.new( theApp, "starShow") count = 0 theImage = FXButton.new(theMainWindow, "image") theImage.connect(SEL_COMMAND) do |sender, selector, data| count += 1 STDERR.puts( "Got a click on the image") # imagine code here to update the image file. displayImage( myViewFile, theApp, theImage) theMainWindow.show end displayImage( myViewFile, theApp, theImage) theApp.create theMainWindow.show theApp.run Thanks for your help! Ray Bovet From fxrbu1 at gi2.herzkes.de Wed Oct 18 03:23:01 2006 From: fxrbu1 at gi2.herzkes.de (fxrbu1 at gi2.herzkes.de) Date: Wed, 18 Oct 2006 09:23:01 +0200 Subject: [fxruby-users] Trouble updating image in an icon In-Reply-To: <4535AABE.1090808@Bovet.org> References: <4535AABE.1090808@Bovet.org> Message-ID: <4535D655.3080205@gi2.herzkes.de> Ray Bovet wrote: > Got a click on the image > testicon.rb:28: [BUG] Segmentation fault [...] > def displayImage( myViewFile, theApp, theImage) > iconFile = File.open( myViewFile, "rb") > theImage.icon = FXGIFIcon.new(theApp, iconFile.read) > iconFile.close > end Invoke method "create" on the new icon before the assignment. It would be nice if FXRuby detected this (it's a common oversight) and called "create" on widgets if necessary. Or, raising an exception with an explanatory message would still be better than crashing the interpreter. Regards, Tobias From gerard.menochet at wanadoo.fr Wed Oct 18 03:46:13 2006 From: gerard.menochet at wanadoo.fr (=?iso-8859-1?Q?G=E9rard_M=E9nochet?=) Date: Wed, 18 Oct 2006 09:46:13 +0200 Subject: [fxruby-users] Trouble updating image in an icon References: <4535AABE.1090808@Bovet.org> Message-ID: <000901c6f289$7ce23a40$4d867b52@gerard56z3982r> > def displayImage( myViewFile, theApp, theImage) > iconFile = File.open( myViewFile, "rb") > theImage.icon = FXGIFIcon.new(theApp, iconFile.read) # Here, you should have something like :' theImage.icon.create() . Not needed before theApp.create() > iconFile.close > end ----- Original Message ----- From: "Ray Bovet" To: Sent: Wednesday, October 18, 2006 6:17 AM Subject: [fxruby-users] Trouble updating image in an icon > Okay, I've tried to figure this out on my own, but I'm not getting very > far. I'm sure I've made some utterly dumb newbie mistake - hopefully it > won't take long for someone who understands FXRuby better than I do to > set me straight. I'm trying to write a program to display an image in a > window. Then, when you click on the window it should display the next > image. The FXRuby User's Guide has great information about setting up > an icon and loading an image into it. It also shows how to tie a > command to a button press. But I seem to be having lots of trouble > displaying the new image after the button press. Any comments on how to > improve the code would be gratefully accepted! The code below results > in the messages below as soon as I click on the image once: > > This application has requested the Runtime to terminate it in an unusual > way. > Please contact the application's support team for more information. > Got a click on the image > testicon.rb:28: [BUG] Segmentation fault > ruby 1.8.4 (2006-04-14) [i386-mswin32] > > >Exit code: 3 > > Here's the code: > > require 'rubygems' > require 'fox16' > include Fox > > myViewFile = "starEdit.gif" > > def displayImage( myViewFile, theApp, theImage) > iconFile = File.open( myViewFile, "rb") > theImage.icon = FXGIFIcon.new(theApp, iconFile.read) > iconFile.close > end > > theApp = FXApp.new > theMainWindow = FXMainWindow.new( theApp, "starShow") > count = 0 > theImage = FXButton.new(theMainWindow, "image") > theImage.connect(SEL_COMMAND) do |sender, selector, data| > count += 1 > STDERR.puts( "Got a click on the image") > # imagine code here to update the image file. > displayImage( myViewFile, theApp, theImage) > theMainWindow.show > end > > displayImage( myViewFile, theApp, theImage) > theApp.create > theMainWindow.show > theApp.run > > > Thanks for your help! > > Ray Bovet > > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users > From jmthomas at ball.com Wed Oct 18 09:54:58 2006 From: jmthomas at ball.com (Thomas, Jason M (Software)) Date: Wed, 18 Oct 2006 07:54:58 -0600 Subject: [fxruby-users] FXTable elements Message-ID: <03B62622BF273442912A2E486B799DD202736FEB@AEROMSG3.AERO.BALL.COM> I noticed there is a FXComboTableItem for the FXTable but not a FXCheckBoxTableItem. Is this just because no one has gotten around to it yet? What would be my chances of writing it in all Ruby using the existing FXComboTableItem as an example? Also the FXComboTableItem API on the fxruby website doesn't seem to be up to date. I was trying to figure out how to determine if a table element had been selected. The website says itemSelected? but the actual method (which I discovered by querying the object) is isItemSelected. Is this just a website lagging the release or should I be looking somewhere else for the latest API. Jason Thomas -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/fxruby-users/attachments/20061018/818116a0/attachment.html From philippe.lang at attiksystem.ch Wed Oct 18 10:39:21 2006 From: philippe.lang at attiksystem.ch (Philippe Lang) Date: Wed, 18 Oct 2006 16:39:21 +0200 Subject: [fxruby-users] FXTable elements Message-ID: <6C0CF58A187DA5479245E0830AF84F421D13C4@poweredge.attiksystem.ch> I noticed there is a FXComboTableItem for the FXTable but not a FXCheckBoxTableItem. Is this just because no one has gotten around to it yet? What would be my chances of writing it in all Ruby using the existing FXComboTableItem as an example? Also the FXComboTableItem API on the fxruby website doesn't seem to be up to date. I was trying to figure out how to determine if a table element had been selected. The website says itemSelected? but the actual method (which I discovered by querying the object) is isItemSelected. Is this just a website lagging the release or should I be looking somewhere else for the latest API. ------------------ Hi, One easy way to implement a checkbox in FXRuby is to use two icons, for the "checked" and "unchecked" states. At every click, you change the icon in the FXTableCell. Cheers, Philippe -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3125 bytes Desc: not available Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20061018/34a0edf7/attachment.bin From steviedizzle at gmail.com Wed Oct 18 15:14:46 2006 From: steviedizzle at gmail.com (Steven Davidovitz) Date: Wed, 18 Oct 2006 15:14:46 -0400 Subject: [fxruby-users] Canvas Rubberband Selection Message-ID: <20061018151446.10a727e4.steviedizzle@gmail.com> Just an update from before, I created my own in-Ruby class and it seems to be working out fine. I just implemented the basics, nothing fancy. Thanks, Steven Davidovitz From lyle at knology.net Wed Oct 18 17:03:15 2006 From: lyle at knology.net (Lyle Johnson) Date: Wed, 18 Oct 2006 16:03:15 -0500 Subject: [fxruby-users] Canvas Rubberband Selection In-Reply-To: <20061018151446.10a727e4.steviedizzle@gmail.com> References: <20061018151446.10a727e4.steviedizzle@gmail.com> Message-ID: <5BB73BBF-3085-4986-936D-A73C51E45616@knology.net> On Oct 18, 2006, at 2:14 PM, Steven Davidovitz wrote: > Just an update from before, I created my own in-Ruby class and it > seems to be working out fine. I just implemented the basics, > nothing fancy. Want to share? From lyle at knology.net Wed Oct 18 19:03:27 2006 From: lyle at knology.net (Lyle Johnson) Date: Wed, 18 Oct 2006 18:03:27 -0500 Subject: [fxruby-users] FXTable elements In-Reply-To: <03B62622BF273442912A2E486B799DD202736FEB@AEROMSG3.AERO.BALL.COM> References: <03B62622BF273442912A2E486B799DD202736FEB@AEROMSG3.AERO.BALL.COM> Message-ID: <7BA7CD5B-0CAD-48AC-9298-EC7A9A4EF08F@knology.net> On Oct 18, 2006, at 8:54 AM, Thomas, Jason M ((Software)) wrote: > I noticed there is a FXComboTableItem for the FXTable but not a > FXCheckBoxTableItem. Is this just because no one has gotten around > to it yet? What would be my chances of writing it in all Ruby using > the existing FXComboTableItem as an example? There is no FXCheckBoxTableItem class because no one has felt the need to write it, yet. I'm not sure how to answer your second question. > Also the FXComboTableItem API on the fxruby website doesn't seem > to be up to date. I was trying to figure out how to determine if a > table element had been selected. The website says itemSelected? but > the actual method (which I discovered by querying the object) is > isItemSelected. Is this just a website lagging the release or > should I be looking somewhere else for the latest API. Whoops! Well, the documentation reflects what I meant for those APIs to be called, but as you've discovered, it doesn't match the reality. I'll get that fixed for the next release. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/fxruby-users/attachments/20061018/b9a9d707/attachment.html From Ray at Bovet.org Wed Oct 18 22:18:25 2006 From: Ray at Bovet.org (Ray Bovet) Date: Wed, 18 Oct 2006 20:18:25 -0600 Subject: [fxruby-users] Trouble updating image in an icon In-Reply-To: <000901c6f289$7ce23a40$4d867b52@gerard56z3982r> References: <4535AABE.1090808@Bovet.org> <000901c6f289$7ce23a40$4d867b52@gerard56z3982r> Message-ID: <4536E071.9000102@Bovet.org> Many thanks to G?rard and to Tobias who both responded quickly to my plea! It works fine now. It's wonderful to get such quick and helpful response!!! Ray G?rard M?nochet wrote: >> def displayImage( myViewFile, theApp, theImage) >> iconFile = File.open( myViewFile, "rb") >> theImage.icon = FXGIFIcon.new(theApp, iconFile.read) >> > > # Here, you should have something like :' theImage.icon.create() . > Not needed before theApp.create() > > >> iconFile.close >> end >> > > > > > > ----- Original Message ----- > From: "Ray Bovet" > To: > Sent: Wednesday, October 18, 2006 6:17 AM > Subject: [fxruby-users] Trouble updating image in an icon > > > >> Okay, I've tried to figure this out on my own, but I'm not getting very >> far. I'm sure I've made some utterly dumb newbie mistake - hopefully it >> won't take long for someone who understands FXRuby better than I do to >> set me straight. I'm trying to write a program to display an image in a >> window. Then, when you click on the window it should display the next >> image. The FXRuby User's Guide has great information about setting up >> an icon and loading an image into it. It also shows how to tie a >> command to a button press. But I seem to be having lots of trouble >> displaying the new image after the button press. Any comments on how to >> improve the code would be gratefully accepted! The code below results >> in the messages below as soon as I click on the image once: >> >> This application has requested the Runtime to terminate it in an unusual >> way. >> Please contact the application's support team for more information. >> Got a click on the image >> testicon.rb:28: [BUG] Segmentation fault >> ruby 1.8.4 (2006-04-14) [i386-mswin32] >> >> >Exit code: 3 >> >> Here's the code: >> >> require 'rubygems' >> require 'fox16' >> include Fox >> >> myViewFile = "starEdit.gif" >> >> def displayImage( myViewFile, theApp, theImage) >> iconFile = File.open( myViewFile, "rb") >> theImage.icon = FXGIFIcon.new(theApp, iconFile.read) >> iconFile.close >> end >> >> theApp = FXApp.new >> theMainWindow = FXMainWindow.new( theApp, "starShow") >> count = 0 >> theImage = FXButton.new(theMainWindow, "image") >> theImage.connect(SEL_COMMAND) do |sender, selector, data| >> count += 1 >> STDERR.puts( "Got a click on the image") >> # imagine code here to update the image file. >> displayImage( myViewFile, theApp, theImage) >> theMainWindow.show >> end >> >> displayImage( myViewFile, theApp, theImage) >> theApp.create >> theMainWindow.show >> theApp.run >> >> >> Thanks for your help! >> >> Ray Bovet >> >> _______________________________________________ >> fxruby-users mailing list >> fxruby-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/fxruby-users >> >> > > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users > > > From steviedizzle at gmail.com Thu Oct 19 18:37:41 2006 From: steviedizzle at gmail.com (Steven Davidovitz) Date: Thu, 19 Oct 2006 18:37:41 -0400 Subject: [fxruby-users] Canvas Rubberband Selection Message-ID: <20061019183741.ebda1def.steviedizzle@gmail.com> Yeah, sorry about that. You can view the code at the top of the file at http://www.nebulargauntlet.org/trac/ng/browser/branches/mapeditor-fox/lib/renderarea.rb From gerard.menochet at wanadoo.fr Sat Oct 21 05:40:53 2006 From: gerard.menochet at wanadoo.fr (=?iso-8859-1?Q?G=E9rard_M=E9nochet?=) Date: Sat, 21 Oct 2006 11:40:53 +0200 Subject: [fxruby-users] Folding in Scintilla References: <20061019183741.ebda1def.steviedizzle@gmail.com> Message-ID: <000501c6f4f5$00c47e00$f9077b52@gerard56z3982r> Hi, I'm trying to figure out how to use the folding feature in scintilla. I'd take the example from the scintilla documentation and that doesn't work. Everything is ok except the folding (nothing displayed) #~ # Fox version: 1.6.0 - win2000 here is the code MARKERNUMBER_2 = 2 MARGIN_SCRIPT_FOLD_INDEX = 2 WINDOW_ID = 900 .... # Folder self.setMarginTypeN( MARGIN_SCRIPT_FOLD_INDEX , SC_MARGIN_SYMBOL ) self.setMarginMaskN( MARGIN_SCRIPT_FOLD_INDEX , SC_MASK_FOLDERS ) self.setMarginWidthN( MARGIN_SCRIPT_FOLD_INDEX , 16 ) self.setLexer(SCLEX_RUBY) self.setStyleBits(4) self.setProperty( "fold", "1" ) self.setProperty( "fold.compact", "1" ) self.setMarginSensitiveN(MARGIN_SCRIPT_FOLD_INDEX , true ) self.markerDefine( SC_MARKNUM_FOLDEROPEN, SC_MARK_SMALLRECT) self.markerDefine( SC_MARKNUM_FOLDER, SC_MARK_PLUS ) self.markerDefine( SC_MARKNUM_FOLDERSUB, SC_MARK_EMPTY ) self.markerDefine( SC_MARKNUM_FOLDERTAIL, SC_MARK_EMPTY ) self.markerDefine( SC_MARKNUM_FOLDEREND, SC_MARK_EMPTY ) self.markerDefine( SC_MARKNUM_FOLDEROPENMID, SC_MARK_EMPTY ) self.markerDefine( SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_EMPTY ) self.setFoldFlags(16) Maybe the problem comes from SCN_MARGINCLICK and/or SCN_NEEDSHOWN. I haven't implemented the following instructions from the scintilla example: Register the "on margin click" event for the window (this is windows specific) BEGIN_MESSAGE_MAP(CDocumentWindow, CDocumentWindowsBaseClass) ON_NOTIFY(SCN_MARGINCLICK, WINDOW_ID, OnMarginClicked) END_MESSAGE_MAP() I wonder how to do that with FXRuby. Could someone tell me a hint or a solution ? Thanks G?rard M?nochet PS: I think this version doesn't really like the use of "SEL_CHANGED" on FXScintilla: abnormal program termination C:/Program Files/ruby/lib/ruby/gems/1.8/gems/fxruby-1.6.0-mswin32/lib/fox16/scintilla.r b:25: [BUG] Segmentation fault ruby 1.8.4 (2006-04-14) [i386-mswin32] From wconrad at yagni.com Sat Oct 21 13:07:21 2006 From: wconrad at yagni.com (Wayne Conrad) Date: Sat, 21 Oct 2006 10:07:21 -0700 Subject: [fxruby-users] Painting a custom control Message-ID: <20061021170721.GA23352@yagni.com> In this code, the closure I've attached to SEL_PAINT is never called. What's my newbie mistake? Fox 1.4.34, FXRuby 1.4.7, Debian testing #!/usr/bin/ruby1.8 require 'fox14' include Fox class CustomControl < FXFrame def initialize(*args) super connect(SEL_PAINT) do puts 'paint' # Never called end end def getDefaultWidth 50 end def getDefaultHeight 50 end end class Main def run app = FXApp.new main = FXMainWindow.new(app, File.basename(__FILE__)) CustomControl.new(main) main.show(PLACEMENT_SCREEN) app.create app.run end end Main.new.run if $0 == __FILE__ From lyle at knology.net Sat Oct 21 13:53:39 2006 From: lyle at knology.net (Lyle Johnson) Date: Sat, 21 Oct 2006 12:53:39 -0500 Subject: [fxruby-users] Painting a custom control In-Reply-To: <20061021170721.GA23352@yagni.com> References: <20061021170721.GA23352@yagni.com> Message-ID: On Oct 21, 2006, at 12:07 PM, Wayne Conrad wrote: > In this code, the closure I've attached to SEL_PAINT is never called. > What's my newbie mistake? The connect() method is used to define message handlers for messages sent from a widget to its target. FXFrame doesn't send a SEL_PAINT message to its target, so that's why your code never gets invoked. If you simply want to override FXFrame's default handling of SEL_PAINT, I think you'll need to do something like this: class MyFrame < FXFrame def initialize(...) FXMAPFUNC(SEL_PAINT, 0, :onPaint) end def onPaint(sender, sel, event) # Respond to expose event here end end Hope this helps, Lyle From wconrad at yagni.com Sat Oct 21 15:22:54 2006 From: wconrad at yagni.com (Wayne Conrad) Date: Sat, 21 Oct 2006 12:22:54 -0700 Subject: [fxruby-users] Painting a custom control In-Reply-To: References: <20061021170721.GA23352@yagni.com> Message-ID: <20061021192254.GA30163@yagni.com> On Sat, Oct 21, 2006 at 12:53:39PM -0500, Lyle Johnson wrote: > Hope this helps, It sure does. My custom control is now drawing itself just fine. It took me a small bit of fiddling, but not much, to figure out that "include Responder" is required before I can call FXMAPFUNC. I had thought that FXMAPFUNC was legacy stuff... I misunderstood this page: http://www.fxruby.org/doc/events.htm FXMAPFUNC is mentioned in the discussion of flaws with earlier releases of FXRuby, and not mentioned again after that. One of the examples using FXMAPFUNC was called "scribble-orig.rb", and the "scribble.rb" doesn't use it. That's another thing that made me think that FXMAPFUNC was strictly a legacy function. FXMAPFUNC doesn't appear (that I can find) in the API docs for FXRuby 1.4 or 1.6-- another reason I thought it was deprecated. Neither does Responder. Should they be in the API docs? I'm not complaining... just explaining where a newby got misled. You've been very helpful, and FXRuby has been the most enjoyable GUI framework I've tried so far. I've done Windows, OS/2 PM, TK, and both flavors of Java GUI. The reason I don't do GUIs is because the frameworks drive me to drink. FXRuby might change that. Thanks again, Lyle. Wayne Conrad From lyle at knology.net Sat Oct 21 20:53:38 2006 From: lyle at knology.net (Lyle Johnson) Date: Sat, 21 Oct 2006 19:53:38 -0500 Subject: [fxruby-users] Painting a custom control In-Reply-To: <20061021192254.GA30163@yagni.com> References: <20061021170721.GA23352@yagni.com> <20061021192254.GA30163@yagni.com> Message-ID: <19CEE025-63D4-44EB-8C5E-9CB7E8A78758@knology.net> On Oct 21, 2006, at 2:22 PM, Wayne Conrad wrote: > It sure does. My custom control is now drawing itself just fine. Great! > It took me a small bit of fiddling, but not much, to figure out that > "include Responder" is required before I can call FXMAPFUNC. Whoops. Sorry about that. > I had thought that FXMAPFUNC was legacy stuff... I misunderstood this > page: > > http://www.fxruby.org/doc/events.htm > > FXMAPFUNC is mentioned in the discussion of flaws with earlier > releases of FXRuby, and not mentioned again after that. > > One of the examples using FXMAPFUNC was called "scribble-orig.rb", and > the "scribble.rb" doesn't use it. That's another thing that made me > think that FXMAPFUNC was strictly a legacy function. > > FXMAPFUNC doesn't appear (that I can find) in the API docs for FXRuby > 1.4 or 1.6-- another reason I thought it was deprecated. Neither does > Responder. Should they be in the API docs? Probably so, until the problem is completely solved. FXMAPFUNC() is used to set up an instance's message map (i.e. which messages it responds to, and which methods implement those message handlers). Now, for most of the "interesting" message types, a widget will give its message target the "first shot" at handling any message that it receives. So, for example, if an FXButton receives a SEL_LEFTBUTTONPRESS message from the application event loop, the first thing it does is send that message to its target, to see if the target wants to handle the message: class FXButton # this is pseudo-code def onLeftBtnPress(sender, sel, event) if (target != nil) && (target handles the message) # then we're done else # do default handling end end end If the target doesn't handle it, FXButton's default handling kicks in. Now, in order for the FXButton's target to handle the message, the target's message map has to be set up to declare that it can handle SEL_LEFTBUTTONPRESS messages and so forth. This is where the connect() method comes in -- it creates an anonymous object behind the scenes, and sets up that object's message map appropriately, relieving you of the hassle. The problem (as you ran into) is that not all messages are deemed "interesting" enough to forward to a widget's target. FXFrame is a good example; that's basically a container class for *other* widgets, and it by itself doesn't have any really interesting behavior. (You hit on an exceptional case of course, which FOX can handle too.) > I'm not complaining... just explaining where a newby got misled. No, no need to apologize -- it's still somewhat of a mess for cases like yours. Luckily those are somewhat rare. I need to come up with some simple way for a widget to register handlers for messages that it *receives* (as opposed to connect(), which has to do with handlers for messages that it *sends*). > You've been very helpful, and FXRuby has been the most enjoyable GUI > framework I've tried so far. I've done Windows, OS/2 PM, TK, and both > flavors of Java GUI. The reason I don't do GUIs is because the > frameworks drive me to drink. FXRuby might change that. Thanks! From wconrad at yagni.com Sun Oct 22 11:43:24 2006 From: wconrad at yagni.com (Wayne Conrad) Date: Sun, 22 Oct 2006 08:43:24 -0700 Subject: [fxruby-users] Painting a custom control In-Reply-To: <19CEE025-63D4-44EB-8C5E-9CB7E8A78758@knology.net> References: <20061021170721.GA23352@yagni.com> <20061021192254.GA30163@yagni.com> <19CEE025-63D4-44EB-8C5E-9CB7E8A78758@knology.net> Message-ID: <20061022154323.GB30163@yagni.com> On Sat, Oct 21, 2006 at 07:53:38PM -0500, Lyle Johnson wrote: (An explanation of how some messages are "interesting" and are passed on, and how FXMAPFUNC is *mostly* legacy code, but still needed in some cases). Lyle, Great explanation. Understanding the model is most of the battle. Thanks! From wconrad at yagni.com Sun Oct 22 12:28:29 2006 From: wconrad at yagni.com (Wayne Conrad) Date: Sun, 22 Oct 2006 09:28:29 -0700 Subject: [fxruby-users] FXFrame::drawFrame not exported Message-ID: <20061022162829.GC30163@yagni.com> It looks like the protected method FXFrame::drawFrame isn't available to my subclass of FXFrame. I suspect I need it, though. My subclass of FXFrame is double-buffering. If I call "super" in my onPaint method, FXFrame::onPaint erases the area onto which I am going to blit the buffer, causing flicker. What I think I need is to call FXFrame::drawFrame(dc, ...) when I'm constructing the image. I got the idea of calling drawFrame from FX7Segment.cpp. Is there another way to get FXFrame to draw the frame for me without causing flicker? I could just never mind the frame, as I don't need it in this control. It just seems like good (that is, unsurprising) design to do what FXFrame does when subclassing it. Fox 1.4.34, FXRuby 1.4.7, Debian testing. Wayne Conrad From lyle at knology.net Sun Oct 22 13:32:57 2006 From: lyle at knology.net (Lyle Johnson) Date: Sun, 22 Oct 2006 12:32:57 -0500 Subject: [fxruby-users] FXFrame::drawFrame not exported In-Reply-To: <20061022162829.GC30163@yagni.com> References: <20061022162829.GC30163@yagni.com> Message-ID: <64E1DA34-DC3E-4A66-96AD-5713A92AFAD0@knology.net> On Oct 22, 2006, at 11:28 AM, Wayne Conrad wrote: > It looks like the protected method FXFrame::drawFrame isn't available > to my subclass of FXFrame. I suspect I need it, though. Yep. Because of how FXRuby works -- Ruby objects that are "peered" with C++ objects -- the protected and private methods aren't visible from Ruby, even if you're subclassing a FOX class. There is a workaround I can put in the code to make drawFrame() public, and I'll be glad to do that for you in the next release if it helps, but it is of course not a general solution. From wconrad at yagni.com Sun Oct 22 14:12:39 2006 From: wconrad at yagni.com (Wayne Conrad) Date: Sun, 22 Oct 2006 11:12:39 -0700 Subject: [fxruby-users] FXFrame::drawFrame not exported In-Reply-To: <64E1DA34-DC3E-4A66-96AD-5713A92AFAD0@knology.net> References: <20061022162829.GC30163@yagni.com> <64E1DA34-DC3E-4A66-96AD-5713A92AFAD0@knology.net> Message-ID: <20061022181239.GA4974@yagni.com> On Sun, Oct 22, 2006 at 12:32:57PM -0500, Lyle Johnson wrote: > There is a workaround I can put in the code to make drawFrame() > public, and I'll be glad to do that for you in the next release if it > helps, but it is of course not a general solution. I didn't figure there was a general solution. But to answer your question: Nobody's income depends on being able to call that method. But the goofing around I'm doing would sure benefit from it. And, if the workaround is just ugly, it might not be worth it. I'd sure like it, though. Wayne Conrad From philippe.lang at attiksystem.ch Tue Oct 24 16:06:00 2006 From: philippe.lang at attiksystem.ch (Philippe Lang) Date: Tue, 24 Oct 2006 22:06:00 +0200 Subject: [fxruby-users] FXTreeList, single and double clicks events Message-ID: <6C0CF58A187DA5479245E0830AF84F421D13F2@poweredge.attiksystem.ch> Hi, When double-clicking on an item in an FXTreeList, both SEL_CLICKED and SEL_DOUBLECLICKED events are generated. @treelistframe = FXVerticalFrame.new(@group_left, FRAME_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0) @tree = FXTreeList.new(@treelistframe, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_TOP|LAYOUT_RIGHT|TREELIST_SHOWS_LINES| TREELIST_SHOWS_BOXES|TREELIST_ROOT_BOXES|TREELIST_EXTENDEDSELECT) @tree.connect(SEL_CLICKED, method(:onClick)) @tree.connect(SEL_DOUBLECLICKED, method(:onDoubleClick)) def onClick(sender, sel, data) puts "click" end def onDoubleClick(sender, sel, data) puts "double-click" end Is that a feature of Fox, or a small bug maybe? Cheers, --------------- Philippe Lang Attik System -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3125 bytes Desc: not available Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20061024/b83b9057/attachment.bin From lyle at knology.net Tue Oct 24 20:08:58 2006 From: lyle at knology.net (Lyle Johnson) Date: Tue, 24 Oct 2006 19:08:58 -0500 Subject: [fxruby-users] Fwd: [FR-devel] ANNOUNCE: FXScintilla 1.71 and stopping References: <453E73E1.2060008@free.fr> Message-ID: <8E952A3C-5A11-4AC5-86B5-C4ABCD490718@knology.net> Begin forwarded message: > From: Gilles Filippini > Date: October 24, 2006 3:13:21 PM CDT > To: freeride-devel at rubyforge.org > Subject: [FR-devel] ANNOUNCE: FXScintilla 1.71 and stopping > Reply-To: freeride-devel at rubyforge.org > > Hello, > > I've just released FXScintilla 1.71. > Pease note this is the _last one_ I release since I don't use it > anymore. Anyone willing to take this project over is welcome. Just > drop > me an email. > > FXScintilla is an implementation of the Scintilla source code editing > component [1] for the FOX GUI toolkit [2]. > > Changes since the previous release (1.63): > - Upgraded to Scintilla-1.71 > - Added support for Fox-1.6 > - Dropped support for Fox-1.0. > > FXScintilla homepage: > http://www.nongnu.org/fxscintilla/ > > Downloads: > http://savannah.nongnu.org/files/?group=fxscintilla > > Cheers, > > _gilles. > > > [1] http://scintilla.org/ > [2] http://fox-toolkit.org/ > > > > > > > _______________________________________________ > Freeride-devel mailing list > Freeride-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/freeride-devel > From fxrbu1 at gi2.herzkes.de Wed Oct 25 04:19:42 2006 From: fxrbu1 at gi2.herzkes.de (fxrbu1 at gi2.herzkes.de) Date: Wed, 25 Oct 2006 10:19:42 +0200 Subject: [fxruby-users] FXTreeList, single and double clicks events In-Reply-To: <6C0CF58A187DA5479245E0830AF84F421D13F2@poweredge.attiksystem.ch> References: <6C0CF58A187DA5479245E0830AF84F421D13F2@poweredge.attiksystem.ch> Message-ID: <453F1E1E.3030208@gi2.herzkes.de> Philippe Lang wrote: > When double-clicking on an item in an FXTreeList, > both SEL_CLICKED and SEL_DOUBLECLICKED events are generated. I believe this is common behaviour among GUI toolkits since the toolkit cannot predict the future. After the first click, it does not know if a second click will follow. T. From jeroen at fox-toolkit.org Wed Oct 25 19:59:41 2006 From: jeroen at fox-toolkit.org (Jeroen van der Zijp) Date: Wed, 25 Oct 2006 18:59:41 -0500 Subject: [fxruby-users] FXTreeList, single and double clicks events In-Reply-To: <453F1E1E.3030208@gi2.herzkes.de> References: <6C0CF58A187DA5479245E0830AF84F421D13F2@poweredge.attiksystem.ch> <453F1E1E.3030208@gi2.herzkes.de> Message-ID: <200610251859.42115.jeroen@fox-toolkit.org> On Wednesday 25 October 2006 03:19, fxrbu1 at gi2.herzkes.de wrote: > Philippe Lang wrote: > > When double-clicking on an item in an FXTreeList, > > both SEL_CLICKED and SEL_DOUBLECLICKED events are generated. > > I believe this is common behaviour among GUI toolkits since the toolkit > cannot predict the future. After the first click, it does not know if a > second click will follow. Yes, that's basically just how it is; its very hard to make a prediction, especially about the future ;-) - Jeroen -- +----------------------------------------------------------------------------+ | Copyright (C) 18:50 10/25/2006 Jeroen van der Zijp. All Rights Reserved. | +----------------------------------------------------------------------------+ From drmcdona at verizon.net Thu Oct 26 14:21:19 2006 From: drmcdona at verizon.net (Dave McDonald) Date: Thu, 26 Oct 2006 14:21:19 -0400 Subject: [fxruby-users] Question about events and addInput Message-ID: <973ccb930610261121k66c52ac3k49a15b8f127dd2bb@mail.gmail.com> I am very new to FXruby so this may be a simple question (I hope). I have a ruby script I wrote to do system maintenance (backup, clean files, etc) on Windows. I wanted to add a small popup FXruby window to show what was happening and perhaps warn before rebooting, etc. Q1: I hit on the idea of having my main script start the FXruby program as a separate process and use stdout/stdin to tell the window what text to display - is this a reasonable approach? Q2: When I add the addInput code (below) I can run the FXruby window program from a command prompt and type in text and it updates; however, the window also displays the hourglass icon when the mouse pointer is over it and it blocks using the window cancel button (upper right X) to close it. Am I doing something wrong in my code that blocks the "close" event and causes the hourglass? def onInputData( sender, sel, ptr) @msg.text = $stdin.gets @app.refresh end @app.addInput($stdin, INPUT_READ, method(:onInputData)) Thanks Dave McDonald -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/fxruby-users/attachments/20061026/221f874a/attachment.html From gerard.menochet at wanadoo.fr Fri Oct 27 17:13:11 2006 From: gerard.menochet at wanadoo.fr (=?iso-8859-1?Q?G=E9rard_M=E9nochet?=) Date: Fri, 27 Oct 2006 23:13:11 +0200 Subject: [fxruby-users] FXMenuTiltle with no focus - A Workaround References: <6C0CF58A187DA5479245E0830AF84F421D13F2@poweredge.attiksystem.ch><453F1E1E.3030208@gi2.herzkes.de> <200610251859.42115.jeroen@fox-toolkit.org> Message-ID: <000c01c6fa0c$b5c117c0$4f887b52@gerard56z3982r> Hi, For those who are interested, I think I have found a decent solution for a little problem which was a very very big concern for me. (Fox 1.6.0) The workaround does nothing with FXMenuTitle (eh oui), just SEL_FOCUSIN , SEL_UPDATE on FXMenubar and a small method - getLastObjectWithFocus() - cast an eye on this program and try it !!!! require 'fox16' include Fox class MenuTitleWorkaround < FXMainWindow def initialize(pApp) @focus = nil super(pApp, "FXMenuTitle - Workaround", nil, nil, DECOR_ALL, 20, 20, 800, 600) menuBar = FXMenuBar.new(self, LAYOUT_SIDE_TOP | LAYOUT_FILL_X) menuBar.connect(SEL_FOCUSIN) do |sender, selector, data| if @focus != nil @focus.setFocus() @focus = nil end 0 end menuBar.connect(SEL_UPDATE) do |sender, selector, data| @focus = getLastObjectWithFocus() 0 end menuPane = FXMenuPane.new(menuBar) FXMenuCommand.new( menuPane, "&firstMenuCommand") a = FXMenuCommand.new( menuPane, "&Quit") a.connect(SEL_COMMAND) do |sender, selector, data| getApp.handle(self, MKUINT(FXApp::ID_QUIT, SEL_COMMAND), nil) end self.accelTable.addAccel(fxparseAccel("Alt+F4"), getApp(), FXSEL(SEL_COMMAND, FXApp::ID_QUIT)) FXMenuTitle.new( menuBar, "&File", nil, menuPane) menuPane = FXMenuPane.new(menuBar) FXMenuCommand.new( menuPane, "&What you want") FXMenuCommand.new( menuPane, "&Ect") FXMenuTitle.new( menuBar, "&Edit", nil, menuPane) splitter = FXSplitter.new(self,LAYOUT_FILL_X|LAYOUT_FILL_Y|SPLITTER_TRACKING|SPLITTER_V ERTICAL|SPLITTER_REVERSED) c = FXText.new(splitter, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y) c.setText("Feeding gas into centrifuges can produce fuel for nuclear power plants") d = FXText.new(splitter, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y) d.setText("The move is being seen as an act of international defiance by Teheran") d.setFocus() end def getLastObjectWithFocus(objectClass = nil) childrenArray = self.children objectWithFocusArray = [] childrenArray.each do |child| if child.hasFocus?() and (objectClass == nil or child.kind_of?(objectClass)) objectWithFocusArray << child end child.children.each do |grandChild| childrenArray << grandChild end end if objectWithFocusArray.length > 0 return objectWithFocusArray[objectWithFocusArray.length - 1 ] else return nil end end def create super show(PLACEMENT_SCREEN) end end exit if __FILE__ != $0 puts Fox.fxrubyversion() app=FXApp.new() app.threadsEnabled=false # ok app.setDefaultCursor(DEF_MOVE_CURSOR,FXCursor.new(app)) w=MenuTitleWorkaround.new(app) app.create w.show app.run see you G?rard M?nochet From lyle at knology.net Fri Oct 27 22:13:23 2006 From: lyle at knology.net (Lyle Johnson) Date: Fri, 27 Oct 2006 21:13:23 -0500 Subject: [fxruby-users] [ANN] FXRuby 1.6.3 Now Available Message-ID: <22B23A39-6816-401B-AA69-36F5B8DBF84C@knology.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 All, FXRuby version 1.6.3 is now available for download from this page: http://rubyforge.org/frs/?group_id=300&release_id=6924 Note that you should be using FOX 1.6.16 or later due to some important changes made in that release of FOX. Also note that due to a bug in RubyGems 0.9.0, building from the source gem isn't advised unless you're able to download to an earlier version of RubyGems. (This bug doesn't affect binary gems.) And as long as you're noting those two things, you should also note that due to a bug introduced in Ruby 1.8.5, a large number of warning messages will be printed to the console when you load FXRuby (any version) into Ruby 1.8.5. This problem is described here: http://rubyforge.org/tracker/index.php? func=detail&aid=5633&group_id=300&atid=1223 Due to this problem with FXRuby under Ruby 1.8.5, the downloads page offers builds for both Ruby versions 1.8.4 and 1.8.5 on Windows. For a summary of the changes in this release of FXRuby, please see this page: http://www.fxruby.org/doc/changes.html As usual, the code is provided as a Win32 installer or a binary Gem (both compatible with the latest One-Click Installer for Ruby 1.8.4/1.8.5), as a source gem, and as a source tarball. For instructions on compiling FXRuby from source, please see: http://www.fxruby.org/doc/build.html And as always, the FXRuby home page is here: http://www.fxruby.org Enjoy, Lyle -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (Darwin) iD8DBQFFQrzEFXV/hD6oMd0RAgpXAKCK9i6weYLqTXgu7K3cxk3KkvtNYwCfRuHD 8OV5Ta0V9sEBIbLVcXx7mAY= =7uNI -----END PGP SIGNATURE----- From philippe.lang at attiksystem.ch Sun Oct 29 13:00:18 2006 From: philippe.lang at attiksystem.ch (Philippe Lang) Date: Sun, 29 Oct 2006 19:00:18 +0100 Subject: [fxruby-users] FXTable.setTableSize & clic -> crash Message-ID: <6C0CF58A187DA5479245E0830AF84F421D142B@poweredge.attiksystem.ch> Hi Lyle, Thanks for the new version of FXRuby 1.6.3! There is still a bug in FXRuby 1.6.3, that crashes the application when you click outside the visible cells of an FXTable where no cell was selected yet. `setCurrentItem': table row out of bounds (IndexError) Note this happens only if the table is being initialized with: t.visibleRows = 3 t.visibleColumns = 3 t.setTableSize(3, 3) With the following equivalent (?) lines, the problem disappears: t.appendRows(3) t.appendColumns(3) Maybe I'm doing something wrong? Test code is provided here: ------------------------------------------------ #!/usr/bin/ruby require 'fox16' include Fox class MyWindow < FXMainWindow def initialize(app) super(app, "Window", nil, nil, DECOR_ALL, 0, 0, 600, 350) # Menu bar stretched along the top of the main window menubar = FXMenuBar.new(self, LAYOUT_SIDE_TOP|LAYOUT_FILL_X) # File menu filemenu = FXMenuPane.new(self) FXMenuTitle.new(menubar, "&File", nil, filemenu) FXMenuCommand.new(filemenu, "&Quit\tCtl-Q\tQuit the application", nil, app, FXApp::ID_QUIT) # Table f = FXHorizontalFrame.new(self, LAYOUT_FILL_X|LAYOUT_FILL_Y) t = FXTable.new(f, nil, 0, TABLE_COL_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y) t.visibleRows = 3 t.visibleColumns = 3 t.setTableSize(3, 3) # Note: problem disappears if you use the following code # instead of the 3 lines above: #t.appendRows(3) #t.appendColumns(3) end def create super show(PLACEMENT_SCREEN) end end if __FILE__ == $0 application = FXApp.new("Attik System", "FXRuby Test") MyWindow.new(application) application.create application.run End ------------------------------------------------ Cheers, --------------- Philippe Lang Attik System -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3125 bytes Desc: not available Url : http://rubyforge.org/pipermail/fxruby-users/attachments/20061029/362accac/attachment.bin From lyle at knology.net Mon Oct 30 09:00:42 2006 From: lyle at knology.net (Lyle Johnson) Date: Mon, 30 Oct 2006 08:00:42 -0600 Subject: [fxruby-users] FXTable.setTableSize & clic -> crash In-Reply-To: <6C0CF58A187DA5479245E0830AF84F421D142B@poweredge.attiksystem.ch> References: <6C0CF58A187DA5479245E0830AF84F421D142B@poweredge.attiksystem.ch> Message-ID: On Oct 29, 2006, at 12:00 PM, Philippe Lang wrote: > There is still a bug in FXRuby 1.6.3, that crashes the application > when you click outside the visible cells of an FXTable where no > cell was selected yet. Still on the bug list, here: http://rubyforge.org/tracker/index.php? func=detail&aid=5907&group_id=300&atid=1223 This is of lower priority since there are workarounds, but I'll see if it can be fixed in the next release.