From ranieri.tx at gmail.com Sat Feb 2 11:02:30 2008 From: ranieri.tx at gmail.com (Ranieri Teixeira) Date: Sat, 2 Feb 2008 13:02:30 -0300 Subject: [fxruby-users] FXRuby for 2D drawing Message-ID: <22a9d6f10802020802k242f01f1ob7dc151f18138447@mail.gmail.com> Hi, I'm working in a application for generating 2D charts with FXRuby. I use a FXPNGImage to off-screen drawing. But, the canvas repaint has many flickering, I don't think it's a problem with my machine because I use Java2D with almost no flicker effects. So: how can I significantly reduce flickering effects when drawing with FXRuby components? Thanks. -- Ranieri Barros Teixeira Ci?ncia da Computa??o - Faculdade de Computa??o - Universidade Federal do Par? (UFPA) http://rubytags.blogspot.com/ From lyle at lylejohnson.name Sat Feb 2 14:11:47 2008 From: lyle at lylejohnson.name (Lyle Johnson) Date: Sat, 2 Feb 2008 13:11:47 -0600 Subject: [fxruby-users] FXRuby for 2D drawing In-Reply-To: <22a9d6f10802020802k242f01f1ob7dc151f18138447@mail.gmail.com> References: <22a9d6f10802020802k242f01f1ob7dc151f18138447@mail.gmail.com> Message-ID: <0C128296-CA07-4FDB-AD69-2ECA748BC10E@lylejohnson.name> On Feb 2, 2008, at 10:02 AM, Ranieri Teixeira wrote: > Hi, I'm working in a application for generating 2D charts with FXRuby. > I use a FXPNGImage to off-screen drawing. But, the canvas repaint has > many flickering, I don't think it's a problem with my machine because > I use Java2D with almost no flicker effects. > So: how can I significantly reduce flickering effects when drawing > with FXRuby components? I think I would try using double-buffered drawing to see if that improved things. See this question from the FAQ for some ideas: http://www.fox-toolkit.org/faq.html#IMAGE Hope this helps, Lyle From ranieri.tx at gmail.com Fri Feb 8 07:58:38 2008 From: ranieri.tx at gmail.com (Ranieri Teixeira) Date: Fri, 8 Feb 2008 09:58:38 -0300 Subject: [fxruby-users] Dynamic resize of drawing canvas and FXImage Message-ID: <22a9d6f10802080458v5ecf8783p98d7cba5890b2b01@mail.gmail.com> How can I use the drawing canvas and its off-screen image buffer, say FXImage, to dynamically resize or have its width and height attributes changed in reply to user interaction with the main window (FXMainWindow)? It seems that whem I put initial values to W and H of the canvas or FXImage, they remain with its initial values no matter what I do whem resizing the main window. -- Ranieri Barros Teixeira Ci?ncia da Computa??o - Faculdade de Computa??o - Universidade Federal do Par? (UFPA) http://rubyxchart.rubyforge.org http://rubytags.blogspot.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/fxruby-users/attachments/20080208/7785edb8/attachment.html From lyle at lylejohnson.name Fri Feb 8 10:28:39 2008 From: lyle at lylejohnson.name (Lyle Johnson) Date: Fri, 8 Feb 2008 09:28:39 -0600 Subject: [fxruby-users] Dynamic resize of drawing canvas and FXImage In-Reply-To: <22a9d6f10802080458v5ecf8783p98d7cba5890b2b01@mail.gmail.com> References: <22a9d6f10802080458v5ecf8783p98d7cba5890b2b01@mail.gmail.com> Message-ID: On Feb 8, 2008, at 6:58 AM, Ranieri Teixeira wrote: > How can I use the drawing canvas and its off-screen image buffer, say > FXImage, to dynamically resize or have its width and height attributes > changed in reply to user interaction with the main window > (FXMainWindow)? > > It seems that whem I put initial values to W and H of the canvas or > FXImage, > they remain with its initial values no matter what I do whem > resizing the > main window. If you want the image to be as large as the canvas, you need to call resize() on the image whenever the canvas size changes. From jeroen at fox-toolkit.org Fri Feb 8 11:29:40 2008 From: jeroen at fox-toolkit.org (Jeroen van der Zijp) Date: Fri, 8 Feb 2008 10:29:40 -0600 Subject: [fxruby-users] Dynamic resize of drawing canvas and FXImage In-Reply-To: References: <22a9d6f10802080458v5ecf8783p98d7cba5890b2b01@mail.gmail.com> Message-ID: <200802081029.40704.jeroen@fox-toolkit.org> On Friday 08 February 2008, Lyle Johnson wrote: > > On Feb 8, 2008, at 6:58 AM, Ranieri Teixeira wrote: > > > How can I use the drawing canvas and its off-screen image buffer, say > > FXImage, to dynamically resize or have its width and height attributes > > changed in reply to user interaction with the main window > > (FXMainWindow)? > > > > It seems that whem I put initial values to W and H of the canvas or > > FXImage, > > they remain with its initial values no matter what I do whem > > resizing the > > main window. > > If you want the image to be as large as the canvas, you need to call > resize() on the image whenever the canvas size changes. When you manage off-screen FXImage, typically the following steps are performed: layout() is overloaded to resize the off-screen image if the widget has changed size. If the widget has changed size, OR if the content has changed, it is redrawn. onPaint() is reimplemented to simply peform a copy-draw of the image to the widget (e.g. dc.drawImage()). Thus repainting is very fast. Note that the layout() routine is usually called in the following cases: When the window changed size. When the window was flagged DIRTY. It is triggered in response to recalc(). The layout() is not called immediately, but only when the event stream is empty (it is invoked by a chore). Thus, as you interactively resize a widget the image will be resized as fast as possible, but only as fast as the system can catch up with the event stream. For reference I refer to the source code for some of the double-buffered widgets like FXGradientBar or FXChart. Hope this helps, - Jeroen From v.konrad at lse.ac.uk Sat Feb 9 09:27:20 2008 From: v.konrad at lse.ac.uk (Vladimir Konrad) Date: Sat, 9 Feb 2008 14:27:20 +0000 Subject: [fxruby-users] FXRuby, blocks and hash (? should this work} Message-ID: <20080209142720.71992ee6@whirpool> Example code (:opts omitted) It is done in initialize of Win < FXMainWinow: @cg = {} FXMatrix.new {|m| FXLabel.new(m, "Log-in name: ") @cg[:login] = {:name => FXTextField.new(m, 25)} @cg[:login][:name].setFocus p @cg[:login][:name].class FXLabel.new(m, "Password: ") @cg[:login] = {:password => FXTextField.new(m, 25)} } p @cg[:login][:name].class output is: Fox::FXTextField NilClass The question is, why id disappears? Vlad Please access the attached hyperlink for an important electronic communications disclaimer: http://www.lse.ac.uk/collections/secretariat/legal/disclaimer.htm From v.konrad at lse.ac.uk Sat Feb 9 09:40:06 2008 From: v.konrad at lse.ac.uk (Vladimir Konrad) Date: Sat, 9 Feb 2008 14:40:06 +0000 Subject: [fxruby-users] FXRuby, blocks and hash (? should this work} In-Reply-To: <20080209142720.71992ee6@whirpool> References: <20080209142720.71992ee6@whirpool> Message-ID: <20080209144006.45b18aeb@whirpool> > The question is, why id disappears? Should be "... why _it_ dissapears?" (i.e. becomes NilClass) Vlad Please access the attached hyperlink for an important electronic communications disclaimer: http://www.lse.ac.uk/collections/secretariat/legal/disclaimer.htm From rmelton at ball.com Sat Feb 9 12:57:33 2008 From: rmelton at ball.com (Melton, Ryan) Date: Sat, 9 Feb 2008 10:57:33 -0700 Subject: [fxruby-users] FXRuby, blocks and hash (? should this work} In-Reply-To: <20080209142720.71992ee6@whirpool> References: <20080209142720.71992ee6@whirpool> Message-ID: <2EC28B773AF39E47850AC45765483C2C08F2311C@AEROMSG2.AERO.BALL.COM> You overwrote the @cg[:login] hash with a new hash that only contains :password. The following change should fix it. Was: @cg[:login] = {:password => FXTextField.new(m, 25)} Is: @cg[:login][:password] = FXTextField.new(m, 25) Hope this helps, Ryan -----Original Message----- From: fxruby-users-bounces at rubyforge.org [mailto:fxruby-users-bounces at rubyforge.org] On Behalf Of Vladimir Konrad Sent: Saturday, February 09, 2008 7:27 AM To: fxruby-users at rubyforge.org Subject: [fxruby-users] FXRuby, blocks and hash (? should this work} Example code (:opts omitted) It is done in initialize of Win < FXMainWinow: @cg = {} FXMatrix.new {|m| FXLabel.new(m, "Log-in name: ") @cg[:login] = {:name => FXTextField.new(m, 25)} @cg[:login][:name].setFocus p @cg[:login][:name].class FXLabel.new(m, "Password: ") @cg[:login] = {:password => FXTextField.new(m, 25)} } p @cg[:login][:name].class output is: Fox::FXTextField NilClass The question is, why id disappears? Vlad Please access the attached hyperlink for an important electronic communications disclaimer: http://www.lse.ac.uk/collections/secretariat/legal/disclaimer.htm _______________________________________________ fxruby-users mailing list fxruby-users at rubyforge.org http://rubyforge.org/mailman/listinfo/fxruby-users This message and any enclosures are intended only for the addressee. Please notify the sender by email if you are not the intended recipient. If you are not the intended recipient, you may not use, copy, disclose, or distribute this message or its contents or enclosures to any other person and any such actions may be unlawful. Ball reserves the right to monitor and review all messages and enclosures sent to or from this email address. From v.konrad at lse.ac.uk Sat Feb 9 13:25:30 2008 From: v.konrad at lse.ac.uk (Vladimir Konrad) Date: Sat, 9 Feb 2008 18:25:30 +0000 Subject: [fxruby-users] [solved] FXRuby, blocks and hash (? should this work} In-Reply-To: <2EC28B773AF39E47850AC45765483C2C08F2311C@AEROMSG2.AERO.BALL.COM> References: <20080209142720.71992ee6@whirpool> <2EC28B773AF39E47850AC45765483C2C08F2311C@AEROMSG2.AERO.BALL.COM> Message-ID: <20080209182530.3bb94d1c@whirpool> > You overwrote the @cg[:login] hash with a new hash that only contains > :password. > Hope this helps, > Ryan Thank you, I did not see what was there but only what was in my head... Vlad Please access the attached hyperlink for an important electronic communications disclaimer: http://www.lse.ac.uk/collections/secretariat/legal/disclaimer.htm From ranieri.tx at gmail.com Tue Feb 19 07:25:18 2008 From: ranieri.tx at gmail.com (Ranieri Teixeira) Date: Tue, 19 Feb 2008 09:25:18 -0300 Subject: [fxruby-users] Drawing rotated text. Message-ID: <22a9d6f10802190425h77ad3796h4ef1bbe8ec8b009f@mail.gmail.com> Hi, I'm using a FXPNGImage to draw chart elements (axis, data, labels, lines). But, to draw axis title, that need to be vertical at left and right, how can I rotate the text? I think the solution is to create a image item for each string I want to draw, and render these images at the outer device context. But it doesn't work. Some helps to do this? Thanks, -- Ranieri Barros Teixeira Ci?ncia da Computa??o - Faculdade de Computa??o - Universidade Federal do Par? (UFPA) http://rubyxchart.rubyforge.org http://rubytags.blogspot.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/fxruby-users/attachments/20080219/f26add1a/attachment.html From jeroen at fox-toolkit.org Tue Feb 19 09:51:14 2008 From: jeroen at fox-toolkit.org (Jeroen van der Zijp) Date: Tue, 19 Feb 2008 08:51:14 -0600 Subject: [fxruby-users] Drawing rotated text. In-Reply-To: <22a9d6f10802190425h77ad3796h4ef1bbe8ec8b009f@mail.gmail.com> References: <22a9d6f10802190425h77ad3796h4ef1bbe8ec8b009f@mail.gmail.com> Message-ID: <200802190851.14136.jeroen@fox-toolkit.org> On Tuesday 19 February 2008, Ranieri Teixeira wrote: > Hi, > I'm using a FXPNGImage to draw chart elements (axis, data, labels, lines). > But, to draw axis title, that need to be vertical at left and right, how can > I rotate the text? These are the steps: 1) make a new font (name, size, etc). 2) Set the angle at which you want to draw the text; this is specified in degrees * 64, i.e. 90 degrees is 5760. 3) Realize or create() the font. 4) Draw your text. > I think the solution is to create a image item for each string I want to > draw, and render these images at the outer device context. But it doesn't > work. > Some helps to do this? FXChart draws axes etc. also. Even though its done in C++, I think it may be useful to look at. Eventually FXChart (and subclasses) will become a suite of various types of plotting controls. Hope this helps, - Jeroen From tsmith at tektone.net Mon Feb 25 17:57:54 2008 From: tsmith at tektone.net (Tim Smith) Date: Mon, 25 Feb 2008 17:57:54 -0500 Subject: [fxruby-users] Text color for individual items in FXTable Message-ID: <6B90560780C80940BB5EE1D6650C2D75DA2698@mail.tektone.net> Hello, I would like to set text colors for individual items in an FXTable. FXTable has a textColor accessor, but it applies to every item, not to individual items. So I subclassed FXTable and overrode createItem to return a subclass of FXTableItem in which I override drawContent. One of drawContent's parameters is the device context dc, but when I call dc.drawText in my customized drawContent, nothing is drawn on the screen. I know the method is being called. What might be wrong? Has anyone else managed to set text colors for individual table items? Thanks for any help, Tim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/fxruby-users/attachments/20080225/e7a3e383/attachment.html From jmthomas at ball.com Mon Feb 25 18:06:33 2008 From: jmthomas at ball.com (Thomas, Jason M (Software)) Date: Mon, 25 Feb 2008 16:06:33 -0700 Subject: [fxruby-users] Text color for individual items in FXTable References: <6B90560780C80940BB5EE1D6650C2D75DA2698@mail.tektone.net> Message-ID: <03B62622BF273442912A2E486B799DD205829B69@AEROMSG3.AERO.BALL.COM> You can use the FXTable's setCellColor to acheive a nice alternating look as shown in the screenshot on the FXRuby website. However, it sounds like you're trying to set individual cells which I haven't tried. # Table @table = FXTable.new(frame, :opts => TABLE_COL_SIZABLE|TABLE_ROW_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 2) @table.visibleRows = 20 @table.visibleColumns = 8 @table.setTableSize(50, 14) @table.setBackColor(FXRGB(255, 255, 255)) @table.setCellColor(0, 0, FXRGB(255, 255, 255)) @table.setCellColor(0, 1, FXRGB(255, 240, 240)) @table.setCellColor(1, 0, FXRGB(240, 255, 240)) @table.setCellColor(1, 1, FXRGB(240, 240, 255)) ________________________________ From: fxruby-users-bounces at rubyforge.org [mailto:fxruby-users-bounces at rubyforge.org] On Behalf Of Tim Smith Sent: Monday, February 25, 2008 3:58 PM To: fxruby-users at rubyforge.org Subject: [fxruby-users] Text color for individual items in FXTable Hello, I would like to set text colors for individual items in an FXTable. FXTable has a textColor accessor, but it applies to every item, not to individual items. So I subclassed FXTable and overrode createItem to return a subclass of FXTableItem in which I override drawContent. One of drawContent's parameters is the device context dc, but when I call dc.drawText in my customized drawContent, nothing is drawn on the screen. I know the method is being called. What might be wrong? Has anyone else managed to set text colors for individual table items? Thanks for any help, Tim This message and any enclosures are intended only for the addressee. Please notify the sender by email if you are not the intended recipient. If you are not the intended recipient, you may not use, copy, disclose, or distribute this message or its contents or enclosures to any other person and any such actions may be unlawful. Ball reserves the right to monitor and review all messages and enclosures sent to or from this email address. From tsmith at tektone.net Tue Feb 26 11:31:05 2008 From: tsmith at tektone.net (Tim Smith) Date: Tue, 26 Feb 2008 11:31:05 -0500 Subject: [fxruby-users] Text color for individual items in FXTable In-Reply-To: <03B62622BF273442912A2E486B799DD205829B69@AEROMSG3.AERO.BALL.COM> Message-ID: <6B90560780C80940BB5EE1D6650C2D75DA273B@mail.tektone.net> Right - I'm trying to set text colors for individual cells, not background colors for alternating rows and columns. In the code below, I don't even try to set colors, but just override drawContent with a Ruby translation of FXTableItem::drawContent from FXTable.cpp in the FOX distribution. But no text appears in the cells. Am I missing something? Thanks, Tim require 'fox16'; include Fox class CustomTableItem < FXTableItem def drawContent table, dc, x, y, w, h # adapted from FXTableItem::drawContent in FXTable.cpp hg=table.isHorzGridShown(); vg=table.isVertGridShown(); ml=table.getMarginLeft()+(vg ? 1 : 0); mt=table.getMarginTop()+(hg ? 1 : 0); mr=table.getMarginRight(); mb=table.getMarginBottom(); font=dc.getFont(); lbl=getText(); icn=getIcon(); # Text width and height beg=tw=th=0; begin _end=beg; _end+=1 while(_endtw th+=font.getFontHeight(); beg=_end+1; end while(_end TABLE_COL_SIZABLE|TABLE_ROW_SIZABLE|LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 2) @table.visibleRows = 20 @table.visibleColumns = 8 @table.setTableSize(50, 14) @table.setBackColor(FXRGB(255, 255, 255)) @table.setCellColor(0, 0, FXRGB(255, 255, 255)) @table.setCellColor(0, 1, FXRGB(255, 240, 240)) @table.setCellColor(1, 0, FXRGB(240, 255, 240)) @table.setCellColor(1, 1, FXRGB(240, 240, 255)) ________________________________ From: fxruby-users-bounces at rubyforge.org [mailto:fxruby-users-bounces at rubyforge.org] On Behalf Of Tim Smith Sent: Monday, February 25, 2008 3:58 PM To: fxruby-users at rubyforge.org Subject: [fxruby-users] Text color for individual items in FXTable Hello, I would like to set text colors for individual items in an FXTable. FXTable has a textColor accessor, but it applies to every item, not to individual items. So I subclassed FXTable and overrode createItem to return a subclass of FXTableItem in which I override drawContent. One of drawContent's parameters is the device context dc, but when I call dc.drawText in my customized drawContent, nothing is drawn on the screen. I know the method is being called. What might be wrong? Has anyone else managed to set text colors for individual table items? Thanks for any help, Tim This message and any enclosures are intended only for the addressee. Please notify the sender by email if you are not the intended recipient. If you are not the intended recipient, you may not use, copy, disclose, or distribute this message or its contents or enclosures to any other person and any such actions may be unlawful. Ball reserves the right to monitor and review all messages and enclosures sent to or from this email address. _______________________________________________ fxruby-users mailing list fxruby-users at rubyforge.org http://rubyforge.org/mailman/listinfo/fxruby-users From tsmith at tektone.net Tue Feb 26 11:45:11 2008 From: tsmith at tektone.net (Tim Smith) Date: Tue, 26 Feb 2008 11:45:11 -0500 Subject: [fxruby-users] Text color for individual items in FXTable In-Reply-To: <6B90560780C80940BB5EE1D6650C2D75DA273B@mail.tektone.net> Message-ID: <6B90560780C80940BB5EE1D6650C2D75DA2741@mail.tektone.net> Sorry for the mangled code formatting in my last post. Trying again: require 'fox16'; include Fox class CustomTableItem < FXTableItem def drawContent table, dc, x, y, w, h # adapted from FXTableItem::drawContent in FXTable.cpp hg=table.isHorzGridShown(); vg=table.isVertGridShown(); ml=table.getMarginLeft()+(vg ? 1 : 0); mt=table.getMarginTop()+(hg ? 1 : 0); mr=table.getMarginRight(); mb=table.getMarginBottom(); font=dc.getFont(); lbl=getText(); icn=getIcon(); # Text width and height beg=tw=th=0; begin _end=beg; _end+=1 while(_endtw th+=font.getFontHeight(); beg=_end+1; end while(_end Message-ID: <6B90560780C80940BB5EE1D6650C2D75DA288D@mail.tektone.net> Good news, everybody! I found a thread on comp.lang.ruby about a similar problem setting fonts for individual table items: http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/b568f 66fe08a69a5/625209163eb11dd8?#625209163eb11dd8 Like me, he found drawContent's dc parameter unusable. His solution was to create a new one with FXDCWindow.new. That worked for me and I can now set individual text colors; code below. If no one objects, I'll file a bug report about the unusable dc parameter. Regards, Tim require 'fox16'; include Fox class CustomTableItem < FXTableItem attr_accessor :color def drawContent table, unusable_dc, x, y, w, h FXDCWindow.new(table) {|dc| if @color and not selected? dc.setForeground @color def dc.setForeground color # stop super from setting color back end end dc.setFont unusable_dc.getFont super table, dc, x, y, w, h } end end class CustomTable < FXTable def createItem *parameters CustomTableItem.new *parameters end def setItemTextColor row, column, color getItem(row, column).color = color updateItem row, column end end app = FXApp.new main = FXMainWindow.new app, 'Test' table = CustomTable.new main table.setTableSize 2, 2 table.visibleRows = 2 table.visibleColumns = 2 table.setItemText 0, 0, 'one' table.setItemTextColor 0, 0, FXRGB(255, 0, 0) # red table.setItemText 0, 1, 'two' table.setItemTextColor 0, 1, FXRGB(0, 255, 0) # green table.setItemText 1, 0, 'three' table.setItemTextColor 1, 0, FXRGB(0, 0, 255) # blue table.setItemText 1, 1, 'four' app.create main.show PLACEMENT_SCREEN app.run From lyle at lylejohnson.name Wed Feb 27 11:31:37 2008 From: lyle at lylejohnson.name (Lyle Johnson) Date: Wed, 27 Feb 2008 10:31:37 -0600 Subject: [fxruby-users] Text color for individual items in FXTable In-Reply-To: <6B90560780C80940BB5EE1D6650C2D75DA288D@mail.tektone.net> References: <6B90560780C80940BB5EE1D6650C2D75DA288D@mail.tektone.net> Message-ID: <2F0252E9-2291-4A52-98AF-F7F0EE429A4D@lylejohnson.name> On Feb 27, 2008, at 10:23 AM, Tim Smith wrote: > Like me, he found drawContent's dc parameter unusable. His solution > was > to create a new one with FXDCWindow.new. That worked for me and I can > now set individual text colors; code below. If no one objects, I'll > file a bug report about the unusable dc parameter. No, please do file a bug report about it. I'm sorry I haven't had time to follow up on your question, things are just very busy here right now. From philippe.lang at attiksystem.ch Thu Feb 28 03:29:57 2008 From: philippe.lang at attiksystem.ch (Philippe Lang) Date: Thu, 28 Feb 2008 09:29:57 +0100 Subject: [fxruby-users] FXColorDialog slow UI update Message-ID: <6C0CF58A187DA5479245E0830AF84F4218D03B@poweredge.attiksystem.ch> Hi Lyle, I have noticed a very small problem with the FXColorDialog class: when changing the color with the color wheel, it takes quite a long time (until 4 seconds, sometimes less) for the other panels of the dialog to synchronize. The opposite is also true: when changing the color with the sliders, it may take sometimes until 4 seconds for the color wheel to reflect the change. That's not a big deal, really. I guess it is only a refresh problem, which I also had on the other parts of my framework. I solved that with: def forceImmediatePageRefresh $app.repaint $app.forceRefresh $app.flush end I'm not sure this is optimal at all, but it works! Good luck with your book, and thanks for FXRuby, Regards, Philippe Note: FXRuby 1.6.13 under Windows XP, with ruby 1.8.6 From v.konrad at lse.ac.uk Thu Feb 28 06:53:16 2008 From: v.konrad at lse.ac.uk (Vladimir Konrad) Date: Thu, 28 Feb 2008 11:53:16 +0000 Subject: [fxruby-users] FXColorDialog slow UI update In-Reply-To: <6C0CF58A187DA5479245E0830AF84F4218D03B@poweredge.attiksystem.ch> References: <6C0CF58A187DA5479245E0830AF84F4218D03B@poweredge.attiksystem.ch> Message-ID: <20080228115316.622efbb4@whirpool> > I have noticed a very small problem with the FXColorDialog class: when > changing the color with the color wheel, it takes quite a long time > (until 4 seconds, sometimes less) for the other panels of the dialog > to synchronize. Did you try to put (if your app is not multi-threaded): app.disableThreads before app.create ? I found that this speeds up the GUI updates considerably... Vlad Please access the attached hyperlink for an important electronic communications disclaimer: http://www.lse.ac.uk/collections/secretariat/legal/disclaimer.htm From philippe.lang at attiksystem.ch Thu Feb 28 08:16:00 2008 From: philippe.lang at attiksystem.ch (Philippe Lang) Date: Thu, 28 Feb 2008 14:16:00 +0100 Subject: [fxruby-users] FXColorDialog slow UI update References: <6C0CF58A187DA5479245E0830AF84F4218D03B@poweredge.attiksystem.ch> <20080228115316.622efbb4@whirpool> Message-ID: <6C0CF58A187DA5479245E0830AF84F4233816B@poweredge.attiksystem.ch> fxruby-users-bounces at rubyforge.org wrote: >> I have noticed a very small problem with the FXColorDialog class: >> when changing the color with the color wheel, it takes quite a long >> time (until 4 seconds, sometimes less) for the other panels of the >> dialog to synchronize. > > Did you try to put (if your app is not multi-threaded): > > app.disableThreads > > before app.create ? > > I found that this speeds up the GUI updates considerably... Hi, Thanks, it works just fine now. The problem disappeared. Is there a reason why multithreading slows down FXRuby so much? Philippe From v.konrad at lse.ac.uk Thu Feb 28 08:23:44 2008 From: v.konrad at lse.ac.uk (Vladimir Konrad) Date: Thu, 28 Feb 2008 13:23:44 +0000 Subject: [fxruby-users] FXColorDialog slow UI update In-Reply-To: <6C0CF58A187DA5479245E0830AF84F4233816B@poweredge.attiksystem.ch> References: <6C0CF58A187DA5479245E0830AF84F4218D03B@poweredge.attiksystem.ch> <20080228115316.622efbb4@whirpool> <6C0CF58A187DA5479245E0830AF84F4233816B@poweredge.attiksystem.ch> Message-ID: <20080228132344.1c02d5bc@whirpool> > Thanks, it works just fine now. The problem disappeared. Is there a > reason why multithreading slows down FXRuby so much? I think it has to check some lock/mutex a _lot_ to make sure that FXRuby data structures do not become corrupt (but this is only a guess, not a knowledge from an expert ;-). Vlad Please access the attached hyperlink for an important electronic communications disclaimer: http://www.lse.ac.uk/collections/secretariat/legal/disclaimer.htm From lyle at lylejohnson.name Thu Feb 28 08:56:35 2008 From: lyle at lylejohnson.name (Lyle Johnson) Date: Thu, 28 Feb 2008 07:56:35 -0600 Subject: [fxruby-users] Performance of multithreaded FXRuby apps (was: FXColorDialog slow UI update) In-Reply-To: <6C0CF58A187DA5479245E0830AF84F4233816B@poweredge.attiksystem.ch> References: <6C0CF58A187DA5479245E0830AF84F4218D03B@poweredge.attiksystem.ch> <20080228115316.622efbb4@whirpool> <6C0CF58A187DA5479245E0830AF84F4233816B@poweredge.attiksystem.ch> Message-ID: On Feb 28, 2008, at 7:16 AM, Philippe Lang wrote: > Thanks, it works just fine now. The problem disappeared. Is there a > reason why multithreading slows down FXRuby so much? It's related to the fact that Ruby doesn't use native threads, and what I therefore have to do in FOX's event loop in order to ensure that Ruby threads get scheduled. FXRuby adds a chore that yields a little slice of time to Ruby's thread scheduler whenever your application becomes idle. Even if you don't *have* any other threads in your application, the FXRuby thread will "sleep" for 100 milliseconds every time that chore runs. You can adjust the amount of time that FXRuby yields to the thread scheduler via the FXApp#sleepTime attribute, e.g. app.sleepTime = 50 # only sleep for 50ms at a time Or you can just disable it altogether (as Vlad pointed out) by calling FXApp#disableThreads. It's an ugly solution to a tricky problem, but it's all I could come up with. I am willing to consider patches that implement alternative solutions to the problem, however! Hope this helps, Lyle From philippe.lang at attiksystem.ch Thu Feb 28 10:35:18 2008 From: philippe.lang at attiksystem.ch (Philippe Lang) Date: Thu, 28 Feb 2008 16:35:18 +0100 Subject: [fxruby-users] Performance of multithreaded FXRuby apps (was:FXColorDialog slow UI update) References: <6C0CF58A187DA5479245E0830AF84F4218D03B@poweredge.attiksystem.ch><20080228115316.622efbb4@whirpool><6C0CF58A187DA5479245E0830AF84F4233816B@poweredge.attiksystem.ch> Message-ID: <6C0CF58A187DA5479245E0830AF84F4218D03D@poweredge.attiksystem.ch> fxruby-users-bounces at rubyforge.org wrote: > On Feb 28, 2008, at 7:16 AM, Philippe Lang wrote: > >> Thanks, it works just fine now. The problem disappeared. Is there a >> reason why multithreading slows down FXRuby so much? > > > It's related to the fact that Ruby doesn't use native threads, and > what I therefore have to do in FOX's event loop in order to ensure > that Ruby threads get scheduled. Hum ok. Wouldn't it be a good idea then, until threads code gets reimplemented, to disable threads by default under FXRuby? I *think* a vast majority of FXRuby programers do not use threads at all. And those who do could simply activate them explicitely? Regards, Philippe