From Alex.Decaria at millersville.edu Sat Apr 3 08:38:33 2010 From: Alex.Decaria at millersville.edu (Alex DeCaria) Date: Sat, 3 Apr 2010 08:38:33 -0400 Subject: [fxruby-users] FXlistBox.fillItems() segmentation fault - Found Work-around Message-ID: As my prior posts show, I was getting very random segmentation faults when repeatedly clearing items from a listbox and then repopulating the items. I was using the following statements: mylistbox.clearItems() mylistbox.fillItems(new_list) This would work for awhile, but after enough iterations of clearing and replacing the items in the listbox it would segmentation faults at the .fillItems call. I found a workaround. If instead, I do: mylistbox.clearItems() new_list.each { |item| mylistbox.appendItem(item) } the app works fine and never gives a segmentation fault. I don't know why the latter is stable, while the former is not, but at least I found a working solution. I thought I'd post this in case someone else runs into this problem in the future. --Alex -------------- next part -------------- An HTML attachment was scrubbed... URL: From tester.paul at gmail.com Sat Apr 3 23:50:35 2010 From: tester.paul at gmail.com (Paul Carvalho) Date: Sat, 3 Apr 2010 23:50:35 -0400 Subject: [fxruby-users] What I've learned about FXRegistry and Windows so far Message-ID: I learned some interesting lessons while working with FXRegistry so far. I decided to blog my learnings so I can remember them later. I thought I'd post a note here in case anyone is interested. There are 2 blog posts: http://ruby-expedition.blogspot.com/2010/04/fxregistry-and-windows-registry.html http://ruby-expedition.blogspot.com/2010/04/saving-window-position-with-fxregistry.html The second blog post identifies a small 'bug' that I found with the 'imageviewer.rb' example app. It's minor, but I noted it because it caused me some confusion in trying to use the FXRegistry settings. Lyle, is it worth updating the example for future releases of FXRuby? Hope this helps. Feedback welcome. Cheers! Paul. -------------- next part -------------- An HTML attachment was scrubbed... URL: From wbparsons at cshore.com Fri Apr 9 16:59:14 2010 From: wbparsons at cshore.com (Will Parsons) Date: Fri, 09 Apr 2010 16:59:14 -0400 (EDT) Subject: [fxruby-users] Problem detecting keypresses in FXTable Message-ID: <20100409.165914.02307326.wbparsons@cshore.com> I'm using an RXTable in my application and I would like to be able to select a row and then press the Delete key to delete the selected row. This does not seem to work, however, as apparently keypresses are not initially recognized. In my FXTable derived class I have: connect(SEL_KEYRELEASE) do |sender, selector, event| puts "code = #{'%X' % event.code}" case event.code when KEY_Delete, KEY_KP_Delete puts "Delete key hit" # process... # ... end end When I left-click on a row header, the row gets properly selected and highlighted, but hitting any key does not result in being recognized (i.e., the messages above do not appear). If I then click on a table cell, then subsequent keypresses cause the connected code to fire, and things work as expected. Do I have to do something to receive key events initially? -- Will From dglnz at yahoo.com Fri Apr 9 21:25:00 2010 From: dglnz at yahoo.com (dave L) Date: Fri, 9 Apr 2010 18:25:00 -0700 (PDT) Subject: [fxruby-users] Problem detecting keypresses in FXTable In-Reply-To: <20100409.165914.02307326.wbparsons@cshore.com> References: <20100409.165914.02307326.wbparsons@cshore.com> Message-ID: <609990.94254.qm@web30003.mail.mud.yahoo.com> Shouldn't it be FXTable.connect(Fox::SEL_KEYRELEASE) do |sender, selector, event| I use foxGUIb so if i am wrong i stand corrected to others who know better. rgds, Dave ________________________________ From: Will Parsons To: fxruby-users at rubyforge.org Sent: Sat, 10 April, 2010 8:59:14 AM Subject: [fxruby-users] Problem detecting keypresses in FXTable I'm using an RXTable in my application and I would like to be able to select a row and then press the Delete key to delete the selected row. This does not seem to work, however, as apparently keypresses are not initially recognized. In my FXTable derived class I have: connect(SEL_KEYRELEASE) do |sender, selector, event| puts "code = #{'%X' % event.code}" case event.code when KEY_Delete, KEY_KP_Delete puts "Delete key hit" # process... # ... end end When I left-click on a row header, the row gets properly selected and highlighted, but hitting any key does not result in being recognized (i.e., the messages above do not appear). If I then click on a table cell, then subsequent keypresses cause the connected code to fire, and things work as expected. Do I have to do something to receive key events initially? -- Will _______________________________________________ fxruby-users mailing list fxruby-users at rubyforge.org http://rubyforge.org/mailman/listinfo/fxruby-users -------------- next part -------------- An HTML attachment was scrubbed... URL: From wbparsons at cshore.com Sun Apr 11 19:29:28 2010 From: wbparsons at cshore.com (William B. Parsons) Date: Sun, 11 Apr 2010 19:29:28 -0400 Subject: [fxruby-users] Problem detecting keypresses in FXTable In-Reply-To: <609990.94254.qm@web30003.mail.mud.yahoo.com> References: <20100409.165914.02307326.wbparsons@cshore.com> <609990.94254.qm@web30003.mail.mud.yahoo.com> Message-ID: <20100411192928.c4cb2442.wbparsons@cshore.com> On Fri, 9 Apr 2010 18:25:00 -0700 (PDT) dave L wrote: > Shouldn't it be FXTable.connect(Fox::SEL_KEYRELEASE) do |sender, selector, event| > > I use foxGUIb so if i am wrong i stand corrected to others who know better. No, I think the syntax is correct - after all, it does work as expected after a mouse click on a table cell. Here's a small test program to illustrate the problem: --------------------------------------------------------------------------------------- #!/usr/bin/env ruby require 'fox16' include Fox class TopLevelWindow < FXMainWindow def initialize(app) super(app, 'Test', :width => 420, :height => 150) frame = FXVerticalFrame.new(self, :opts => FRAME_SUNKEN|LAYOUT_FILL) table = FXTable.new(frame, :opts => LAYOUT_FILL) table.setTableSize(5, 3) table.connect(SEL_SELECTED) do |sender, selector, data| if data.col == 0 puts "row #{data.row} selected" end end table.connect(SEL_KEYPRESS) do |sender, selector, event| puts "code = #{'%X' % event.code}" end end def create super show(PLACEMENT_SCREEN) end end app = FXApp.new(ARGV[0]) TopLevelWindow.new(app) # kick off application app.create app.run --------------------------------------------------------------------------------------- After selecting a row initially, keypresses (or releases) are not dectected until there is a mouse click within a cell, after which key presses/releases are detected. What I want to do - select a row and then press to Del/Delete key to delete it - I would think would a fairly common thing to want to do when dealing with tables. Haven't other people come across this issue? ___________________________ > From: Will Parsons > To: fxruby-users at rubyforge.org > Sent: Sat, 10 April, 2010 8:59:14 AM > Subject: [fxruby-users] Problem detecting keypresses in FXTable > > I'm using an RXTable in my application and I would like to be able to > select a row and then press the Delete key to delete the selected row. > This does not seem to work, however, as apparently keypresses are not > initially recognized. In my FXTable derived class I have: > > connect(SEL_KEYRELEASE) do |sender, selector, event| > puts "code = #{'%X' % event.code}" > case event.code > when KEY_Delete, KEY_KP_Delete > puts "Delete key hit" > # process... > # ... > end > end > > When I left-click on a row header, the row gets properly selected and > highlighted, but hitting any key does not result in being recognized > (i.e., the messages above do not appear). If I then click on a table > cell, then subsequent keypresses cause the connected code to fire, and > things work as expected. Do I have to do something to receive key > events initially? -- William B. Parsons From tester.paul at gmail.com Thu Apr 15 01:21:51 2010 From: tester.paul at gmail.com (Paul Carvalho) Date: Thu, 15 Apr 2010 01:21:51 -0400 Subject: [fxruby-users] How can you bold the text in a label? Message-ID: I'm having some difficulty trying to bold the text in a FXLabel object. The catch is that I *don't* want to specify a font. Is it possible to tell the text to use a bold style without specifying the font? I'd like the app to use the bold style of whatever system font is in use by default. Is it possible to do this? -------------- next part -------------- An HTML attachment was scrubbed... URL: From matma.rex at gmail.com Thu Apr 15 08:45:39 2010 From: matma.rex at gmail.com (=?UTF-8?Q?Bartosz_Dziewo=C5=84ski?=) Date: Thu, 15 Apr 2010 14:45:39 +0200 Subject: [fxruby-users] How can you bold the text in a label? In-Reply-To: References: Message-ID: 2010/4/15 Paul Carvalho : > I'm having some difficulty trying to bold the text in a FXLabel object. ?The > catch is that I *don't* want to specify a font. > Is it possible to tell the text to use a bold style without specifying the > font? ?I'd like the app to use the bold style of whatever system font is in > use by default. Have you tried to use nil/empty string font face and use font style hint "System"? Or try any font together with the hint? I haven't tried it myself, but according to docs it might work. -- Matma Rex - http://matma-rex.prv.pl/ From philippe.lang at attiksystem.ch Thu Apr 15 03:31:00 2010 From: philippe.lang at attiksystem.ch (Philippe Lang) Date: Thu, 15 Apr 2010 09:31:00 +0200 Subject: [fxruby-users] Adding / Deleting controls dynamically Message-ID: <8AE5A725DAF7364F97FF75D99E45B6573E6242D4@SBS1.attiksystem.local> Hi, I'm developing a user interface for querying an SQL database, where controls are being added/deleted dynamically, while the user is working. Everything works just fine when adding controls: you just have to "create" the control, and then call "recalc" for the frame where the control has been added. At some point, I need to delete everything which was added, and start over. This is where I start having problems. Here is some test code, where I tried to reproduce the problem. Add a few controls, delete them all, and add one again: you will see it does not appear at the right place, as if the previous "destroyed" controls where still here, somehow. Does anyone know how to clean all childs of a frame correctly? Best regards! ------------------------------------------------------------- #!/usr/bin/ruby require 'fox16' include Fox class MyWindow < FXMainWindow def initialize(app) super(app, "Window", nil, nil, DECOR_ALL, 0, 0, 400, 200) stack = FXVerticalFrame.new(self, FRAME_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y) # Frame where controls are being dynamically added / deleted dynamic_frame = FXHorizontalFrame.new(stack, FRAME_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y) # Bottom frame for buttons button_frame = FXHorizontalFrame.new(stack, FRAME_NONE|LAYOUT_FILL_X) # Button that adds a control in the dynamic_frame. Works fine. FXButton.new(button_frame, "add").connect(SEL_COMMAND) do |sender, selector, data| FXButton.new(dynamic_frame, "button").create dynamic_frame.recalc end # Button that deletes all child windows of dynamic_frame. # Works, except that afterwards, new controls are not added at the right place. FXButton.new(button_frame, "remove all").connect(SEL_COMMAND) do |sender, selector, data| dynamic_frame.each_child do |child| child.destroy end dynamic_frame.recalc end end def create super show(PLACEMENT_SCREEN) end end if __FILE__ == $0 $app = application = FXApp.new("Attik System", "FXRuby Test") MyWindow.new(application) application.create application.run end ------------------------------------------------------------- Attik System web : http://www.attiksystem.ch Philippe Lang phone: +41 26 422 13 75 rte de la Fonderie 2 gsm : +41 79 351 49 94 1700 Fribourg pgp : http://keyserver.pgp.com -------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 476 bytes Desc: not available URL: From tester.paul at gmail.com Thu Apr 15 12:30:43 2010 From: tester.paul at gmail.com (Paul Carvalho) Date: Thu, 15 Apr 2010 12:30:43 -0400 Subject: [fxruby-users] How can you bold the text in a label? In-Reply-To: References: Message-ID: I'm not at my development computer right now so I can't tell you the exact code I tried, but I can say that, yes, I did try to use a nil/empty string font face and Ruby choked on it -- didn't like it. I tried "system" as a font face and that *really* didn't do what I wanted either! =) I entered "arial" and then the one label font changed - I had forgotten that the default system font is not Arial. So the one label really stands out now because it's a totally different font.. which is not what I want. I don't want to hard-code a font that is different from the system font, especially if the app will run on different platforms and I don't know what the default fonts will be. I can try some other variations tonight. I've already spent over 4 hours on this and haven't gotten it to work. Maybe I just needed a break to see something that I've missed. I thought it would be something that would have come up by now.. I've seen lots of apps where a label is bolded to indicate a required field. I just haven't found any FXRuby examples of this *without* also specifying the font at the same time. Cheers. P. 2010/4/15 Bartosz Dziewo?ski : > > Have you tried to use nil/empty string font face and use font style > hint "System"? Or try any font together with the hint? > > I haven't tried it myself, but according to docs it might work. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkinsella at ancillaryservices.com Thu Apr 15 13:04:07 2010 From: jkinsella at ancillaryservices.com (Joey Kinsella) Date: Thu, 15 Apr 2010 13:04:07 -0400 Subject: [fxruby-users] How can you bold the text in a label? In-Reply-To: References: Message-ID: There are definitely better ways of doing this, but here is a basic example: Begin code ----------------- #! /usr/bin/env ruby require 'rubygems' require 'fox16' include Fox class SimpleWindow < FXMainWindow def initialize(app) super(app, "My Simple Window", :opts => DECOR_ALL, :width => 640, :height => 480) draw_widgets() end def draw_widgets() label = FXLabel.new(self, "This is my label that is normal.") label.font = FXFont.new(getApp(), select_font()) label2 = FXLabel.new(self, "This is my label that is bold.") label2.font = FXFont.new(getApp(), select_font(FONTWEIGHT_BOLD)) end def select_font(weight = FONTWEIGHT_NORMAL) f = FXFontDesc.new() f.encoding = FONTENCODING_DEFAULT f.face = "Helvetica" f.flags = 0 f.setwidth = FONTSETWIDTH_WIDE f.size = 100 f.slant = FONTSLANT_REGULAR f.weight = weight return (f) end def create() super() show(PLACEMENT_SCREEN) end end if(__FILE__ == $0) app = FXApp.new("Example", "Example") win = SimpleWindow.new(app) app.create() app.run() end -------------- End Code... I Hope this helps! http://www.fxruby.org/doc/api/classes/Fox/FXFont.html On Thu, Apr 15, 2010 at 12:30 PM, Paul Carvalho wrote: > I'm not at my development computer right now so I can't tell you the exact > code I tried, but I can say that, yes, I did try to use a nil/empty string > font face and Ruby choked on it -- didn't like it. > > I tried "system" as a font face and that *really* didn't do what I wanted > either! =) > > I entered "arial" and then the one label font changed - I had forgotten > that the default system font is not Arial. So the one label really stands > out now because it's a totally different font.. which is not what I want. > > I don't want to hard-code a font that is different from the system font, > especially if the app will run on different platforms and I don't know what > the default fonts will be. > > I can try some other variations tonight. I've already spent over 4 hours > on this and haven't gotten it to work. Maybe I just needed a break to see > something that I've missed. > > I thought it would be something that would have come up by now.. I've seen > lots of apps where a label is bolded to indicate a required field. I just > haven't found any FXRuby examples of this *without* also specifying the font > at the same time. > > Cheers. P. > > > 2010/4/15 Bartosz Dziewo?ski : > > >> Have you tried to use nil/empty string font face and use font style >> hint "System"? Or try any font together with the hint? >> >> I haven't tried it myself, but according to docs it might work. >> >> > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users > -- If you are not the intended recipient, you are hereby notified that any dissemination, distribution, copying or other use of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkinsella at ancillaryservices.com Thu Apr 15 13:41:42 2010 From: jkinsella at ancillaryservices.com (Joey Kinsella) Date: Thu, 15 Apr 2010 13:41:42 -0400 Subject: [fxruby-users] Adding / Deleting controls dynamically In-Reply-To: <8AE5A725DAF7364F97FF75D99E45B6573E6242D4@SBS1.attiksystem.local> References: <8AE5A725DAF7364F97FF75D99E45B6573E6242D4@SBS1.attiksystem.local> Message-ID: Pretty close... Try changing the following code: dynamic_frame.each_child do |child| child.destroy end to: dynamic_frame.each_child do |child| dynamic_frame.removeChild(child) end Seems to work. On Thu, Apr 15, 2010 at 3:31 AM, Philippe Lang wrote: > Hi, > > I'm developing a user interface for querying an SQL database, where > controls are being added/deleted dynamically, while the user is working. > > Everything works just fine when adding controls: you just have to "create" > the control, and then call "recalc" for the frame where the control has been > added. > > At some point, I need to delete everything which was added, and start over. > This is where I start having problems. > > Here is some test code, where I tried to reproduce the problem. Add a few > controls, delete them all, and add one again: you will see it does not > appear at the right place, as if the previous "destroyed" controls where > still here, somehow. > > Does anyone know how to clean all childs of a frame correctly? > > Best regards! > > ------------------------------------------------------------- > #!/usr/bin/ruby > > require 'fox16' > > include Fox > > class MyWindow < FXMainWindow > > def initialize(app) > > super(app, "Window", nil, nil, DECOR_ALL, 0, 0, 400, 200) > > stack = FXVerticalFrame.new(self, > FRAME_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y) > > # Frame where controls are being dynamically added / deleted > dynamic_frame = FXHorizontalFrame.new(stack, > FRAME_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y) > > # Bottom frame for buttons > button_frame = FXHorizontalFrame.new(stack, FRAME_NONE|LAYOUT_FILL_X) > > # Button that adds a control in the dynamic_frame. Works fine. > FXButton.new(button_frame, "add").connect(SEL_COMMAND) do |sender, > selector, data| > FXButton.new(dynamic_frame, "button").create > dynamic_frame.recalc > end > > # Button that deletes all child windows of dynamic_frame. > # Works, except that afterwards, new controls are not added at the right > place. > FXButton.new(button_frame, "remove all").connect(SEL_COMMAND) do > |sender, selector, data| > dynamic_frame.each_child do |child| > child.destroy > end > dynamic_frame.recalc > end > > end > > def create > super > show(PLACEMENT_SCREEN) > end > > end > > if __FILE__ == $0 > $app = application = FXApp.new("Attik System", "FXRuby Test") > MyWindow.new(application) > application.create > application.run > end > > ------------------------------------------------------------- > Attik System web : http://www.attiksystem.ch > Philippe Lang phone: +41 26 422 13 75 > rte de la Fonderie 2 gsm : +41 79 351 49 94 > 1700 Fribourg pgp : http://keyserver.pgp.com > > > > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users > -- If you are not the intended recipient, you are hereby notified that any dissemination, distribution, copying or other use of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkinsella at ancillaryservices.com Thu Apr 15 15:25:06 2010 From: jkinsella at ancillaryservices.com (Joey Kinsella) Date: Thu, 15 Apr 2010 15:25:06 -0400 Subject: [fxruby-users] How can you bold the text in a label? In-Reply-To: References: Message-ID: sorry, I missed that one line where you said you didn't want to specify the font.. You could probably just use the code I posted and use self.font.font instead of "Helvetica" ... This would use whatever FXMainWindow is using, which is most likely the OS's default font... Good Luck! On Thu, Apr 15, 2010 at 1:04 PM, Joey Kinsella < jkinsella at ancillaryservices.com> wrote: > There are definitely better ways of doing this, but here is a basic > example: > > Begin code > ----------------- > > #! /usr/bin/env ruby > > require 'rubygems' > require 'fox16' > > include Fox > > class SimpleWindow < FXMainWindow > def initialize(app) > super(app, "My Simple Window", :opts => DECOR_ALL, > :width => 640, :height => 480) > > draw_widgets() > end > > def draw_widgets() > label = FXLabel.new(self, "This is my label that is normal.") > label.font = FXFont.new(getApp(), select_font()) > > label2 = FXLabel.new(self, "This is my label that is bold.") > label2.font = FXFont.new(getApp(), select_font(FONTWEIGHT_BOLD)) > > end > > def select_font(weight = FONTWEIGHT_NORMAL) > f = FXFontDesc.new() > f.encoding = FONTENCODING_DEFAULT > f.face = "Helvetica" > f.flags = 0 > f.setwidth = FONTSETWIDTH_WIDE > f.size = 100 > f.slant = FONTSLANT_REGULAR > f.weight = weight > > return (f) > > end > > def create() > super() > show(PLACEMENT_SCREEN) > end > end > > if(__FILE__ == $0) > app = FXApp.new("Example", "Example") > win = SimpleWindow.new(app) > > app.create() > app.run() > end > > -------------- > End Code... > > I Hope this helps! > http://www.fxruby.org/doc/api/classes/Fox/FXFont.html > > On Thu, Apr 15, 2010 at 12:30 PM, Paul Carvalho wrote: > >> I'm not at my development computer right now so I can't tell you the exact >> code I tried, but I can say that, yes, I did try to use a nil/empty string >> font face and Ruby choked on it -- didn't like it. >> >> I tried "system" as a font face and that *really* didn't do what I wanted >> either! =) >> >> I entered "arial" and then the one label font changed - I had forgotten >> that the default system font is not Arial. So the one label really stands >> out now because it's a totally different font.. which is not what I want. >> >> I don't want to hard-code a font that is different from the system font, >> especially if the app will run on different platforms and I don't know what >> the default fonts will be. >> >> I can try some other variations tonight. I've already spent over 4 hours >> on this and haven't gotten it to work. Maybe I just needed a break to see >> something that I've missed. >> >> I thought it would be something that would have come up by now.. I've seen >> lots of apps where a label is bolded to indicate a required field. I just >> haven't found any FXRuby examples of this *without* also specifying the font >> at the same time. >> >> Cheers. P. >> >> >> 2010/4/15 Bartosz Dziewo?ski : >> >> >>> Have you tried to use nil/empty string font face and use font style >>> hint "System"? Or try any font together with the hint? >>> >>> I haven't tried it myself, but according to docs it might work. >>> >>> >> _______________________________________________ >> fxruby-users mailing list >> fxruby-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/fxruby-users >> > > -- If you are not the intended recipient, you are hereby notified that any dissemination, distribution, copying or other use of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately. -------------- next part -------------- An HTML attachment was scrubbed... URL: From philippe.lang at attiksystem.ch Mon Apr 19 05:55:48 2010 From: philippe.lang at attiksystem.ch (Philippe Lang) Date: Mon, 19 Apr 2010 11:55:48 +0200 Subject: [fxruby-users] Adding / Deleting controls dynamically In-Reply-To: References: <8AE5A725DAF7364F97FF75D99E45B6573E6242D4@SBS1.attiksystem.local> Message-ID: <8AE5A725DAF7364F97FF75D99E45B65740B3A75E@SBS1.attiksystem.local> Hi, Thanks Joey, your solution works fine. But there is something strange when deleting children of an FXScrollWindow: it always ends up with a SEGMENTION FAULT on my computer. Does anyone have the same problem? You can use the test code below: clicking on the "remove scroll_frame children" button crashes the application. The other 2 buttons work correctly. I suspect a bug in FXRuby of Fox... My config: Windows XP, Ruby 1.8.6 patch level 111, patched FXRuby 1.6.19. ------------------------------------------------------------- #!/usr/bin/ruby require 'fox16' include Fox class MyWindow < FXMainWindow def initialize(app) super(app, "Window", nil, nil, DECOR_ALL, 0, 0, 400, 150) stack_frame = FXVerticalFrame.new(self, FRAME_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y) scroll_frame = FXScrollWindow.new(stack_frame, LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_SIDE_TOP) matrix_frame = FXMatrix.new(scroll_frame, 10, MATRIX_BY_COLUMNS|LAYOUT_FILL_X|LAYOUT_FILL_Y) (1..17).each do FXButton.new(matrix_frame, "button") end # Bottom frame for buttons button_frame = FXVerticalFrame.new(stack_frame, FRAME_NONE|LAYOUT_FILL_X) # Removes all children from stack_frame container: OK FXButton.new(button_frame, "remove stack_frame children").connect(SEL_COMMAND) do |sender, selector, data| stack_frame.each_child do |child| stack_frame.removeChild(child) end stack_frame.recalc end # Removes all children from stack_frame container: SEGMENTATION FAULT FXButton.new(button_frame, "remove scroll_frame children").connect(SEL_COMMAND) do |sender, selector, data| scroll_frame.each_child do |child| scroll_frame.removeChild(child) end scroll_frame.recalc end # Removes all children from stack_frame container: OK FXButton.new(button_frame, "remove matrix_frame children").connect(SEL_COMMAND) do |sender, selector, data| matrix_frame.each_child do |child| matrix_frame.removeChild(child) end matrix_frame.recalc end end def create super show(PLACEMENT_SCREEN) end end if __FILE__ == $0 $app = application = FXApp.new("Attik System", "FXRuby Test") MyWindow.new(application) application.create application.run end ------------------------------------------------------------- Attik System web : http://www.attiksystem.ch Philippe Lang phone: +41 26 422 13 75 rte de la Fonderie 2 gsm : +41 79 351 49 94 1700 Fribourg pgp : http://keyserver.pgp.com > -----Message d'origine----- > De?: fxruby-users-bounces at rubyforge.org [mailto:fxruby-users- > bounces at rubyforge.org] De la part de Joey Kinsella > Envoy??: jeudi 15 avril 2010 19:42 > ??: fxruby-users at rubyforge.org > Objet?: Re: [fxruby-users] Adding / Deleting controls dynamically > > Pretty close... > > Try changing the following code: > > dynamic_frame.each_child do |child| > child.destroy > end > > to: > dynamic_frame.each_child do |child| > dynamic_frame.removeChild(child) > end > > Seems to work. > > > On Thu, Apr 15, 2010 at 3:31 AM, Philippe Lang > wrote: > > > Hi, > > I'm developing a user interface for querying an SQL database, > where controls are being added/deleted dynamically, while the user is > working. > > Everything works just fine when adding controls: you just have to > "create" the control, and then call "recalc" for the frame where the > control has been added. > > At some point, I need to delete everything which was added, and > start over. This is where I start having problems. > > Here is some test code, where I tried to reproduce the problem. > Add a few controls, delete them all, and add one again: you will see it > does not appear at the right place, as if the previous "destroyed" > controls where still here, somehow. > > Does anyone know how to clean all childs of a frame correctly? > > Best regards! > > ------------------------------------------------------------- > #!/usr/bin/ruby > > require 'fox16' > > include Fox > > class MyWindow < FXMainWindow > > def initialize(app) > > super(app, "Window", nil, nil, DECOR_ALL, 0, 0, 400, 200) > > stack = FXVerticalFrame.new(self, > FRAME_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y) > > # Frame where controls are being dynamically added / deleted > dynamic_frame = FXHorizontalFrame.new(stack, > FRAME_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y) > > # Bottom frame for buttons > button_frame = FXHorizontalFrame.new(stack, > FRAME_NONE|LAYOUT_FILL_X) > > # Button that adds a control in the dynamic_frame. Works fine. > FXButton.new(button_frame, "add").connect(SEL_COMMAND) do > |sender, selector, data| > FXButton.new(dynamic_frame, "button").create > dynamic_frame.recalc > end > > # Button that deletes all child windows of dynamic_frame. > # Works, except that afterwards, new controls are not added at > the right place. > FXButton.new(button_frame, "remove all").connect(SEL_COMMAND) > do |sender, selector, data| > dynamic_frame.each_child do |child| > child.destroy > end > dynamic_frame.recalc > end > > end > > def create > super > show(PLACEMENT_SCREEN) > end > > end > > if __FILE__ == $0 > $app = application = FXApp.new("Attik System", "FXRuby Test") > MyWindow.new(application) > application.create > application.run > end > > ------------------------------------------------------------- > Attik System web : http://www.attiksystem.ch > Philippe Lang phone: +41 26 422 13 75 > rte de la Fonderie 2 gsm : +41 79 351 49 94 > 1700 Fribourg pgp : http://keyserver.pgp.com > > > > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users > > > > -- > If you are not the intended recipient, you are hereby notified that any > dissemination, distribution, copying or other use of this communication > is strictly prohibited. If you have received this communication in > error, please notify us immediately. -------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 474 bytes Desc: not available URL: From jack.zelig at gmail.com Mon Apr 19 06:56:02 2010 From: jack.zelig at gmail.com (Jack Zelig) Date: 19 Apr 2010 12:56:02 +0200 Subject: [fxruby-users] Adding / Deleting controls dynamically In-Reply-To: <8AE5A725DAF7364F97FF75D99E45B65740B3A75E@SBS1.attiksystem.local> References: <8AE5A725DAF7364F97FF75D99E45B6573E6242D4@SBS1.attiksystem.local> <8AE5A725DAF7364F97FF75D99E45B65740B3A75E@SBS1.attiksystem.local> Message-ID: <4BCC36C2.7010205@gmail.com> Am 19.04.2010 11:55, schrieb Philippe Lang: > But there is something strange when deleting children of an FXScrollWindow: it always ends up with a SEGMENTION FAULT on my computer. Does anyone have the same problem? You can use the test code below: Yup, segmentation fault here using your code supplied. Running: ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32] on 64bit Win7 FXRuby: fxruby (1.6.16) From seen at cc.no Mon Apr 26 02:26:17 2010 From: seen at cc.no (Stein-Erik) Date: Mon, 26 Apr 2010 08:26:17 +0200 Subject: [fxruby-users] FXRuby: Tab key navigation not working properly in my test program Message-ID: <4BD53209.3090702@cc.no> An HTML attachment was scrubbed... URL: From seen at cc.no Mon Apr 26 09:00:54 2010 From: seen at cc.no (Stein-Erik) Date: Mon, 26 Apr 2010 15:00:54 +0200 Subject: [fxruby-users] Is dynamically changing keyboard accelerators OK? Message-ID: <4BD58E86.90806@cc.no> An HTML attachment was scrubbed... URL: From naldo_ds at yahoo.com.br Mon Apr 26 21:50:03 2010 From: naldo_ds at yahoo.com.br (Reginaldo Francisco) Date: Mon, 26 Apr 2010 22:50:03 -0300 Subject: [fxruby-users] i18n messages Message-ID: <4BD642CB.8070209@yahoo.com.br> Hi everybody, I'm Reginaldo (from Brazil), and this is my first message at fxruby-users list (actually, I'm "digging" FXRuby and its API only four days ago). My interest is to popularize desktop development with Ruby here in my region and I think FXRuby will help me very much in this task. So, starting it, how could I translate FXRuby constant messages (texts of buttons and labels of a FXPrintDialog, for example) from english to any other language (portuguese, spanish, french, italian, german)? Should I use a FXTranslation instance? How can I use it? Thanks in advance, Reginaldo Francisco naldo_ds at yahoo.com.br From tester.paul at gmail.com Wed Apr 28 00:29:51 2010 From: tester.paul at gmail.com (Paul Carvalho) Date: Wed, 28 Apr 2010 00:29:51 -0400 Subject: [fxruby-users] i18n messages In-Reply-To: <4BD642CB.8070209@yahoo.com.br> References: <4BD642CB.8070209@yahoo.com.br> Message-ID: On 26 April 2010 21:50, Reginaldo Francisco wrote: > So, starting it, how could I translate FXRuby constant messages (texts of > buttons and labels of a FXPrintDialog, for example) from english to any > other language (portuguese, spanish, french, italian, german)? Should I use > a FXTranslation instance? How can I use it? > > Thanks in advance, > > Hello Reginaldo, I faced a similar problem when designing an app a few months ago. I solved it using 2 tricks. The first was to take ALL the strings out of the app script/code and put them into a separate strings file. Then from the main app I call the strings file and all of the elements use the variables instead. This way I can change the strings and labels to be whatever I want (in whatever language I want) and I don't have to update the app - just change the strings file. The second problem was how to print special characters. I don't know what FXTranslation instance is, so I didn't use that. In the FXRuby examples folder I found a script called "unicode.rb". On my windows box, the path is: C:\ruby\lib\ruby\gems\1.8\gems\fxruby-1.6.12-mswin32\examples I copied the module from unicode.rb into my app and modified the strings files to include a 'u' at the start of the lines with unicode characters. There might be other ways to do this, but I'm okay with this solution for now. The strings aren't so easy to read with the "U+0000" for every accented character, but it worked so I moved on. I've included some sample scripts below. Try them to see if it works for what you want to do. Hope this helps. Let me know if you find a different way to do this. Cheers. Paul. ------- File 1: strings_PT_BR.rb ------- $app_title = u"OlU+00E1" $button_label = u"&OlU+00E1 mundo!" $another_label = "This string has no accented characters and so it doesn't have a 'u' before the quotation marks." # end of file ------- File 2: hello_i18n.rb ------- require 'fox16' include Fox # Accented Unicode characters need special handling to display correctly in the UI: require 'jcode' $KCODE = 'UTF8' module Kernel def u( str ) String.new str.gsub(/U\+([0-9a-fA-F]{4,4})/u){["#$1".hex ].pack('U*')} end end # load the strings: require "strings_PT_BR" application = FXApp.new($app_title, "FoxTest") main = FXMainWindow.new(application, $app_title, nil, nil, DECOR_ALL) FXButton.new(main, $button_label, nil, application, FXApp::ID_QUIT) application.create() main.show(PLACEMENT_SCREEN) application.run() # end of file -------------- next part -------------- An HTML attachment was scrubbed... URL: From michel at demazure.com Wed Apr 28 03:13:00 2010 From: michel at demazure.com (Michel Demazure) Date: Wed, 28 Apr 2010 09:13:00 +0200 Subject: [fxruby-users] i18n messages In-Reply-To: References: <4BD642CB.8070209@yahoo.com.br> Message-ID: <006e01cae6a2$3cc5b200$b6511600$@com> Reginaldo, I do the same thing Paul does, slightly differently. I have a yaml file with the different languages describing a two-levels hash : language => {name => string} Then I read the file, build @strings = hash[language], and then use @strings[name]. Paul, I always work in ruby 1.9 and UTF8 (code file and data files), and my files contain accented letters of all kinds. Why do you need bother with U+? ? Michel Demazure michel at demazure.com De : fxruby-users-bounces at rubyforge.org [mailto:fxruby-users-bounces at rubyforge.org] De la part de Paul Carvalho Envoy? : mercredi 28 avril 2010 06:30 ? : fxruby-users at rubyforge.org Objet : Re: [fxruby-users] i18n messages On 26 April 2010 21:50, Reginaldo Francisco wrote: So, starting it, how could I translate FXRuby constant messages (texts of buttons and labels of a FXPrintDialog, for example) from english to any other language (portuguese, spanish, french, italian, german)? Should I use a FXTranslation instance? How can I use it? Thanks in advance, Hello Reginaldo, I faced a similar problem when designing an app a few months ago. I solved it using 2 tricks. The first was to take ALL the strings out of the app script/code and put them into a separate strings file. Then from the main app I call the strings file and all of the elements use the variables instead. This way I can change the strings and labels to be whatever I want (in whatever language I want) and I don't have to update the app - just change the strings file. The second problem was how to print special characters. I don't know what FXTranslation instance is, so I didn't use that. In the FXRuby examples folder I found a script called "unicode.rb". On my windows box, the path is: C:\ruby\lib\ruby\gems\1.8\gems\fxruby-1.6.12-mswin32\examples I copied the module from unicode.rb into my app and modified the strings files to include a 'u' at the start of the lines with unicode characters. There might be other ways to do this, but I'm okay with this solution for now. The strings aren't so easy to read with the "U+0000" for every accented character, but it worked so I moved on. I've included some sample scripts below. Try them to see if it works for what you want to do. Hope this helps. Let me know if you find a different way to do this. Cheers. Paul. ------- File 1: strings_PT_BR.rb ------- $app_title = u"OlU+00E1" $button_label = u"&OlU+00E1 mundo!" $another_label = "This string has no accented characters and so it doesn't have a 'u' before the quotation marks." # end of file ------- File 2: hello_i18n.rb ------- require 'fox16' include Fox # Accented Unicode characters need special handling to display correctly in the UI: require 'jcode' $KCODE = 'UTF8' module Kernel def u( str ) String.new str.gsub(/U\+([0-9a-fA-F]{4,4})/u){["#$1".hex ].pack('U*')} end end # load the strings: require "strings_PT_BR" application = FXApp.new($app_title, "FoxTest") main = FXMainWindow.new(application, $app_title, nil, nil, DECOR_ALL) FXButton.new(main, $button_label, nil, application, FXApp::ID_QUIT) application.create() main.show(PLACEMENT_SCREEN) application.run() # end of file -------------- next part -------------- An HTML attachment was scrubbed... URL: From matma.rex at gmail.com Wed Apr 28 06:38:45 2010 From: matma.rex at gmail.com (=?UTF-8?Q?Bartosz_Dziewo=C5=84ski?=) Date: Wed, 28 Apr 2010 12:38:45 +0200 Subject: [fxruby-users] i18n messages In-Reply-To: <006e01cae6a2$3cc5b200$b6511600$@com> References: <4BD642CB.8070209@yahoo.com.br> <006e01cae6a2$3cc5b200$b6511600$@com> Message-ID: I don't think that's what Reginaldo meant. > constant messages (texts of buttons and labels of a FXPrintDialog, for example) (I don't know how to do it myself, just pointing out) -- Matma Rex - http://matma-rex.prv.pl/ From jkinsella at ancillaryservices.com Wed Apr 28 09:23:31 2010 From: jkinsella at ancillaryservices.com (Joey Kinsella) Date: Wed, 28 Apr 2010 09:23:31 -0400 Subject: [fxruby-users] i18n messages In-Reply-To: References: <4BD642CB.8070209@yahoo.com.br> <006e01cae6a2$3cc5b200$b6511600$@com> Message-ID: This was an interesting question, what it looks like happens (atleast for FXPrintDialog) is use the FXTranslator object. --- C++ snippets --- /* FXPrintDialog.cpp */ FXGroupBox *dest = new FXGroupBox(contents, tr("Print Destination"), GROUPBOX_TITLE_LEFT|FRAME_RIDGE|LAYOUT_FILL_X|LAYOUT_FILL_Y,0,0,0,0, 10,10,5,5 10,5); ---- Looking through the tr() functions appears to do this: --- /* FXWindow.cpp */ const FXchar *FXWindow::tr(const FXchar *message, const FXchar* hint) const { FXTranslator *translator = getApp()->getTranslator(); if(translator){ return translator->tr(getClassName(), message, hint); } return message; } --- Translator tr() --- /* FXTranslator.cpp */ const FXchar *FXTranslator::tr(const FXchar* context,const FXchar* message, const FXchar* hint) const { FXTRACE((200,"tr context '%s' message: '%s' hint: '%s'.\n",context,message,hint?hint:"")); return message; } ------------------------------------ Ok, so looking through that it doesn't seem to actually map anything... (This was fox-1.6.35 source code.) So, I'm not really sure how to do translations on const values. Someone with more experience in the Fox/FXRuby libraries might be able to guide you though. Glancing through the FXRuby source I don't see anything additional or different being done for the FXTranslator object. but that's just a glance.. Further investigation could yield something else. I hope this helps in some way. Thanks, -J 2010/4/28 Bartosz Dziewo?ski > I don't think that's what Reginaldo meant. > > > constant messages (texts of buttons and labels of a FXPrintDialog, for > example) > > (I don't know how to do it myself, just pointing out) > > -- > Matma Rex - http://matma-rex.prv.pl/ > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users > -- If you are not the intended recipient, you are hereby notified that any dissemination, distribution, copying or other use of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately. -------------- next part -------------- An HTML attachment was scrubbed... URL: From naldo_ds at yahoo.com.br Wed Apr 28 10:09:04 2010 From: naldo_ds at yahoo.com.br (Reginaldo Francisco) Date: Wed, 28 Apr 2010 11:09:04 -0300 Subject: [fxruby-users] i18n messages In-Reply-To: References: <4BD642CB.8070209@yahoo.com.br> <006e01cae6a2$3cc5b200$b6511600$@com> Message-ID: <4BD84180.90701@yahoo.com.br> Thanks Paul and Michel, your resource string file solutions are very interesting and i'll certain use them at some moment in my projects, but what i really want (thanks Bartosz) is to modify the content of a FXPrintDialog (e.g. I'd like to change english caption texts of buttons, labels, groups like "Print", "Pages", "Size" to portuguese expressions "Imprimir", "P?ginas", "Tamanho"). The problem is that I don't have access to those widgets on the FXPrintDialog public interface (In the file C:\Program Files\Ruby\lib\ruby\gems\1.9.1\gems\fxruby-1.6.20-x86-mingw32\swig-interfaces\FXPrintDialog.i they seem to be private attributes) Is there any manner to do that? P.S. in my last post i was trying to mention FXTranslator, and not FXTranslation. Does anybody know something about it? Reginaldo Francisco naldo_ds at yahoo.com.br Em 28/04/2010 07:38, Bartosz Dziewo?ski escreveu: > I don't think that's what Reginaldo meant. > > >> constant messages (texts of buttons and labels of a FXPrintDialog, for example) >> > (I don't know how to do it myself, just pointing out) > > From naldo_ds at yahoo.com.br Wed Apr 28 10:28:17 2010 From: naldo_ds at yahoo.com.br (Reginaldo Francisco) Date: Wed, 28 Apr 2010 11:28:17 -0300 Subject: [fxruby-users] i18n messages In-Reply-To: References: <4BD642CB.8070209@yahoo.com.br> <006e01cae6a2$3cc5b200$b6511600$@com> Message-ID: <4BD84601.3020706@yahoo.com.br> > Glancing through the FXRuby source I don't see anything additional or > different being done for the FXTranslator object. but that's just a > glance.. Further investigation could yield something else. It's that Joey, I did not find anything to do that, even how to use a FXTranslator! Reginaldo Francisco naldo_ds at yahoo.com.br From jkinsella at ancillaryservices.com Wed Apr 28 11:43:40 2010 From: jkinsella at ancillaryservices.com (Joey Kinsella) Date: Wed, 28 Apr 2010 11:43:40 -0400 Subject: [fxruby-users] i18n messages In-Reply-To: <4BD84601.3020706@yahoo.com.br> References: <4BD642CB.8070209@yahoo.com.br> <006e01cae6a2$3cc5b200$b6511600$@com> <4BD84601.3020706@yahoo.com.br> Message-ID: After further investigation, it's as easy as this: require 'fox16' include Fox # Create a Translation Class class ExampleTranslator < FXTranslator # tr() is called to translate the text # c = context # m = message # h = hint def tr(c, m, h) # here you would probably do something like Paul did with a file to map stuff, but for an example I just matched on # one string. if(m == "Print Destination") # if text matches "Print Destination" translate to "Something totally different" return ("Something totally different") end # otherwise we just return the message. return (m) end end # End example Translation class. # Basic stuff.. app = FXApp.new("Test", "Test") # Set the translator for our application to be our Translator app.translator = ExampleTranslator.new(app) # More basic stuff. win = FXMainWindow.new(app, "Test App", :opts => DECOR_ALL) pd = FXPrintDialog.new(win, "Test") app.create win.show pd.show app.run -------------------------------------------- I realized after sending my email that the tr() function in FXTranslator was virtual, and intended to be overwritten by self-written algorithms. Good luck :) On Wed, Apr 28, 2010 at 10:28 AM, Reginaldo Francisco wrote: > > Glancing through the FXRuby source I don't see anything additional or >> different being done for the FXTranslator object. but that's just a glance.. >> Further investigation could yield something else. >> > > It's that Joey, I did not find anything to do that, even how to use a > FXTranslator! > > > Reginaldo Francisco > naldo_ds at yahoo.com.br > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users > -- If you are not the intended recipient, you are hereby notified that any dissemination, distribution, copying or other use of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately. -------------- next part -------------- An HTML attachment was scrubbed... URL: From tester.paul at gmail.com Wed Apr 28 14:57:57 2010 From: tester.paul at gmail.com (Paul Carvalho) Date: Wed, 28 Apr 2010 14:57:57 -0400 Subject: [fxruby-users] i18n messages In-Reply-To: <006e01cae6a2$3cc5b200$b6511600$@com> References: <4BD642CB.8070209@yahoo.com.br> <006e01cae6a2$3cc5b200$b6511600$@com> Message-ID: Hello Michel, I don't want to bother with the unicode table codes. I just followed the example from the unicode.rb script (from Ruby 1.8) and since it worked I moved on. I'm still working on getting the main guts of the app working, so i haven't had a chance to go back to the strings and find a better way of doing it. I have taken a break from working on my app for a few weeks now. I am interested in your yaml solution. Could you please send me some simple examples - like the "hello world" one I sent in my previous post? That would be great. I'd like to avoid using the unicode character codes in my strings file if I can. Thanks. Cheers! Paul. (P.S., Sorry Reginaldo that I didn't understand your problem correctly.) On 28 April 2010 03:13, Michel Demazure wrote: > Reginaldo, I do the same thing Paul does, slightly differently. I have a > yaml file with the different languages describing a two-levels hash : > > language => {name => string} > > Then I read the file, build @strings = hash[language], and then use > @strings[name]. > > Paul, I always work in ruby 1.9 and UTF8 (code file and data files), and my > files contain accented letters of all kinds. Why do you need bother with U+? > ? > > Michel Demazure > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From michel at demazure.com Thu Apr 29 02:53:43 2010 From: michel at demazure.com (Michel Demazure) Date: Thu, 29 Apr 2010 08:53:43 +0200 Subject: [fxruby-users] i18n messages In-Reply-To: References: <4BD642CB.8070209@yahoo.com.br> <006e01cae6a2$3cc5b200$b6511600$@com> Message-ID: <000001cae768$b5815ed0$20841c70$@com> Paul, First I have a labels.yaml file looking like ## YAML --- fr: :entry: 'Marche/Arr?t' :pages: 'Pages' en: :entry: 'GO/STOP' :pages: 'Pages' I load it with labels = nil File.open(this_file,?r:utf-8?){ |f| labels = YAML.load(f) } I fix the language @strings = labels[?fr?] Then I use for instance FXLabel(@strings[:entry] ?.) Actually, the chosen language also comes from a user config file (another YAML file) @strings = labels[config[?language?]] Two comments on YAML. First, you always can choose between Strings and Symbols for keys and values. As you see, I mixed Symbols for labels and Strings for the language key. It looks strange. The reason is that *I* write the label file and Symbols are neater and more rubyesque, but *the user* has to write his config file and is seems simpler to have him write language: en than language: :en or even :language: :en The second remark is a small trick. I always forget the precise syntax of a YAML file. So I open irb, type for instance { a => { :b => c}}.to_yaml and look. By the way, you may have to ?require ?yaml??. A last word. I have been using FXRuby for more than two years. One thing to remember : when after a change, suddenly nothing appears on the screen when you start your app, it means you forgot to ?create? something (font.create, canvas.create, image.create ?). I hope this helps. Michel De : fxruby-users-bounces at rubyforge.org [mailto:fxruby-users-bounces at rubyforge.org] De la part de Paul Carvalho Envoy? : mercredi 28 avril 2010 20:58 ? : fxruby-users at rubyforge.org Objet : Re: [fxruby-users] i18n messages Hello Michel, I don't want to bother with the unicode table codes. I just followed the example from the unicode.rb script (from Ruby 1.8) and since it worked I moved on. I'm still working on getting the main guts of the app working, so i haven't had a chance to go back to the strings and find a better way of doing it. I have taken a break from working on my app for a few weeks now. I am interested in your yaml solution. Could you please send me some simple examples - like the "hello world" one I sent in my previous post? That would be great. I'd like to avoid using the unicode character codes in my strings file if I can. Thanks. Cheers! Paul. (P.S., Sorry Reginaldo that I didn't understand your problem correctly.) On 28 April 2010 03:13, Michel Demazure wrote: Reginaldo, I do the same thing Paul does, slightly differently. I have a yaml file with the different languages describing a two-levels hash : language => {name => string} Then I read the file, build @strings = hash[language], and then use @strings[name]. Paul, I always work in ruby 1.9 and UTF8 (code file and data files), and my files contain accented letters of all kinds. Why do you need bother with U+? ? Michel Demazure -------------- next part -------------- An HTML attachment was scrubbed... URL: