From williams.jayson at gmail.com Wed Oct 3 17:22:11 2007 From: williams.jayson at gmail.com (Jayson Williams) Date: Wed, 3 Oct 2007 17:22:11 -0400 Subject: [wxruby-users] WxRuby Newbie Application Hanging Message-ID: <8bd354bf0710031422h17d2971ao8a7e265b8aff4aec@mail.gmail.com> I have a WxRuby application that takes a few inputs from the user and uses that information to search through a large file for matches. The application works very well, with one exception. If I click anywhere in the frame while the application is searching through the long file, the application hangs. Has anyone experienced anything similar to this? Any suggestions on how I can fix this? Thanks Jayson From williams.jayson at gmail.com Wed Oct 3 17:31:53 2007 From: williams.jayson at gmail.com (Jayson Williams) Date: Wed, 3 Oct 2007 17:31:53 -0400 Subject: [wxruby-users] How to Deactivate a button Message-ID: <8bd354bf0710031431y72f3718ahe9496d9a450f6557@mail.gmail.com> How do you make a button inactive, so that it is visible, but it will not respond to clicks? Thanks Jayson From jay at mcgavren.com Wed Oct 3 23:10:02 2007 From: jay at mcgavren.com (Jay McGavren) Date: Wed, 3 Oct 2007 20:10:02 -0700 Subject: [wxruby-users] wxRuby: MemoryDC problems... Message-ID: <839490bc0710032010v4c1b06adkb876c793653eacb6@mail.gmail.com> I'm trying to put together a quick test of buffered animation with WxRuby, but I'm encountering a fair amount of trouble... I'm drawing to a Wx::Bitmap first, then using Wx::DC#draw_bitmap to copy it to a Wx::Window. But I get the following error: C:/ruby/lib/ruby/gems/1.8/gems/wxruby-1.9.1-i386-mswin32/lib/wx/classes/bitmap.rb:18:in `draw': uninitialized constant Wxruby2::Bitmap::MemoryDC (NameError) from dc_draw_line.rb:30:in `on_init' ... What am I doing wrong? Is MemoryDC not implemented yet in WxRuby 1.9.1? It's in the documentation, but I know large chunks of that are auto-generated... My code is below. Any advice would be most appreciated! -Jay gems_loaded = false begin require 'wx' rescue LoadError if gems_loaded == false require 'rubygems' gems_loaded = true retry else raise end end class MyApp < Wx::App def on_init #Create the top window. frame = Wx::Frame.new(nil, :size => [300, 300]) #Create a panel within it. view = Wx::Window.new(frame) buffer = Wx::Bitmap.new(300, 300) @x = 0 #Set up a handler for paint events. view.evt_paint do |event| #Wx::Window#paint takes a block. #This will later be called with a device context to paint on. view.paint do |dc| buffer.draw do |buffer_dc| buffer_dc.clear buffer_dc.pen = Wx::Pen.new(Wx::Colour.new(128, 128, 128), 5) buffer_dc.draw_line(@x, 0, @x + 100, 100) end dc.draw_bitmap(buffer, 0, 0, false) end @x += 1 end #Show the window. frame.show return true end end app = MyApp.new app.main_loop From sean.m.long at gmail.com Thu Oct 4 02:47:00 2007 From: sean.m.long at gmail.com (Sean Long) Date: Wed, 3 Oct 2007 23:47:00 -0700 Subject: [wxruby-users] WxRuby Newbie Application Hanging In-Reply-To: <8bd354bf0710031422h17d2971ao8a7e265b8aff4aec@mail.gmail.com> References: <8bd354bf0710031422h17d2971ao8a7e265b8aff4aec@mail.gmail.com> Message-ID: Jayson, This was talked about a few months ago, here are the links to the conversations. http://rubyforge.org/pipermail/wxruby-users/2007-May/003064.html The code you want is in this thread http://rubyforge.org/pipermail/wxruby-users/2007-June/003152.html Welcome to wxRuby Sean On 10/3/07, Jayson Williams wrote: > I have a WxRuby application that takes a few inputs from the user and > uses that information to search through a large file for matches. The > application works very well, with one exception. If I click anywhere > in the frame while the application is searching through the long file, > the application hangs. Has anyone experienced anything similar to > this? Any suggestions on how I can fix this? > > Thanks > Jayson > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > From sean.m.long at gmail.com Thu Oct 4 03:02:07 2007 From: sean.m.long at gmail.com (Sean Long) Date: Thu, 4 Oct 2007 00:02:07 -0700 Subject: [wxruby-users] How to Deactivate a button In-Reply-To: <8bd354bf0710031431y72f3718ahe9496d9a450f6557@mail.gmail.com> References: <8bd354bf0710031431y72f3718ahe9496d9a450f6557@mail.gmail.com> Message-ID: You can use the enable() method that is inherited from Wx::Window. ex: button = Wx::Button.new(SOME_ID,...) button.enable(false) This way of doing it will cause the button to also look disabled. If you do not wish for it to look disabled you will have to setup a block that does nothing when the event is triggered. Sean On 10/3/07, Jayson Williams wrote: > How do you make a button inactive, so that it is visible, but it will > not respond to clicks? > > Thanks > Jayson > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > From williams.jayson at gmail.com Thu Oct 4 11:48:57 2007 From: williams.jayson at gmail.com (Jayson Williams) Date: Thu, 4 Oct 2007 11:48:57 -0400 Subject: [wxruby-users] WxRuby Newbie Application Hanging In-Reply-To: References: <8bd354bf0710031422h17d2971ao8a7e265b8aff4aec@mail.gmail.com> Message-ID: <8bd354bf0710040848s2b23b9fcs45c7968a73a9235b@mail.gmail.com> Thanks for the assist. Unfortunately this didnt work for me. I added the code to my on_init method, but no change in the UI hang. Here is my on_init (some lines left out for brevity). Would you mind having a look? def on_init t = Wx::Timer.new(self, 55) evt_timer(55) { Thread.pass } t.start(100) buildElements updateStatus('',:setup) updateStatus(status_a,:and) updateStatus(status_b,:bnd) evt_button(SUBMIT_ID)do |event| formPassFlag = checkForm status = (formPassFlag == true) ? 'Processing...' : 'Form Error' updateStatus(status,:and) if formPassFlag == true @@submit_bt.enable(false) threads = [] threads << Thread.new(){getErrors} threads.each{|thread|thread.join} end On 10/4/07, Sean Long wrote: > Jayson, > > This was talked about a few months ago, here are the links to the conversations. > > http://rubyforge.org/pipermail/wxruby-users/2007-May/003064.html > > The code you want is in this thread > http://rubyforge.org/pipermail/wxruby-users/2007-June/003152.html > > Welcome to wxRuby > > Sean > > On 10/3/07, Jayson Williams wrote: > > I have a WxRuby application that takes a few inputs from the user and > > uses that information to search through a large file for matches. The > > application works very well, with one exception. If I click anywhere > > in the frame while the application is searching through the long file, > > the application hangs. Has anyone experienced anything similar to > > this? Any suggestions on how I can fix this? > > > > Thanks > > Jayson > > _______________________________________________ > > wxruby-users mailing list > > wxruby-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/wxruby-users > > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > From sean.m.long at gmail.com Thu Oct 4 13:05:03 2007 From: sean.m.long at gmail.com (Sean Long) Date: Thu, 4 Oct 2007 10:05:03 -0700 Subject: [wxruby-users] WxRuby Newbie Application Hanging In-Reply-To: <8bd354bf0710040848s2b23b9fcs45c7968a73a9235b@mail.gmail.com> References: <8bd354bf0710031422h17d2971ao8a7e265b8aff4aec@mail.gmail.com> <8bd354bf0710040848s2b23b9fcs45c7968a73a9235b@mail.gmail.com> Message-ID: Jayson, I have not used this technique myself so I may be of little help, have you tried changing the value passed to t.start? Also try a different value for the ID of the timer, Wx::ID_HIGHEST + 1 will be guaranteed not to be used elsewhere. Sean On 10/4/07, Jayson Williams wrote: > Thanks for the assist. Unfortunately this didnt work for me. I added > the code to my on_init method, but no change in the UI hang. Here is > my on_init (some lines left out for brevity). Would you mind having a > look? > > def on_init > t = Wx::Timer.new(self, 55) > evt_timer(55) { Thread.pass } > t.start(100) > > buildElements > updateStatus('',:setup) > updateStatus(status_a,:and) > updateStatus(status_b,:bnd) > evt_button(SUBMIT_ID)do |event| > formPassFlag = checkForm > status = (formPassFlag == true) ? 'Processing...' : 'Form Error' > updateStatus(status,:and) > if formPassFlag == true > @@submit_bt.enable(false) > threads = [] > threads << Thread.new(){getErrors} > threads.each{|thread|thread.join} > end > > > On 10/4/07, Sean Long wrote: > > Jayson, > > > > This was talked about a few months ago, here are the links to the conversations. > > > > http://rubyforge.org/pipermail/wxruby-users/2007-May/003064.html > > > > The code you want is in this thread > > http://rubyforge.org/pipermail/wxruby-users/2007-June/003152.html > > > > Welcome to wxRuby > > > > Sean > > > > On 10/3/07, Jayson Williams wrote: > > > I have a WxRuby application that takes a few inputs from the user and > > > uses that information to search through a large file for matches. The > > > application works very well, with one exception. If I click anywhere > > > in the frame while the application is searching through the long file, > > > the application hangs. Has anyone experienced anything similar to > > > this? Any suggestions on how I can fix this? > > > > > > Thanks > > > Jayson > > > _______________________________________________ > > > wxruby-users mailing list > > > wxruby-users at rubyforge.org > > > http://rubyforge.org/mailman/listinfo/wxruby-users > > > > > _______________________________________________ > > wxruby-users mailing list > > wxruby-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/wxruby-users > > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > From jacekwiktor at gmail.com Thu Oct 4 13:30:20 2007 From: jacekwiktor at gmail.com (Jacek Nowak) Date: Thu, 4 Oct 2007 19:30:20 +0200 Subject: [wxruby-users] WxRuby Newbie Application Hanging In-Reply-To: <8bd354bf0710040848s2b23b9fcs45c7968a73a9235b@mail.gmail.com> References: <8bd354bf0710031422h17d2971ao8a7e265b8aff4aec@mail.gmail.com> <8bd354bf0710040848s2b23b9fcs45c7968a73a9235b@mail.gmail.com> Message-ID: <570d9b010710041030qbc5a031td386feef4f6a1f34@mail.gmail.com> Maybe a bit OT but I have a question related to threads & wxRuby: Will threads be fixed in the next stable release of wxRuby? Multithreading is very useful and it should be possible to use it with wxRuby in a normal way :) Actually I'm writing an application which needs to download some data from the internet (about 300-400 html files). It takes some time so I have to display a progress bar. I must have a separate thread for downloading files because if I try to do everything in the main thread the UI is not responsive and the progress bar doesn't update until I finish downloading. I have searched the archives of this mailing list and found this strange workaround with Wx::Timer. It works but to some extent - for some reason Net::HTTP#read_timeout doesn't work so if the connection is interrupted the download never ends (although if I use it in a ruby script which doesn't use wxRuby it works perfectly - I think it uses threads in a way wxRuby doesn't like). I didn't find a workaround yet. Maybe someone will fix multithreading in wxRuby? I don't know the internals of wxRuby so I don't know how easy/difficult it is to fix it. But I think that it would improve wxRuby greatly. For instance - downloading data and showing a progress bar is quite a typical task - it should be fairly straightforward to code something like this. Sorry for a long post. Other than that - wxRuby is great :) -- Jacek Nowak jacekwiktor at gmail.com From lancecarlson at gmail.com Thu Oct 4 13:37:16 2007 From: lancecarlson at gmail.com (Lance Carlson) Date: Thu, 4 Oct 2007 13:37:16 -0400 Subject: [wxruby-users] WxRuby Newbie Application Hanging In-Reply-To: <570d9b010710041030qbc5a031td386feef4f6a1f34@mail.gmail.com> References: <8bd354bf0710031422h17d2971ao8a7e265b8aff4aec@mail.gmail.com> <8bd354bf0710040848s2b23b9fcs45c7968a73a9235b@mail.gmail.com> <570d9b010710041030qbc5a031td386feef4f6a1f34@mail.gmail.com> Message-ID: <49f64a900710041037y25f4423bhf47f4ed85202df3c@mail.gmail.com> What is wrong with multi-threading in wx::ruby. Isn't the Thread class a ruby core class? On 10/4/07, Jacek Nowak wrote: > Maybe a bit OT but I have a question related to threads & wxRuby: > > Will threads be fixed in the next stable release of wxRuby? > > Multithreading is very useful and it should be possible to use it with > wxRuby in a normal way :) > > Actually I'm writing an application which needs to download some data > from the internet (about 300-400 html files). It takes some time so I > have to display a progress bar. I must have a separate thread for > downloading files because if I try to do everything in the main thread > the UI is not responsive and the progress bar doesn't update until I > finish downloading. I have searched the archives of this mailing list > and found this strange workaround with Wx::Timer. It works but to some > extent - for some reason Net::HTTP#read_timeout doesn't work so if the > connection is interrupted the download never ends (although if I use > it in a ruby script which doesn't use wxRuby it works perfectly - I > think it uses threads in a way wxRuby doesn't like). > I didn't find a workaround yet. > > Maybe someone will fix multithreading in wxRuby? I don't know the > internals of wxRuby so I don't know how easy/difficult it is to fix > it. But I think that it would improve wxRuby greatly. > For instance - downloading data and showing a progress bar is quite a > typical task - it should be fairly straightforward to code something > like this. > > Sorry for a long post. > > Other than that - wxRuby is great :) > > -- > Jacek Nowak > jacekwiktor at gmail.com > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > From williams.jayson at gmail.com Thu Oct 4 15:09:22 2007 From: williams.jayson at gmail.com (Jayson Williams) Date: Thu, 4 Oct 2007 15:09:22 -0400 Subject: [wxruby-users] How to Deactivate a button In-Reply-To: References: <8bd354bf0710031431y72f3718ahe9496d9a450f6557@mail.gmail.com> Message-ID: <8bd354bf0710041209x1aa61c99u36d2edf7113daaa6@mail.gmail.com> Thanks Sean On 10/4/07, Sean Long wrote: > You can use the enable() method that is inherited from Wx::Window. > > ex: > > button = Wx::Button.new(SOME_ID,...) > button.enable(false) > > This way of doing it will cause the button to also look disabled. If > you do not wish for it to look disabled you will have to setup a block > that does nothing when the event is triggered. > > Sean > > On 10/3/07, Jayson Williams wrote: > > How do you make a button inactive, so that it is visible, but it will > > not respond to clicks? > > > > Thanks > > Jayson > > _______________________________________________ > > wxruby-users mailing list > > wxruby-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/wxruby-users > > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > From lists at ruby-forum.com Fri Oct 5 03:16:00 2007 From: lists at ruby-forum.com (Steven Taylor) Date: Fri, 5 Oct 2007 09:16:00 +0200 Subject: [wxruby-users] Which editor Message-ID: Ok, so I'm new to Ruby and wxRuby. I come from a Basic background (RealBasic). Can somebody suggest a decent IDE that is used for wxRuby. Something where I can paste in code examples and then run them immediately. (I'm a Windows Vista user) Any suggestions welcome. -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Fri Oct 5 03:25:41 2007 From: lists at ruby-forum.com (Steven Taylor) Date: Fri, 5 Oct 2007 09:25:41 +0200 Subject: [wxruby-users] Distributing programs Message-ID: <4cc8e6af4f7e8a41e1f3d0e34a63f180@ruby-forum.com> I'm still a new user of Ruby, sort of trailling it at the moment. I've written a program using RealBasic which I can compile to Windows, Linux & Mac that accesses and maniuplates MySql databases. What I'm wanting to do is convert that program to wxRuby. Assuming the program is written and I'm satisfied that it works how simple is it to distribute, for people to download and run it. For user's to download it I'm assuming they would have to have Ruby installed on their computer. Is there an easy way to package things to Windows, Linux and/or Mac. Any suggestions welcome. Steve. Melbourne, Austrlaia. -- Posted via http://www.ruby-forum.com/. From teki321 at gmail.com Fri Oct 5 03:28:57 2007 From: teki321 at gmail.com (Bela Babik) Date: Fri, 5 Oct 2007 17:28:57 +1000 Subject: [wxruby-users] Distributing programs In-Reply-To: <4cc8e6af4f7e8a41e1f3d0e34a63f180@ruby-forum.com> References: <4cc8e6af4f7e8a41e1f3d0e34a63f180@ruby-forum.com> Message-ID: http://www.erikveenstra.nl/rubyscript2exe/index.html may work. I have used it only with console applications till now. On 10/5/07, Steven Taylor wrote: > I'm still a new user of Ruby, sort of trailling it at the moment. > > I've written a program using RealBasic which I can compile to Windows, > Linux & Mac that accesses and maniuplates MySql databases. What I'm > wanting to do is convert that program to wxRuby. > > Assuming the program is written and I'm satisfied that it works how > simple is it to distribute, for people to download and run it. For > user's to download it I'm assuming they would have to have Ruby > installed on their computer. Is there an easy way to package things to > Windows, Linux and/or Mac. > > Any suggestions welcome. > > Steve. > Melbourne, Austrlaia. > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > From teki321 at gmail.com Fri Oct 5 03:34:23 2007 From: teki321 at gmail.com (Bela Babik) Date: Fri, 5 Oct 2007 17:34:23 +1000 Subject: [wxruby-users] Which editor In-Reply-To: References: Message-ID: > Can somebody suggest a decent IDE that is used for wxRuby. Something > where I can paste in code examples and then run them immediately. (I'm a > Windows Vista user) http://raa.ruby-lang.org/cat.rhtml?category_major=Application;category_minor=IDE http://rubyjedit.org/ The netbeans ide is a good one. I am personally using Komodo edit at the moment: http://www.activestate.com/Products/komodo_edit/ and DialogBlocks for xrc editing: http://www.anthemion.co.uk/dialogblocks/ -- teki From lists at ruby-forum.com Fri Oct 5 03:50:26 2007 From: lists at ruby-forum.com (Steven Taylor) Date: Fri, 5 Oct 2007 09:50:26 +0200 Subject: [wxruby-users] Distributing programs In-Reply-To: References: <4cc8e6af4f7e8a41e1f3d0e34a63f180@ruby-forum.com> Message-ID: Bela Babik wrote: > http://www.erikveenstra.nl/rubyscript2exe/index.html > may work. I have used it only with console applications till now. Thank you, very informative. At least I know that Ruby programs can be distributed. -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Fri Oct 5 04:01:33 2007 From: lists at ruby-forum.com (Steven Taylor) Date: Fri, 5 Oct 2007 10:01:33 +0200 Subject: [wxruby-users] Which editor In-Reply-To: References: Message-ID: <9ff9a885076bbc7310061dce97a7f596@ruby-forum.com> Bela Babik wrote: >> Can somebody suggest a decent IDE that is used for wxRuby. Something >> where I can paste in code examples and then run them immediately. (I'm a >> Windows Vista user) > > > http://raa.ruby-lang.org/cat.rhtml?category_major=Application;category_minor=IDE > http://rubyjedit.org/ > > The netbeans ide is a good one. > > I am personally using Komodo edit at the moment: > http://www.activestate.com/Products/komodo_edit/ > > and DialogBlocks for xrc editing: > http://www.anthemion.co.uk/dialogblocks/ Again, thank you. Steve. -- Posted via http://www.ruby-forum.com/. From sean.m.long at gmail.com Fri Oct 5 19:35:51 2007 From: sean.m.long at gmail.com (Sean Long) Date: Fri, 5 Oct 2007 16:35:51 -0700 Subject: [wxruby-users] Distributing programs In-Reply-To: <4cc8e6af4f7e8a41e1f3d0e34a63f180@ruby-forum.com> References: <4cc8e6af4f7e8a41e1f3d0e34a63f180@ruby-forum.com> Message-ID: Making a RubyGem is another possibility. Going with a gem helps with dependency issues and rolling back to old versions is easy to do. Sean On 10/5/07, Steven Taylor wrote: > I'm still a new user of Ruby, sort of trailling it at the moment. > > I've written a program using RealBasic which I can compile to Windows, > Linux & Mac that accesses and maniuplates MySql databases. What I'm > wanting to do is convert that program to wxRuby. > > Assuming the program is written and I'm satisfied that it works how > simple is it to distribute, for people to download and run it. For > user's to download it I'm assuming they would have to have Ruby > installed on their computer. Is there an easy way to package things to > Windows, Linux and/or Mac. > > Any suggestions welcome. > > Steve. > Melbourne, Austrlaia. > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > From sean.m.long at gmail.com Fri Oct 5 19:46:39 2007 From: sean.m.long at gmail.com (Sean Long) Date: Fri, 5 Oct 2007 16:46:39 -0700 Subject: [wxruby-users] Which editor In-Reply-To: References: Message-ID: I don't really like IDE's so I can not help you there. I use TextMate on my Mac and it is great, if you have the time you can make it like an IDE if you want. I know you said you are on Windows so I thought you might want to check this out: http://e-texteditor.com/blog/2006/textmate_on_windows It is and editor trying to capture the "spirit" of TextMate but on windows. It is also written in wxWidgets (nice touch). I have not tried it. As Bela pointed out DialogBlocks is great for xrc editing, I use it for all my programs. Sean On 10/5/07, Steven Taylor wrote: > Ok, so I'm new to Ruby and wxRuby. I come from a Basic background > (RealBasic). > > Can somebody suggest a decent IDE that is used for wxRuby. Something > where I can paste in code examples and then run them immediately. (I'm a > Windows Vista user) > > Any suggestions welcome. > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > From mario at ruby-im.net Sat Oct 6 01:21:27 2007 From: mario at ruby-im.net (Mario Steele) Date: Sat, 06 Oct 2007 00:21:27 -0500 Subject: [wxruby-users] WxRuby Newbie Application Hanging In-Reply-To: <8bd354bf0710040848s2b23b9fcs45c7968a73a9235b@mail.gmail.com> References: <8bd354bf0710031422h17d2971ao8a7e265b8aff4aec@mail.gmail.com> <8bd354bf0710040848s2b23b9fcs45c7968a73a9235b@mail.gmail.com> Message-ID: <47071B57.6090207@ruby-im.net> Jayson Williams wrote: > Thanks for the assist. Unfortunately this didnt work for me. I added > the code to my on_init method, but no change in the UI hang. Here is > my on_init (some lines left out for brevity). Would you mind having a > look? > > def on_init > t = Wx::Timer.new(self, 55) > evt_timer(55) { Thread.pass } > t.start(100) > > buildElements > updateStatus('',:setup) > updateStatus(status_a,:and) > updateStatus(status_b,:bnd) > evt_button(SUBMIT_ID)do |event| > formPassFlag = checkForm > status = (formPassFlag == true) ? 'Processing...' : 'Form Error' > updateStatus(status,:and) > if formPassFlag == true > @@submit_bt.enable(false) > threads = [] > threads << Thread.new(){getErrors} > threads.each{|thread|thread.join} > end > The problem with this, is that your joining the thread. Once you create the thread, you don't need to join it, Thread.pass will pass execution to it, so that it can run, before it goes to the next one. When you do thread.join, it'll actually join that thread, and it becomes the main thread. So my suggestion to you, is to take out threads.each{|thread|thread.join} from there, and it should work, and allow the UI to update. Review my Tutorial at http://wxruby.rubyforge.org/wiki/wiki.pl?Sockets It's geared towards Socket clients, but also shows how to create Threaded Applications. Any questions, feel free to email me. Mario Steele From mario at ruby-im.net Sat Oct 6 01:24:58 2007 From: mario at ruby-im.net (Mario Steele) Date: Sat, 06 Oct 2007 00:24:58 -0500 Subject: [wxruby-users] WxRuby Newbie Application Hanging In-Reply-To: <570d9b010710041030qbc5a031td386feef4f6a1f34@mail.gmail.com> References: <8bd354bf0710031422h17d2971ao8a7e265b8aff4aec@mail.gmail.com> <8bd354bf0710040848s2b23b9fcs45c7968a73a9235b@mail.gmail.com> <570d9b010710041030qbc5a031td386feef4f6a1f34@mail.gmail.com> Message-ID: <47071C2A.5000206@ruby-im.net> Jacek Nowak wrote: > Maybe a bit OT but I have a question related to threads & wxRuby: > > Will threads be fixed in the next stable release of wxRuby? > > Multithreading is very useful and it should be possible to use it with > wxRuby in a normal way :) > > Actually I'm writing an application which needs to download some data > from the internet (about 300-400 html files). It takes some time so I > have to display a progress bar. I must have a separate thread for > downloading files because if I try to do everything in the main thread > the UI is not responsive and the progress bar doesn't update until I > finish downloading. I have searched the archives of this mailing list > and found this strange workaround with Wx::Timer. It works but to some > extent - for some reason Net::HTTP#read_timeout doesn't work so if the > connection is interrupted the download never ends (although if I use > it in a ruby script which doesn't use wxRuby it works perfectly - I > think it uses threads in a way wxRuby doesn't like). > I didn't find a workaround yet. > > Maybe someone will fix multithreading in wxRuby? I don't know the > internals of wxRuby so I don't know how easy/difficult it is to fix > it. But I think that it would improve wxRuby greatly. > For instance - downloading data and showing a progress bar is quite a > typical task - it should be fairly straightforward to code something > like this. > > Sorry for a long post. > > Other than that - wxRuby is great :) > Hey Jacek, As I've just posted, my suggestion is to look at my tutorial about writing Networking Clients. You can find it: http://wxruby.rubyforge.org/wiki/wiki.pl?Sockets It gives you a good idea of how to allow threads to work with Network Communications. Any questions, feel free to email me, Mario Steele From mario at ruby-im.net Sat Oct 6 01:34:58 2007 From: mario at ruby-im.net (Mario Steele) Date: Sat, 06 Oct 2007 00:34:58 -0500 Subject: [wxruby-users] WxRuby Newbie Application Hanging In-Reply-To: <49f64a900710041037y25f4423bhf47f4ed85202df3c@mail.gmail.com> References: <8bd354bf0710031422h17d2971ao8a7e265b8aff4aec@mail.gmail.com> <8bd354bf0710040848s2b23b9fcs45c7968a73a9235b@mail.gmail.com> <570d9b010710041030qbc5a031td386feef4f6a1f34@mail.gmail.com> <49f64a900710041037y25f4423bhf47f4ed85202df3c@mail.gmail.com> Message-ID: <47071E82.1080706@ruby-im.net> Lance Carlson wrote: > What is wrong with multi-threading in wx::ruby. Isn't the Thread class > a ruby core class? > Hey Lance, There is a problem with Multi-Threading that you may not realize, Ruby uses Green Threads, which means, that Ruby is the one in control of all the threads. It contains the code that actually creates a "Virtual Thread", that only the Ruby Interpreter knows about. wxRuby, or rather wxWidgets in general, uses OS Thread creation. wxRuby currently does not implement the wxThread class, cause the Ruby interpreter (Atleast as of 1.8 series) is not Thread compliant. But there are ways around that, and I've posted a tutorial, as previously mentioned twice now, that shows a work around, that will allow you to work with wxRuby and Ruby's green threads. But yea, there are problems, and work arounds to make some things work. L8ers, Mario Steele From wxruby at gmx.net Sat Oct 6 09:00:39 2007 From: wxruby at gmx.net (wxruby at gmx.net) Date: Sat, 06 Oct 2007 15:00:39 +0200 Subject: [wxruby-users] Which editor In-Reply-To: References: Message-ID: <20071006130039.197560@gmx.net> Hi. My name is Christopher Bludau. I started to develop a Ruby editor with WxRuby 2 days ago. You can see some first screenshots here: http://img368.imageshack.us/img368/3835/wxrubyedja9.jpg It's about 70% finished. Normally I use Scite, but I wanted to be able to splitt the Editor pane so I can see more than one file at the same time, and I wanted a project explorer. You can move files around in the tree, create new classes or directorys or delete/rename files/dirs. And of course open the files from the tree in the editor. :) And it has highlighting. At the moment my favorite style. I have to add the possibility to make this user definable. Besides that it is still a lightweight texteditor and not a heavy ide. I already like to work with it. I will make it available to the public as soon as I have - a name (currently WxRubyEd or WxRubyEditor showing that it is done with WxRuby and for Ruby - is this ok for the WxRuby team??) - a license. I thought about the MIT license. Any suggestions welcome. Please have a look at the screenshots and tell me what you think. Thanks. Have a nice day, Christopher -------- Original-Nachricht -------- > Datum: Fri, 5 Oct 2007 16:46:39 -0700 > Von: "Sean Long" > An: wxruby-users at rubyforge.org > Betreff: Re: [wxruby-users] Which editor > I don't really like IDE's so I can not help you there. I use TextMate > on my Mac and it is great, if you have the time you can make it like > an IDE if you want. > > I know you said you are on Windows so I thought you might want to > check this out: > http://e-texteditor.com/blog/2006/textmate_on_windows > > It is and editor trying to capture the "spirit" of TextMate but on > windows. It is also written in wxWidgets (nice touch). I have not > tried it. > > As Bela pointed out DialogBlocks is great for xrc editing, I use it > for all my programs. > > Sean > > On 10/5/07, Steven Taylor wrote: > > Ok, so I'm new to Ruby and wxRuby. I come from a Basic background > > (RealBasic). > > > > Can somebody suggest a decent IDE that is used for wxRuby. Something > > where I can paste in code examples and then run them immediately. (I'm a > > Windows Vista user) > > > > Any suggestions welcome. > > -- > > Posted via http://www.ruby-forum.com/. > > _______________________________________________ > > wxruby-users mailing list > > wxruby-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/wxruby-users > > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users -- GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS. Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail From mario at ruby-im.net Sat Oct 6 09:17:21 2007 From: mario at ruby-im.net (Mario Steele) Date: Sat, 06 Oct 2007 08:17:21 -0500 Subject: [wxruby-users] Which editor In-Reply-To: <20071006130039.197560@gmx.net> References: <20071006130039.197560@gmx.net> Message-ID: <47078AE1.9020607@ruby-im.net> Hello All, I was hoping to hold back on this a bit, as I'm working it over, wanting to get something workable first out, but I also have started an Editor. But instead of doing just a regular Editor, I'm working on a Full blown Interactive Development Enviroment (IDE). You can find pictures of it at http://www.trilake.net/wxRIDE/images/. Currently, I have it working with reading, saving, and even catching itself when it encounters an error itself, and writes information about it to a file, so you can send it to me. It's quite interesting. Hopefully I will have something available soon for the public to test out, but there's a lot of work to do. What is incorperated so far, is Reading and Saving files (duh), Catching itself on errors, Being able to toggle the Project Tree and Output Windows, fully workable capturing of output from a program as shown in SS2.png, somewhat buggy auto-indentation, which I'm currently working on to get the bugs out of it. And a few other things. L8ers, Mario Steele From mario at ruby-im.net Sat Oct 6 09:23:16 2007 From: mario at ruby-im.net (Mario Steele) Date: Sat, 06 Oct 2007 08:23:16 -0500 Subject: [wxruby-users] Which editor In-Reply-To: <20071006130039.197560@gmx.net> References: <20071006130039.197560@gmx.net> Message-ID: <47078C44.4010602@ruby-im.net> Hey all again, Slight modification to my previous post, you can find it at http://www.trilake.net/wxRIDE/ Screenshots are on the page itself. Enjoy! Mario Steele From alex at pressure.to Mon Oct 8 04:45:13 2007 From: alex at pressure.to (Alex Fenton) Date: Mon, 08 Oct 2007 09:45:13 +0100 Subject: [wxruby-users] wxRuby: MemoryDC problems... In-Reply-To: <839490bc0710032010v4c1b06adkb876c793653eacb6@mail.gmail.com> References: <839490bc0710032010v4c1b06adkb876c793653eacb6@mail.gmail.com> Message-ID: <4709EE19.3030804@pressure.to> Hi Jay sorry for the delay in replying. Jay McGavren wrote: > I'm drawing to a Wx::Bitmap first, then using Wx::DC#draw_bitmap to copy it to a > Wx::Window. But I get the following error: > > C:/ruby/lib/ruby/gems/1.8/gems/wxruby-1.9.1-i386-mswin32/lib/wx/classes/bitmap.rb:18:in > `draw': uninitialized constant Wxruby2::Bitmap::MemoryDC (NameError) > from dc_draw_line.rb:30:in `on_init' > It's a bug - thanks for the report. It's now fixed in SVN HEAD for version 1.9.2, but you can work around it for now by adding the correct definition of Bitmap#draw at the top of your script: class Wx::Bitmap def draw dc = Wx::MemoryDC.new dc.select_object(self) yield dc dc.select_object( Wx::NULL_BITMAP ) end end cheers alex From alex at pressure.to Tue Oct 9 06:32:57 2007 From: alex at pressure.to (Alex Fenton) Date: Tue, 09 Oct 2007 11:32:57 +0100 Subject: [wxruby-users] WxRuby Newbie Application Hanging In-Reply-To: <570d9b010710041030qbc5a031td386feef4f6a1f34@mail.gmail.com> References: <8bd354bf0710031422h17d2971ao8a7e265b8aff4aec@mail.gmail.com> <8bd354bf0710040848s2b23b9fcs45c7968a73a9235b@mail.gmail.com> <570d9b010710041030qbc5a031td386feef4f6a1f34@mail.gmail.com> Message-ID: <470B58D9.5050303@pressure.to> A bit late to this discussion, but ... Jacek Nowak wrote: > Will threads be fixed in the next stable release of wxRuby? > I don't think there is a canonical fix. Most of the GUI toolkits suffer from the same problem (see http://www.infoq.com/news/2007/04/ruby-userspace-threads-roundup). Some (eg FxRuby) build-in a similar Timer-based workaround to the default App clas, but I think my preference is to let users who want to use Threads choose how to schedule the threads using Wx::Timer (it might vary depending on the need for timing accuracy, parallelism etc). Part of the problem is documenting this properly, so I added an example on using threads to the samples for the next release: http://wxruby.rubyforge.org/svn/trunk/wxruby2/samples/etc/threaded.rb > I have searched the archives of this mailing list > and found this strange workaround with Wx::Timer. Though it seems a bit strange, it's very similar to the way Ruby's threads scheduler works. It checks every 10ms (I think) to see if it's in a place where it can switch context to another thread, and then does so. The problem with GUI toolkits is that Ruby's scheduler can't interrupt if the main thread is in third-party code, like the wxRuby library. There, most of the time it's sitting inside the compiled code's event loop, waiting for something to happen. So we need to use a Wx::Timer to emulate the scheduler and force a switch of Thread context. > It works but to some > extent - for some reason Net::HTTP#read_timeout doesn't work so if the > connection is interrupted the download never ends I expect read_timeout uses Threads (ruby's timeout library does) - but I'd pursue Mario's advice as well. > Maybe someone will fix multithreading in wxRuby? I don't know the > internals of wxRuby so I don't know how easy/difficult it is to fix > it. But I think that it would improve wxRuby greatly. Like I say, we could make a "best-guess" fix for common cases, but it'd be sub-optimal for many users. The other thing that is likely to change is the arrival of Ruby 1.9 in the next few months, which has operating system threads instead of green threads. cheers alex Alex From chauk.mean at gmail.com Tue Oct 9 13:59:48 2007 From: chauk.mean at gmail.com (Chauk-Mean P) Date: Tue, 9 Oct 2007 19:59:48 +0200 Subject: [wxruby-users] Trouble with dialog based application Message-ID: Hi, A long time ago, I made some MFC GUI programming ... There was basically 2 kinds of application : - dialog based application : a simple app based on a dialog (without menu, toolbar, status bar ...) - frame based app (Single Document or Multiple Document) with menu, toolbar, status bar ... I tried to make a dialog based app with wxRuby but the application never exits !! The following code based on a frame works as expected. After the closing of the application window, the "exit from application" string is output. require "wx" class HelloWorld < Wx::App def on_init helloframe = Wx::Frame.new(nil, "Hello World") Wx::StaticText.new(helloframe, "Hello World") helloframe.show end end HelloWorld.new.main_loop puts "exit from application" If the frame is replaced by a dialog, the application seems to be closed but the message is never output. I tried both show and show_modal to display the window. require "wx" class HelloWorld < Wx::App def on_init hellodlg = Wx::Dialog.new(nil, "Hello World") Wx::StaticText.new(hellodlg, "Hello World") hellodlg.show_modal # hellodlg.show end end HelloWorld.new.main_loop puts "exit from application" => Am I doing something wrong ? Cheers. Chauk-Mean. From alex at pressure.to Tue Oct 9 16:10:17 2007 From: alex at pressure.to (Alex Fenton) Date: Tue, 09 Oct 2007 21:10:17 +0100 Subject: [wxruby-users] Trouble with dialog based application In-Reply-To: References: Message-ID: <470BE029.7090702@pressure.to> Hi Chauk-Mean Chauk-Mean P wrote: > If the frame is replaced by a dialog, the application seems to be > closed but the message is never output. > I tried both show and show_modal to display the window. > If you have a parent-less dialog, you probably need to call destroy() on the dialog when it closes to ensure it's really killed. http://wxruby.rubyforge.org/doc/dialog.html#Dialog_destroy hth alex From chauk.mean at gmail.com Wed Oct 10 10:48:03 2007 From: chauk.mean at gmail.com (Chauk-Mean P) Date: Wed, 10 Oct 2007 16:48:03 +0200 Subject: [wxruby-users] Trouble with dialog based application In-Reply-To: <470BE029.7090702@pressure.to> References: <470BE029.7090702@pressure.to> Message-ID: 2007/10/9, Alex Fenton : > > > If you have a parent-less dialog, you probably need to call destroy() on > the dialog when it closes to ensure it's really killed. > > http://wxruby.rubyforge.org/doc/dialog.html#Dialog_destroy > Thanks Alex. I missed this subtlety. Nevertheless, this raises another question. As Ruby has garbage collection (unlike c++ WxWidgets) , it would be great if a Wx::Dialog without a parent can call destroy itself when the Ruby object is about to be destroyed. This would simplify the usage of Wx::Dialog and makes it behave like a Frame with no parent. Cheers. Chauk-Mean. From alex at pressure.to Wed Oct 10 14:43:17 2007 From: alex at pressure.to (Alex Fenton) Date: Wed, 10 Oct 2007 19:43:17 +0100 Subject: [wxruby-users] Trouble with dialog based application In-Reply-To: References: <470BE029.7090702@pressure.to> Message-ID: <470D1D45.7070403@pressure.to> Chauk-Mean P wrote: > As Ruby has garbage collection (unlike c++ WxWidgets) , it would be great if a Wx::Dialog > without a parent can call destroy itself when the Ruby object is about > to be destroyed. I agree; I've wanted to fix this 'subtlety', as you put it, politely. It's come up before on the m.l. However, it's a bit tricky and I don't know how to solve it. The order of destruction of all GUI objects is always wxWidgets first, then ruby's garbage collection to clean up the ruby object at some point later. By the time a ruby GC hook could run, the C++ object is dead and gone. Also, wxWidgets doesn't consider a parentless Dialog destroyed when it's closed, unlike frames. I guess it assumes a dialog-based app might want to close and re-show the same Dialog several times. cheers alex From peralta at sonic.net Sat Oct 13 13:13:07 2007 From: peralta at sonic.net (peralta at sonic.net) Date: Sat, 13 Oct 2007 10:13:07 -0700 (PDT) Subject: [wxruby-users] Newbie can't get sample/etc/wizard.rb to work Message-ID: <19987.64.142.64.96.1192295587.squirrel@webmail.sonic.net> Hello, I've downloaded wxruby onto windows (ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]). All samples are working fine, except for wizard.rb, which gets: C:/Program Files/ruby/lib/ruby/gems/1.8/gems/wxruby-1.9.1-i386-mswin32/lib/wx/keyword_ctors.rb:201:in `initialize': Error initializing # (ArgumentError) Sent parameters: [#, -1, "The WxRuby Wizard", #, #, 536877056] Correct parameters are: title (String) bitmap (Wxruby2::Bitmap) pos (Wxruby2::Point) size (Wxruby2::Size) style (Fixnum) from wizard.rb:37:in `new' from wizard.rb:37:in `initialize' from wizard.rb:70:in `new' from wizard.rb:70:in `on_init' from wizard.rb:80:in `main_loop' from wizard.rb:80 What am I missing here? Thanks -- this newbie appreciates your help! Peralta From auguusstt at gmail.com Sun Oct 14 02:22:37 2007 From: auguusstt at gmail.com (peng.chen) Date: Sun, 14 Oct 2007 14:22:37 +0800 Subject: [wxruby-users] Newbie can't get sample/etc/wizard.rb to work In-Reply-To: <19987.64.142.64.96.1192295587.squirrel@webmail.sonic.net> References: <19987.64.142.64.96.1192295587.squirrel@webmail.sonic.net> Message-ID: bug? wxruby-1.9.0-i386-mswin32/wizard.rb is working good On 10/14/07, peralta at sonic.net wrote: > > Hello, > > I've downloaded wxruby onto windows (ruby 1.8.6 (2007-03-13 patchlevel 0) > [i386-mswin32]). > > All samples are working fine, except for wizard.rb, which gets: > > C:/Program > Files/ruby/lib/ruby/gems/1.8/gems/wxruby-1.9.1-i386-mswin32 > /lib/wx/keyword_ctors.rb:201:in > `initialize': Error initializing # (ArgumentError) > Sent parameters: [#, -1, "The WxRuby Wizard", > #, #, 536877056] > Correct parameters are: > title (String) > bitmap (Wxruby2::Bitmap) > pos (Wxruby2::Point) > size (Wxruby2::Size) > style (Fixnum) > from wizard.rb:37:in `new' > from wizard.rb:37:in `initialize' > from wizard.rb:70:in `new' > from wizard.rb:70:in `on_init' > from wizard.rb:80:in `main_loop' > from wizard.rb:80 > > What am I missing here? > > Thanks -- this newbie appreciates your help! > > Peralta > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20071014/31f0eec4/attachment-0001.html From wxruby at yahoo.com.tr Sun Oct 14 09:26:17 2007 From: wxruby at yahoo.com.tr (wx ruby) Date: Sun, 14 Oct 2007 16:26:17 +0300 (EEST) Subject: [wxruby-users] Tutorial question Message-ID: <604719.65199.qm@web27501.mail.ukl.yahoo.com> Hi, wxWidgets sources are good to understand the main subject of wxRuby but if you dont know C++ it stucks somewhere else. wxPython sources are good sources and syntax is closer to ruby but it is not ruby at the end. wxRuby sources are also good but i don't think there are enough sources. I use wiki to understand and i closely look at tutorials, i use samples to solve anything on my own. What should i do for more information? Is there any source i can use for learning wxRuby? --------------------------------- Yahoo! kullaniyor musunuz? Simdi, 1GB e-posta saklama alani sunuyor http://tr.mail.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20071014/3ab1b8cb/attachment.html From mario at ruby-im.net Sun Oct 14 17:18:59 2007 From: mario at ruby-im.net (Mario Steele) Date: Sun, 14 Oct 2007 16:18:59 -0500 Subject: [wxruby-users] Newbie can't get sample/etc/wizard.rb to work In-Reply-To: <19987.64.142.64.96.1192295587.squirrel@webmail.sonic.net> References: <19987.64.142.64.96.1192295587.squirrel@webmail.sonic.net> Message-ID: <471287C3.6090803@ruby-im.net> Hello Peralta, This is a current bug in wxRuby 1.9.1, dealing with the new way to pass paramaters to the constructors for the class. Currently, there is a Mis-match in documentation, and the way the constructor keywords are setup for Wx::Wizard. It has already been discussed, and is being looked into further. So hopefully, we will have a patch for it by the 1.9.2 release. So rest assured, your not missing anything. ;-) Mario Steele peralta at sonic.net wrote: > Hello, > > I've downloaded wxruby onto windows (ruby 1.8.6 (2007-03-13 patchlevel 0) > [i386-mswin32]). > > All samples are working fine, except for wizard.rb, which gets: > > C:/Program > Files/ruby/lib/ruby/gems/1.8/gems/wxruby-1.9.1-i386-mswin32/lib/wx/keyword_ctors.rb:201:in > `initialize': Error initializing # (ArgumentError) > Sent parameters: [#, -1, "The WxRuby Wizard", > #, #, 536877056] > Correct parameters are: > title (String) > bitmap (Wxruby2::Bitmap) > pos (Wxruby2::Point) > size (Wxruby2::Size) > style (Fixnum) > from wizard.rb:37:in `new' > from wizard.rb:37:in `initialize' > from wizard.rb:70:in `new' > from wizard.rb:70:in `on_init' > from wizard.rb:80:in `main_loop' > from wizard.rb:80 > > What am I missing here? > > Thanks -- this newbie appreciates your help! > > Peralta > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > > From mario at ruby-im.net Sun Oct 14 17:22:09 2007 From: mario at ruby-im.net (Mario Steele) Date: Sun, 14 Oct 2007 16:22:09 -0500 Subject: [wxruby-users] Tutorial question In-Reply-To: <604719.65199.qm@web27501.mail.ukl.yahoo.com> References: <604719.65199.qm@web27501.mail.ukl.yahoo.com> Message-ID: <47128881.1050409@ruby-im.net> Hello wx ruby user, Currently, there are people working on re-writing the Tutorials for how to work with wxRuby, and we are working to add more Demonstrations of the wxRuby code to samples directory of the release, so that there is more to learn from there. Unfortunately, it takes a bit of time in order for us to get everything together. So please be patient, and if you have any questions on how something works, or how to do something, please feel free to send your question here, we'll be happy to reply with what we know, and help you along in your en devours. L8ers, Mario Steele wx ruby wrote: > Hi, > wxWidgets sources are good to understand the main subject of wxRuby > but if you dont know C++ it stucks somewhere else. > wxPython sources are good sources and syntax is closer to ruby but it > is not ruby at the end. > wxRuby sources are also good but i don't think there are enough > sources. I use wiki to understand and i closely look at tutorials, i > use samples to solve anything on my own. What should i do for more > information? Is there any source i can use for learning wxRuby? > > ------------------------------------------------------------------------ > Yahoo! kullaniyor musunuz? > Simdi, 1GB e-posta saklama alani sunuyor > http://tr.mail.yahoo.com > ------------------------------------------------------------------------ > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20071014/9571d7e5/attachment.html From alex at pressure.to Mon Oct 15 14:57:30 2007 From: alex at pressure.to (Alex Fenton) Date: Mon, 15 Oct 2007 19:57:30 +0100 Subject: [wxruby-users] Newbie can't get sample/etc/wizard.rb to work In-Reply-To: <19987.64.142.64.96.1192295587.squirrel@webmail.sonic.net> References: <19987.64.142.64.96.1192295587.squirrel@webmail.sonic.net> Message-ID: <4713B81A.40909@pressure.to> Hi peralta at sonic.net wrote: > I've downloaded wxruby onto windows (ruby 1.8.6 (2007-03-13 patchlevel 0) > [i386-mswin32]). > > All samples are working fine, except for wizard.rb, which gets: > Yep, this was a bug that crept in version 1.9.1. It's now fixed in Subversion for the next release. Thanks for the report, sorry for the trouble alex From peralta at sonic.net Tue Oct 16 11:41:10 2007 From: peralta at sonic.net (peralta at sonic.net) Date: Tue, 16 Oct 2007 08:41:10 -0700 (PDT) Subject: [wxruby-users] Setting background color on a menu bar? Message-ID: <16224.64.142.64.96.1192549270.squirrel@webmail.sonic.net> Thank you all for your help with my previous question. Now I have a question on setting the background color of a menu bar: can it be done? I've experimented thus: menuBar = Wx::MenuBar.new() menuBar.set_background_color( Wx::WHITE ) But alas, it seems to have no effect. (I'm using wxruby-1.9.0-i386-mswin32 with ruby 1.8.6) Thanks much! From erubin at valcom.com Tue Oct 16 12:30:09 2007 From: erubin at valcom.com (Eric Rubin) Date: Tue, 16 Oct 2007 12:30:09 -0400 Subject: [wxruby-users] Question about GUI processing order Message-ID: <001101c81011$d1893de0$a10ba8c0@valcom.com> I am developing a GUI with WxRuby (wxruby-1.9.1-i386-mswin32, ruby-1.8.6). In one of my button event handlers I do the following in this order: set the value of a TextCtrl, show a button (which was hidden), hide the button that was caused this event play some sounds (using Sound.play) What I observe is that all these things happen, but not in the order I specified. Hiding the button occurs before the sounds are played, but setting the value of the TextCtrl, and showing the hidden button does not happen until after the sounds are finished. It is important the first three things happen before the sounds are played. Any ideas about what's going on or how I can fix it? Thanks, Eric Rubin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20071016/b76016e0/attachment.html From alex at pressure.to Tue Oct 16 12:51:38 2007 From: alex at pressure.to (Alex Fenton) Date: Tue, 16 Oct 2007 17:51:38 +0100 Subject: [wxruby-users] Question about GUI processing order In-Reply-To: <001101c81011$d1893de0$a10ba8c0@valcom.com> References: <001101c81011$d1893de0$a10ba8c0@valcom.com> Message-ID: <4714EC1A.1020705@pressure.to> Eric Rubin wrote: > > I am developing a GUI with WxRuby (wxruby-1.9.1-i386-mswin32, > ruby-1.8.6). In one of my button event handlers I do the following in > this order: > > set the value of a TextCtrl, > > show a button (which was hidden), > > hide the button that was caused this event > > play some sounds (using Sound.play) > > What I observe is that all these things happen, but not in the order I > specified. Hiding the button occurs before the sounds are played, but > setting the value of the TextCtrl, and showing the hidden button does > not happen until after the sounds are finished. It is important the > first three things happen before the sounds are played. > It may well be because visual updates to Windows are not necessarily done immediately, but in the next event loop. You should be able to force the immediate repainting of a window and its children by calling window.refresh # mark the whole window as needing repainting window.update # specify that areas need repainting should be dealt with now Then call Sound.play. If this doesn't help, perhaps shows us some code. See http://wxruby.rubyforge.org/doc/window.html#Window_refresh PS - are you sure you're using 1.9.1 - I think Sound.play is only supported in SVN HEAD?! alex From alex at pressure.to Tue Oct 16 12:03:09 2007 From: alex at pressure.to (Alex Fenton) Date: Tue, 16 Oct 2007 17:03:09 +0100 Subject: [wxruby-users] Setting background color on a menu bar? In-Reply-To: <16224.64.142.64.96.1192549270.squirrel@webmail.sonic.net> References: <16224.64.142.64.96.1192549270.squirrel@webmail.sonic.net> Message-ID: <4714E0BD.40503@pressure.to> Hi peralta at sonic.net wrote: > Now I have a question on setting the background color > of a menu bar: can it be done? Probably not, and you probably shouldn't try. The colour of the menu bar comes from the Windows theme, and this is what users will expect. On modern OS's the Menu Bar often isn't have a flat colour - it might be a gradient (XP) or a texture (OS X, brushed metal). Perhaps if you say what you're trying to communicate to an application's user by changing the menu bar colour, we could think of another way more standard way of communicating the same message. cheers alex From erubin at valcom.com Tue Oct 16 13:12:18 2007 From: erubin at valcom.com (Eric Rubin) Date: Tue, 16 Oct 2007 13:12:18 -0400 Subject: [wxruby-users] Question about GUI processing order In-Reply-To: <4714EC1A.1020705@pressure.to> Message-ID: <001b01c81017$b51fee00$a10ba8c0@valcom.com> Calling update fixed it. Thanks. I am using 1.9.1 and Sound.play is working... Eric -----Original Message----- From: wxruby-users-bounces at rubyforge.org [mailto:wxruby-users-bounces at rubyforge.org] On Behalf Of Alex Fenton Sent: Tuesday, October 16, 2007 12:52 PM To: General discussion of wxRuby Subject: Re: [wxruby-users] Question about GUI processing order Eric Rubin wrote: > > I am developing a GUI with WxRuby (wxruby-1.9.1-i386-mswin32, > ruby-1.8.6). In one of my button event handlers I do the following in > this order: > > set the value of a TextCtrl, > > show a button (which was hidden), > > hide the button that was caused this event > > play some sounds (using Sound.play) > > What I observe is that all these things happen, but not in the order I > specified. Hiding the button occurs before the sounds are played, but > setting the value of the TextCtrl, and showing the hidden button does > not happen until after the sounds are finished. It is important the > first three things happen before the sounds are played. > It may well be because visual updates to Windows are not necessarily done immediately, but in the next event loop. You should be able to force the immediate repainting of a window and its children by calling window.refresh # mark the whole window as needing repainting window.update # specify that areas need repainting should be dealt with now Then call Sound.play. If this doesn't help, perhaps shows us some code. See http://wxruby.rubyforge.org/doc/window.html#Window_refresh PS - are you sure you're using 1.9.1 - I think Sound.play is only supported in SVN HEAD?! alex _______________________________________________ wxruby-users mailing list wxruby-users at rubyforge.org http://rubyforge.org/mailman/listinfo/wxruby-users From alex at pressure.to Tue Oct 16 14:04:51 2007 From: alex at pressure.to (Alex Fenton) Date: Tue, 16 Oct 2007 19:04:51 +0100 Subject: [wxruby-users] Question about GUI processing order In-Reply-To: <001b01c81017$b51fee00$a10ba8c0@valcom.com> References: <001b01c81017$b51fee00$a10ba8c0@valcom.com> Message-ID: <4714FD43.5050004@pressure.to> Eric Rubin wrote: > Calling update fixed it. Thanks. > > Cool. > I am using 1.9.1 and Sound.play is working... > That's very weird. I can't find any reference to Sound or play in the 1.9.1 sources. Anyway, be aware that in the upcoming 1.9.2 release, the class method 'play' is called 'play_sound', and the instance method is 'play'. It's not ideal but the only way I could find to work around a SWIG bug. alex From chauk.mean at gmail.com Tue Oct 16 14:33:49 2007 From: chauk.mean at gmail.com (Chauk-Mean P) Date: Tue, 16 Oct 2007 20:33:49 +0200 Subject: [wxruby-users] Crash when using item data with a CheckListBox In-Reply-To: References: <470BF972.9060202@pressure.to> Message-ID: Alex, As you answer questions only from the wxruby-users, I'm wondering if you still receive mails from the wxruby-development ML. Anyway, I would appreciate any feedback on the crash I have with CheckListBox. I'm running on Windows. Cheers. Chauk-Mean. ---------- Forwarded message ---------- From: Chauk-Mean P Date: 16 oct. 2007 09:44 Subject: Re: [wxruby-development] Crash when using item data with a CheckListBox To: wxruby-development at rubyforge.org Alex, > > 2007/10/9, Alex Fenton : > > > Chauk-Mean P wrote: > > > > Hi, > > > > > > > > The following code works as expected with a list box. > > > > > > Could you let us know what platform you're on? Apart from an assert > > > failure on exit with the debug build, it seems to work fine on GTK. > > > > I'm running on Windows 2000. > > Have you been able to reproduce the problem on Windows ? Any feedback ? Have you received my previous posts ? Cheers, Chauk-Mean. From erubin at valcom.com Tue Oct 16 14:42:12 2007 From: erubin at valcom.com (Eric Rubin) Date: Tue, 16 Oct 2007 14:42:12 -0400 Subject: [wxruby-users] Question about GUI processing order In-Reply-To: <4714FD43.5050004@pressure.to> Message-ID: <001c01c81024$43b595a0$a10ba8c0@valcom.com> The Sound I'm using is not part of WxRuby. It's in the win32-sound gem. See http://rubyonwindows.blogspot.com/2007/05/adding-sound-to-your-ruby-apps.htm l If 1.9.2 will include a platform independent Sound, that's great. But will there be a conflict with win32-sound? Or at least a source of confusion? Eric -----Original Message----- From: wxruby-users-bounces at rubyforge.org [mailto:wxruby-users-bounces at rubyforge.org] On Behalf Of Alex Fenton Sent: Tuesday, October 16, 2007 2:05 PM To: General discussion of wxRuby Subject: Re: [wxruby-users] Question about GUI processing order Eric Rubin wrote: > Calling update fixed it. Thanks. > > Cool. > I am using 1.9.1 and Sound.play is working... > That's very weird. I can't find any reference to Sound or play in the 1.9.1 sources. Anyway, be aware that in the upcoming 1.9.2 release, the class method 'play' is called 'play_sound', and the instance method is 'play'. It's not ideal but the only way I could find to work around a SWIG bug. alex _______________________________________________ wxruby-users mailing list wxruby-users at rubyforge.org http://rubyforge.org/mailman/listinfo/wxruby-users From alex at pressure.to Tue Oct 16 15:05:28 2007 From: alex at pressure.to (Alex Fenton) Date: Tue, 16 Oct 2007 20:05:28 +0100 Subject: [wxruby-users] Question about GUI processing order In-Reply-To: <001c01c81024$43b595a0$a10ba8c0@valcom.com> References: <001c01c81024$43b595a0$a10ba8c0@valcom.com> Message-ID: <47150B78.9010208@pressure.to> Eric Rubin wrote: > The Sound I'm using is not part of WxRuby. It's in the win32-sound gem. > OK, now I'm less bemused. > If 1.9.2 will include a platform independent Sound, that's great. But will > there be a conflict with win32-sound? Or at least a source of confusion? > Yes, it's platform independent, and allows synchronous and async playing of wav files. There shouldn't be a conflict because wxRuby's Sound will live within the Wx:: namespace. Eg Wx::Sound.new('foo.wav').play The only possible problem would be if you do "include Wx" at the start of a script to avoid having to type the Wx:: prefix everywhere. But this kind of namespace stomping isn't recommended for larger scripts which use multiple libraries, for this reason. alex From alex at pressure.to Tue Oct 16 15:10:27 2007 From: alex at pressure.to (Alex Fenton) Date: Tue, 16 Oct 2007 20:10:27 +0100 Subject: [wxruby-users] Crash when using item data with a CheckListBox In-Reply-To: References: <470BF972.9060202@pressure.to> Message-ID: <47150CA3.9040206@pressure.to> Hey Chauk Chauk-Mean P wrote: > As you answer questions only from the wxruby-users, I'm wondering if > you still receive mails from the wxruby-development ML. > I definitely follow and respond on both. But I hadn't seen anything further on this thread after your original message and my first reply on the list - no follow-up. There's nothing showing up in the archives: http://rubyforge.org/pipermail/wxruby-development/2007-October/thread.html I'm wondering if there is a problem with the wx-dev m.l. Your message seems to have been dropped, and I sent a message about two-three hours ago (about 1.9.2 and OpenGL) and it hasn't shown up. > Anyway, I would appreciate any feedback on the crash I have with CheckListBox. > I'm running on Windows. > Now I know you're on Windows, I'll look into it and see if I can reproduce the issue with XP. Sorry for any confusion with the m.l. cheers alex From chauk.mean at gmail.com Tue Oct 16 16:24:19 2007 From: chauk.mean at gmail.com (Chauk-Mean P) Date: Tue, 16 Oct 2007 22:24:19 +0200 Subject: [wxruby-users] Crash when using item data with a CheckListBox In-Reply-To: <47150CA3.9040206@pressure.to> References: <470BF972.9060202@pressure.to> <47150CA3.9040206@pressure.to> Message-ID: Alex, 2007/10/16, Alex Fenton : > Hey Chauk > > Chauk-Mean P wrote: > > As you answer questions only from the wxruby-users, I'm wondering if > > you still receive mails from the wxruby-development ML. > > > I definitely follow and respond on both. But I hadn't seen anything > further on this thread after your original message and my first reply on > the list - no follow-up. There's nothing showing up in the archives: > > http://rubyforge.org/pipermail/wxruby-development/2007-October/thread.html > > I'm wondering if there is a problem with the wx-dev m.l. The wx-users m.l. archive from rubyforge doesn't seem to work neither. ( http://rubyforge.org/pipermail/wxruby-users/2007-October/thread.html ). Only old messages are shown. Fortunately, I receive all mails on my mail account. > > Anyway, I would appreciate any feedback on the crash I have with CheckListBox. > > I'm running on Windows. > > > Now I know you're on Windows, I'll look into it and see if I can > reproduce the issue with XP. Great ! Note that I'm running Windows 2000 SP4. It may help you. Cheers. Chauk-Mean. From alex at pressure.to Wed Oct 17 05:38:17 2007 From: alex at pressure.to (Alex Fenton) Date: Wed, 17 Oct 2007 10:38:17 +0100 Subject: [wxruby-users] dev mailing list down Message-ID: <4715D809.9050908@pressure.to> It seems the wxruby-development mailing list has stopped working. I've filed a support request on Rubyforge, but for the meantime please use this list. Looks like any messages sent after 9 October have been lost, so you might want to resend... thanks alex From alex at pressure.to Wed Oct 17 14:20:01 2007 From: alex at pressure.to (Alex Fenton) Date: Wed, 17 Oct 2007 19:20:01 +0100 Subject: [wxruby-users] dev mailing list down In-Reply-To: <4715D809.9050908@pressure.to> References: <4715D809.9050908@pressure.to> Message-ID: <47165251.80601@pressure.to> Alex Fenton wrote: > It seems the wxruby-development mailing list has stopped working. I've > filed a support request on Rubyforge, but for the meantime please use > this list. Thanks to Tom, this is now fixed. alex From peralta at sonic.net Wed Oct 17 18:54:52 2007 From: peralta at sonic.net (peralta at sonic.net) Date: Wed, 17 Oct 2007 15:54:52 -0700 (PDT) Subject: [wxruby-users] what's a ListCtrlCompare ? Message-ID: <9160.67.118.103.210.1192661692.squirrel@webmail.sonic.net> Hello all, The doc for Wx::ListCtrl#sort_items says the method takes a ListCtrlCompare. I've searched high and low, and I can't find any description of such an object. Is there sample code somewhere in which an LC_REPORT style ListCtrl offers sorting by column? That's really all I'm trying to do, and if I could see it done I'm sure it would all make sense to me. Thanks much! Peralta From alex at pressure.to Wed Oct 17 19:24:00 2007 From: alex at pressure.to (Alex Fenton) Date: Thu, 18 Oct 2007 00:24:00 +0100 Subject: [wxruby-users] what's a ListCtrlCompare ? In-Reply-To: <9160.67.118.103.210.1192661692.squirrel@webmail.sonic.net> References: <9160.67.118.103.210.1192661692.squirrel@webmail.sonic.net> Message-ID: <47169990.3010505@pressure.to> Hi peralta at sonic.net wrote: > The doc for Wx::ListCtrl#sort_items says the method takes > a ListCtrlCompare. I've searched high and low, and I can't > find any description of such an object. > I think we've missed the little bit of work this method needs. I guess in Ruby it should accept a block which accepts two objects and returns -1, 0 or 1 to represent the sort order of those items. This is similar to how TreeCtrl#sort works. But it won't work for now - will see if we can fix this for the next release thanks alex From lists at ruby-forum.com Sat Oct 20 07:11:41 2007 From: lists at ruby-forum.com (Umut Yilmaz) Date: Sat, 20 Oct 2007 13:11:41 +0200 Subject: [wxruby-users] Learning sources Message-ID: <674e0a0e9de0412bd685e9d650c36e24@ruby-forum.com> When i decide to create a GUI for my desktop "Ruby" application, i have been stucked about wxruby. Then i have looked at wxwindows and wxwidgets sources but the syntax was not so familiar to me. Because the examples were written in C++ generally. For understanding main concept this experience was good for me. Later, for more familiar syntax i have looked at wxphyton sources and i read many informations but it was not ruby at the end. Do you suggest me any other sources for wxruby except examples which come with gem installation? -- Posted via http://www.ruby-forum.com/. From femtowin at gmail.com Sat Oct 20 15:08:29 2007 From: femtowin at gmail.com (femto gary) Date: Sun, 21 Oct 2007 03:08:29 +0800 Subject: [wxruby-users] Learning sources In-Reply-To: <674e0a0e9de0412bd685e9d650c36e24@ruby-forum.com> References: <674e0a0e9de0412bd685e9d650c36e24@ruby-forum.com> Message-ID: <91170ee40710201208p67c07ffay635264b8b747c03e@mail.gmail.com> Actually I'm looking wxPython and learning from wxPython in action, I believe that if you following the book, the syntax wouldn't be too much a problem, it is quite understandable. Anyway, I'm learning from the book and the wxPython/wxRuby example. (the wxWidget in C++ is far from me too, so I chose python). Good luck. On 10/20/07, Umut Yilmaz wrote: > When i decide to create a GUI for my desktop "Ruby" application, i have > been stucked about wxruby. > > Then i have looked at wxwindows and wxwidgets sources but the syntax was > not so familiar to me. Because the examples were written in C++ > generally. > For understanding main concept this experience was good for me. > > Later, for more familiar syntax i have looked at wxphyton sources and i > read many informations but it was not ruby at the end. > > Do you suggest me any other sources for wxruby except examples which > come with gem installation? > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -- Best Regards XRuby http://xruby.com femto http://hi.baidu.com/femto From mario at ruby-im.net Sat Oct 20 17:26:50 2007 From: mario at ruby-im.net (Mario Steele) Date: Sat, 20 Oct 2007 16:26:50 -0500 Subject: [wxruby-users] Learning sources In-Reply-To: <674e0a0e9de0412bd685e9d650c36e24@ruby-forum.com> References: <674e0a0e9de0412bd685e9d650c36e24@ruby-forum.com> Message-ID: <471A729A.8010909@ruby-im.net> Hello Umut, There's not much in "current" examples, or Tutorials, to help people along with their development of wxRuby. But, you can also ask on here, about a certain way a control is created, or used. You'll find that a lot of us will be happy to send you example code to implement what you are trying to do, so that you can see how it's done. Always feel free to ask about some code here, to implement what you are trying to do. ;-) Mario Steele Umut Yilmaz wrote: > When i decide to create a GUI for my desktop "Ruby" application, i have > been stucked about wxruby. > > Then i have looked at wxwindows and wxwidgets sources but the syntax was > not so familiar to me. Because the examples were written in C++ > generally. > For understanding main concept this experience was good for me. > > Later, for more familiar syntax i have looked at wxphyton sources and i > read many informations but it was not ruby at the end. > > Do you suggest me any other sources for wxruby except examples which > come with gem installation? > From tom at infoether.com Sun Oct 21 21:18:39 2007 From: tom at infoether.com (Tom Copeland) Date: Sun, 21 Oct 2007 21:18:39 -0400 Subject: [wxruby-users] Archiving test.... Message-ID: <1193015919.3534.42.camel@bugs.hal> ....please disregard. Thanks, Tom From alex at pressure.to Mon Oct 22 05:06:38 2007 From: alex at pressure.to (Alex Fenton) Date: Mon, 22 Oct 2007 10:06:38 +0100 Subject: [wxruby-users] Learning sources In-Reply-To: <674e0a0e9de0412bd685e9d650c36e24@ruby-forum.com> References: <674e0a0e9de0412bd685e9d650c36e24@ruby-forum.com> Message-ID: <471C681E.6090105@pressure.to> Umut Yilmaz wrote: > When i decide to create a GUI for my desktop "Ruby" application, i have > been stucked about wxruby. > > Then i have looked at wxwindows and wxwidgets sources but the syntax was > not so familiar to me. Because the examples were written in C++ > generally. I agree that the C++ code samples have a lot of language "noise" that makes it hard to translate to Ruby; wxPython is probably a better learning source. Aside from the samples and the wiki tutorials, you might have a look at the code of some real life wxRuby applications: http://wxruby.rubyforge.org/wiki/wiki.pl?OnlineCodeExamples Weft QDA, for example, is a database-based application with multiple windows, dialogs and controls; it deals with structuring a larger application. As Mario says, questions about using the library are very welcome on this list. wxRuby's such a big API that everyone often ends learning something from them, even if they seem simple. Lastly, we will be looking to add more tutorials and examples; it's only really in the last six months or so that some core technical problems have been resolved in the library, and the API firmed up - that's been occupying most of the time of the core dev team. cheers alex From alex at pressure.to Tue Oct 23 17:34:08 2007 From: alex at pressure.to (Alex Fenton) Date: Tue, 23 Oct 2007 22:34:08 +0100 Subject: [wxruby-users] wxRuby 1.9.2 Message-ID: <471E68D0.5020504@pressure.to> I'm happy to announce that wxRuby 1.9.2 is now available from Rubyforge. As usual we've got source and binary gems for Win32, OS X and Linux: http://rubyforge.org/frs/?group_id=35 or gem install wxruby == WHAT'S NEW == This release has a mix of new syntax features, new classes, and lots of minor fixes and additions * New shorter syntax for event handlers * New shorter syntax for starting apps * Added CollapsiblePane and CollapsiblePaneEvent * Added Sound class for playing simple WAV effects * Various method-specific fixes in GUI classes * New and improved samples and documentation, including threads sample == SYNTAX CHANGES == All the syntax additions are backwards compatible. The main change is that when setting up an event handler that just passes onto a method, instead of writing: evt_button(my_button.wx_id) { | e | on_button_click(e) } You can just write evt_button my_button, :on_button_click Phew! There's more information in the event handling tutorial in the docs. Also, for simple apps, instead of having to create a custom Wx::App subclass, you can run an app like this: Wx::App.run do f = Frame.new(nil, :title => 'WxRuby demo') f.show end This will create an App, show a Window and start the main loop, all in four lines of code. == INCOMPATIBLE API CHANGES == TreeCtrl#get_first_child now only returns a single value, the tree id of the relevant first child. Use #get_next_sibling to loop over a group of child tree nodes, or use the convenience method #get_children. == KNOWN ISSUES == At a late stage a minor regression has shown up. Some methods which may return a Wx::Window or Wx::Sizer (eg Window#get_sizer) can raise a RuntimeError instead of returning nil if nothing is set. A fix is already in SVN, but for the time being, if you get "Cannot wrap nil as Wx::Window" errors, simply rescue them and return nil. == CREDITS == Probably more than any previous wxRuby release, this one has been driven by user contributions: patches, suggestions and bug reports. Thanks to Sean Long, Sean Lindsay, Mario Steele, Christophe Bludau, Chauk-Mean P, Dirk Traulsen, Gregor Schmidt, Bela Babik and others who've helped out. September 2007 was our busiest month yet for wxRuby downloads - just shy of 2,000. Average monthly downloads are two or three times what they were just one year ago. So thanks all for your support & patience as the library has matured; keep it coming! cheers alex From alex at pressure.to Tue Oct 23 17:42:18 2007 From: alex at pressure.to (Alex Fenton) Date: Tue, 23 Oct 2007 22:42:18 +0100 Subject: [wxruby-users] wxSugar 0.1.18 Message-ID: <471E6ABA.2060608@pressure.to> Coinciding with the wxRuby 1.9.2 release, we've got a new version of wxSugar to go with it: http://rubyforge.org/frs/?group_id=35 or gem install wx_sugar == WHAT'S NEW == The main exciting new feature in this release is a new tool called "xrcise" to make working with visual GUI designers such as DialogBlocks *much* easier. This tool generates all the code you need to load Dialogs, Frames and Panels from XRC (XML layouts), and will create ruby accessor methods for controls in those Frames, and extend controls with ruby modules. Then all that's left to write is your event handling code - your program logic and layout are strictly separate. If you install via rubygems this will be installed as binary automatically. You can read more about xrcise on the wiki: http://wxruby.rubyforge.org/wiki/wiki.pl?UsingXRCise This release also fixes a number of compatibility issues with wxRuby 1.9.2, and it's recommended that you install both at the same time. == CREDITS == Thanks to Sean Long for help building the xrcise tool, and to contributors on the mailing lists for suggestions. cheers alex From peralta at sonic.net Tue Oct 23 20:32:24 2007 From: peralta at sonic.net (peralta at sonic.net) Date: Tue, 23 Oct 2007 17:32:24 -0700 (PDT) Subject: [wxruby-users] API doc update coming? Message-ID: <15263.67.118.103.210.1193185944.squirrel@webmail.sonic.net> I've upgraded from 1.9.0 to 1.9.2 and am finding that the errors I'm getting don't match the docs. For example, in Wx::ListCtrl: - The doc makes no mention of on_get_item_column_image(), but without this method I get NoMethodError. - The doc says on_get_item_attr() *may* be overloaded, but if I don't define it, I get NoMethodError. The API doc appears to be rife with inconsistencies like this. Is anyone working on updating it? Sorry to whine, but newbies like me need all the hand-holding we can get! Also, the Wx::Sizer page has a broken link to "Sizer overview". Oh how I need that overview -- I don't have any idea how layouts work in GUIs and trying to figure out how to use the Sizer classes is proving quite a challenge. (The sample programs are a big help, but an overview would give me a leg up on the learning curve.) Thanks, Peralta From chauk.mean at gmail.com Wed Oct 24 03:05:29 2007 From: chauk.mean at gmail.com (Chauk-Mean P) Date: Wed, 24 Oct 2007 09:05:29 +0200 Subject: [wxruby-users] API doc update coming? In-Reply-To: <15263.67.118.103.210.1193185944.squirrel@webmail.sonic.net> References: <15263.67.118.103.210.1193185944.squirrel@webmail.sonic.net> Message-ID: Hi Peralta, 2007/10/24, peralta at sonic.net : > Also, the Wx::Sizer page has a broken link to "Sizer > overview". Oh how I need that overview -- I don't have > any idea how layouts work in GUIs and trying to figure > out how to use the Sizer classes is proving quite a > challenge. Indeed, the link is broken. Meanwhile, there is a page on the wxRuby wiki that explains Sizer concepts. http://wxruby.rubyforge.org/wiki/wiki.pl?Using_Sizers_For_Layout I can't help you for the other questions related with ListCtrl. Cheers. Chauk-Mean. From alex at pressure.to Wed Oct 24 04:36:16 2007 From: alex at pressure.to (Alex Fenton) Date: Wed, 24 Oct 2007 09:36:16 +0100 Subject: [wxruby-users] API doc update coming? In-Reply-To: <15263.67.118.103.210.1193185944.squirrel@webmail.sonic.net> References: <15263.67.118.103.210.1193185944.squirrel@webmail.sonic.net> Message-ID: <471F0400.7020103@pressure.to> Hi Peralta peralta at sonic.net wrote: > I've upgraded from 1.9.0 to 1.9.2 and am finding that > the errors I'm getting don't match the docs. For example, > in Wx::ListCtrl: > > - The doc makes no mention of on_get_item_column_image(), > but without this method I get NoMethodError. > > - The doc says on_get_item_attr() *may* be overloaded, > but if I don't define it, I get NoMethodError. > Thanks for the report; the docs are right and the library is wrong. I had meant to check in a patch for this a while back but forgot. It should be fixed now for 1.9.3. The changed file is here: http://wxruby.rubyforge.org/svn/trunk/wxruby2/lib/wx/classes/listctrl.rb > The API doc appears to be rife with inconsistencies like > this. Is anyone working on updating it? > No-one is working on it, in the same sense as no-one is working on wxRuby as a whole. There is a small team of volunteers who, in their spare time, make additions and corrections to the docs with each release, as well as developing the library, providing binary builds, and helping on the mailing lists. And, even, occasionally working on their own projects. Sorry if this sounds bad-tempered, but there is no way that a small dev team can stop and work through several hundred pages worth of docs. This is partly why many Ruby GUI projects don't have dedicated Ruby docs. I don't think wxRuby's are "rife" with errors, but because of the scale of the docs we're reliant on users helping us and each other by pointing them out. Patches to fix the docs are great (http://wxruby.rubyforge.org/wiki/wiki.pl?DocumentingWxRuby) but a simple list of references to all the mistakes you've found would be a massive help, and gratefully received. > Also, the Wx::Sizer page has a broken link to "Sizer > overview". Oh how I need that overview Sizers are powerful, but not intuitive at first glance. You might have a look at: http://wxruby.rubyforge.org/wiki/wiki.pl?Using_Sizers_For_Layout http://www.wxwidgets.org/manuals/stable/wx_sizeroverview.html Alternatively, you might consider using XRC (XML layouts, designed in a visual editor) or the 'layout' library from WxSugar. Both of these enable you to get the benefits of Sizer-based layout, without having to deal with the slightly clumsy API. cheers alex From cib123 at googlemail.com Wed Oct 24 10:59:46 2007 From: cib123 at googlemail.com (Christian Bielert) Date: Wed, 24 Oct 2007 16:59:46 +0200 Subject: [wxruby-users] Problems with creating my own syntax highlighter Message-ID: <7a28838d0710240759s602fa011r6a2fc6b0f5a715be@mail.gmail.com> Well, I wanted to make my own syntax highlighter using Wx::StyledTextCtrl. The easiest way to do it seemed to parse the text contents in a content-changed-event. But it doesn't seem to work.. I tried to edit the scintilla sample and added this event(@sci is the StyledTextCtrl): @sci.evt_stc_change(@sci.get_id) do @sci.clear_document_style @sci.start_styling(1,31) @sci.style_set_font_attr(10, 10, "Courier", true, true, true) @sci.set_styling(2,10) puts 1 end This prints out "1" when you edit the text(twice actually, which i do not understand), but doesn't change the text layout. But if I put it in an event triggered by a button, it will work(onEOL is triggered by clicking the "show end of line" button in the scintilla sample): def onEOL @sci.clear_document_style @sci.start_styling(1,31) @sci.style_set_font_attr(10, 10, "Courier", true, true, true) @sci.set_styling(2,10) puts 1 end As soon as I click the button, the second and third character get styled. I don't get why it doesn't work in the text content changed event. What happens there, is it intended not to work? What is the best way to get it to work? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20071024/5de67c62/attachment.html From erubin at valcom.com Wed Oct 24 11:47:36 2007 From: erubin at valcom.com (Eric Rubin) Date: Wed, 24 Oct 2007 11:47:36 -0400 Subject: [wxruby-users] wxRuby 1.9.2 In-Reply-To: <471E68D0.5020504@pressure.to> Message-ID: <000501c81655$32fd2020$a10ba8c0@valcom.com> I downloaded 1.9.2 and changed to the new event handler syntax. I'd like to try out the wxRuby Sound class in my App (replacing the win32-sound calls that I'm using now). Where can I find documentation on the API? Eric Rubin -----Original Message----- From: wxruby-users-bounces at rubyforge.org [mailto:wxruby-users-bounces at rubyforge.org] On Behalf Of Alex Fenton Sent: Tuesday, October 23, 2007 5:34 PM To: General discussion of wxRuby Subject: [wxruby-users] wxRuby 1.9.2 I'm happy to announce that wxRuby 1.9.2 is now available from Rubyforge. As usual we've got source and binary gems for Win32, OS X and Linux: http://rubyforge.org/frs/?group_id=35 or gem install wxruby == WHAT'S NEW == This release has a mix of new syntax features, new classes, and lots of minor fixes and additions * New shorter syntax for event handlers * New shorter syntax for starting apps * Added CollapsiblePane and CollapsiblePaneEvent * Added Sound class for playing simple WAV effects * Various method-specific fixes in GUI classes * New and improved samples and documentation, including threads sample == SYNTAX CHANGES == All the syntax additions are backwards compatible. The main change is that when setting up an event handler that just passes onto a method, instead of writing: evt_button(my_button.wx_id) { | e | on_button_click(e) } You can just write evt_button my_button, :on_button_click Phew! There's more information in the event handling tutorial in the docs. Also, for simple apps, instead of having to create a custom Wx::App subclass, you can run an app like this: Wx::App.run do f = Frame.new(nil, :title => 'WxRuby demo') f.show end This will create an App, show a Window and start the main loop, all in four lines of code. == INCOMPATIBLE API CHANGES == TreeCtrl#get_first_child now only returns a single value, the tree id of the relevant first child. Use #get_next_sibling to loop over a group of child tree nodes, or use the convenience method #get_children. == KNOWN ISSUES == At a late stage a minor regression has shown up. Some methods which may return a Wx::Window or Wx::Sizer (eg Window#get_sizer) can raise a RuntimeError instead of returning nil if nothing is set. A fix is already in SVN, but for the time being, if you get "Cannot wrap nil as Wx::Window" errors, simply rescue them and return nil. == CREDITS == Probably more than any previous wxRuby release, this one has been driven by user contributions: patches, suggestions and bug reports. Thanks to Sean Long, Sean Lindsay, Mario Steele, Christophe Bludau, Chauk-Mean P, Dirk Traulsen, Gregor Schmidt, Bela Babik and others who've helped out. September 2007 was our busiest month yet for wxRuby downloads - just shy of 2,000. Average monthly downloads are two or three times what they were just one year ago. So thanks all for your support & patience as the library has matured; keep it coming! cheers alex _______________________________________________ wxruby-users mailing list wxruby-users at rubyforge.org http://rubyforge.org/mailman/listinfo/wxruby-users From alex at pressure.to Wed Oct 24 14:24:12 2007 From: alex at pressure.to (Alex Fenton) Date: Wed, 24 Oct 2007 19:24:12 +0100 Subject: [wxruby-users] wxRuby 1.9.2 In-Reply-To: <000501c81655$32fd2020$a10ba8c0@valcom.com> References: <000501c81655$32fd2020$a10ba8c0@valcom.com> Message-ID: <471F8DCC.70407@pressure.to> Eric Rubin wrote: > I'd like to try out the wxRuby Sound class in my App (replacing the > win32-sound calls that I'm using now). Where can I find documentation on > the API? > It should be here, but the doc seems to have got cut off: http://wxruby.rubyforge.org/doc/sound.html For now, refer to the wxWidgets docs: http://www.wxwidgets.org/manuals/stable/wx_wxsound.html The only differences from the C++ docs are: 1) use Wx::SOUND_ASYNC instead of wxSOUND_ASYNC etc 2) The class ("static") method is Wx::Sound.play_sound('foo.wav', Wx::SOUND_ASYNC) You don't need to worry about destructors. I think wxWidgets only implements new/play/play_sound/stop across all three platforms - don't use is_playing if you want portability We'll fix up some WxRuby docs for the next release. Shout if you run into any probs cheers alex From amandus at gmail.com Wed Oct 24 14:48:54 2007 From: amandus at gmail.com (Albin Holmgren) Date: Wed, 24 Oct 2007 20:48:54 +0200 Subject: [wxruby-users] MediaCtrl? Message-ID: <3a94ba0710241148q58da55aelcd0a0497c6760803@mail.gmail.com> Hi. First of all, thank you for your hard work - wxRuby (with wxSugar) is a wonderful tool! I have been playing with it on and off for a year or so for toy projects and really like it! I need to play mediafiles (mostly mp3s) from within an application. In wxwidgets (the c++) I can use wxMediaCtrl. As I understand it this class is not implemented in wxRuby - right? Is there a reason for this - is there technical problems implementing it? I have read about the policy to only wrap GUI functionality and not classes already present in ruby. Thing is, I haven't found any other way to play media files from within ruby (cross platform and especially on windows). Or is it just that nobody have had any need for it yet? Until now I have only used the binary releases of wxruby, but will try to set up a build environment to try to wrap it myself. Should MSVC 2005, latest swig, wxMSW-2.8.6 and ruby 1.8.6 be compatible with the one-click installer? If I do succeed - don't hold your breath - are you interested in patches? Thanks, Albin Holmgren -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20071024/d87b16ff/attachment.html From alex at pressure.to Wed Oct 24 15:27:59 2007 From: alex at pressure.to (Alex Fenton) Date: Wed, 24 Oct 2007 20:27:59 +0100 Subject: [wxruby-users] MediaCtrl? In-Reply-To: <3a94ba0710241148q58da55aelcd0a0497c6760803@mail.gmail.com> References: <3a94ba0710241148q58da55aelcd0a0497c6760803@mail.gmail.com> Message-ID: <471F9CBF.1040903@pressure.to> Hi Albin Albin Holmgren wrote: > First of all, thank you for your hard work - wxRuby (with wxSugar) is > a wonderful tool! I have been playing with it on and off for a year or > so for toy projects and really like it! Thanks, that's kind of you to say so. > I need to play mediafiles (mostly mp3s) from within an application. In > wxwidgets (the c++) I can use wxMediaCtrl. As I understand it this > class is not implemented in wxRuby - right? Yep. > Is there a reason for this - is there technical problems implementing it? Yes; there's no other objections to adding it. I last tried this class quite a while ago, but didn't get any joy. I don't remember the specific error, but basically it was because the underlying wxWidgets C++ implementation is a lot more complex (with abstract classes etc) than the public-facing API. > Until now I have only used the binary releases of wxruby, but will try > to set up a build environment to try to wrap it myself. Should MSVC > 2005, latest swig, wxMSW-2.8.6 and ruby 1.8.6 be compatible with the > one-click installer? If I do succeed - don't hold your breath - are > you interested in patches? That all sounds OK - I think that's the compiler I use for debugging on Windows though Sean may use VC6 which is the "official" binary compatible for the one-click installer. I'd be really pleased to see this class added; if you want any help feel free to ask on the -dev mailing list. alex From alex at pressure.to Wed Oct 24 15:49:50 2007 From: alex at pressure.to (Alex Fenton) Date: Wed, 24 Oct 2007 20:49:50 +0100 Subject: [wxruby-users] Problems with creating my own syntax highlighter In-Reply-To: <7a28838d0710240759s602fa011r6a2fc6b0f5a715be@mail.gmail.com> References: <7a28838d0710240759s602fa011r6a2fc6b0f5a715be@mail.gmail.com> Message-ID: <471FA1DE.9020800@pressure.to> Christian Bielert wrote: > Well, I wanted to make my own syntax highlighter using > Wx::StyledTextCtrl. The easiest way to do it seemed to parse the text > contents in a content-changed-event. But it doesn't seem to work.. I would have expected the code you posted to work too, but the following seems to work for me (Linux/GTK), hooking into evt_stc_updateui @sci.style_set_font_attr(10, 10, "Courier", true, true, true) @sci.evt_stc_updateui(@sci) do | e | @sci.clear_document_style @sci.start_styling(2,31) @sci.set_styling(5,10) @sci.set_save_point end style_set_xxx only needs to be called once per style, per control. It seems to be a reasonably expensive call so putting it outside the loop got rid of any lag for me. There are a few odd things going on with StyledTextEvent - from the Scintilla docs evt_stc_change should only get called when the text is modifed, but it seems to be getting called repeatedly. And StyledTextEvent should inherit from Wx::Event, but it currently inherits from Wx::Control (!). I'll look into those and hopefully fix something up for the next release. Thanks for the report. cheers alex From sean.m.long at gmail.com Wed Oct 24 16:27:06 2007 From: sean.m.long at gmail.com (Sean Long) Date: Wed, 24 Oct 2007 13:27:06 -0700 Subject: [wxruby-users] MediaCtrl? In-Reply-To: <471F9CBF.1040903@pressure.to> References: <3a94ba0710241148q58da55aelcd0a0497c6760803@mail.gmail.com> <471F9CBF.1040903@pressure.to> Message-ID: > > Until now I have only used the binary releases of wxruby, but will try > > to set up a build environment to try to wrap it myself. Should MSVC > > 2005, latest swig, wxMSW-2.8.6 and ruby 1.8.6 be compatible with the > > one-click installer? If I do succeed - don't hold your breath - are > > you interested in patches? > That all sounds OK - I think that's the compiler I use for debugging on > Windows though Sean may use VC6 which is the "official" binary > compatible for the one-click installer. Actually I use Visual Studio .Net 2003 and did not even know the "official" compiler for the one-click was VC6 until very recently (last week actually). On my build VM for windows I run the following: - MS Windows XP Pro sp2 - MS Visual Studio .Net 2003 - Ruby 1.8.4 One-click installer version 184-16 - Swig 1.3.31 - wxWidgets 2.8.6 I have had problems compiling with this compiler with newer one-click installers so I am sticking with this one. The resulting gem works fine on later installer builds. BTW if anyone has a copy of VC6 they want to donate for building gems I would gladly take such a donation, I would feel a bit more comfortable using it to build the gems. Sean From peralta at sonic.net Thu Oct 25 19:25:27 2007 From: peralta at sonic.net (peralta at sonic.net) Date: Thu, 25 Oct 2007 16:25:27 -0700 (PDT) Subject: [wxruby-users] API doc update coming? In-Reply-To: <471F0400.7020103@pressure.to> References: <15263.67.118.103.210.1193185944.squirrel@webmail.sonic.net> <471F0400.7020103@pressure.to> Message-ID: <15742.67.118.103.210.1193354727.squirrel@webmail.sonic.net> Alex wrote: > Sorry if this sounds bad-tempered, but there is no way that a small dev > team can stop and work through several hundred pages worth of docs... No, no -- *I* apologize for sounding so snippy. I realize it's a lot of work. (I'd pitch in if I didn't have my own deadlines). Besides, the reponsiveness of this list more than makes up for the lag. Thanks for the pointers to other docs. Peralta From magnus at aoeu.info Sun Oct 28 06:51:56 2007 From: magnus at aoeu.info (Magnus =?ISO-8859-1?Q?Engstr=F6m?=) Date: Sun, 28 Oct 2007 11:51:56 +0100 Subject: [wxruby-users] Edit label in virtual listctrl Message-ID: <1193568716.934.5.camel@capsaicin.machnus.local> Hi, I am testing a virtual listctrl, and have run into some problems with changing the labels in it. The listctrl shows a bunch of rows and columns, and it gets activate events whenever I doubleclick on a cell. Works like a charm. My problem comes when I call the edit_label method, specifically that I think that I don't quite understand the argument passed to it (item as integer). This would seem to be the row, and when passed a row number, the edit control shows up just fine, for the first column. How would I go about to specifiy a label in another column? Thanks, Magnus Engstr?m From alex at pressure.to Sun Oct 28 11:04:13 2007 From: alex at pressure.to (Alex Fenton) Date: Sun, 28 Oct 2007 15:04:13 +0000 Subject: [wxruby-users] Edit label in virtual listctrl In-Reply-To: <1193568716.934.5.camel@capsaicin.machnus.local> References: <1193568716.934.5.camel@capsaicin.machnus.local> Message-ID: <4724A4ED.8060008@pressure.to> Hi Magnus Magnus Engstr?m wrote: > My problem comes when I call the edit_label method, specifically that I > think that I don't quite understand the argument passed to it (item as > integer). This would seem to be the row, and when passed a row number, > the edit control shows up just fine, for the first column. How would I > go about to specifiy a label in another column? > I was a bit surprised to find that editing a second column label is not supported in wxWidgets, because the Windows native control doesn't allow that: http://lists.wxwidgets.org/archive/wx-users/msg35847.html You could try using a Wx::Grid, or perhaps capturing evt_list_dclick, and draw a TextCtrl yourself on top of the ListItem. hth alex From magnus at aoeu.info Sun Oct 28 10:19:31 2007 From: magnus at aoeu.info (Magnus =?ISO-8859-1?Q?Engstr=F6m?=) Date: Sun, 28 Oct 2007 15:19:31 +0100 Subject: [wxruby-users] Edit label in virtual listctrl In-Reply-To: <4724A4ED.8060008@pressure.to> References: <1193568716.934.5.camel@capsaicin.machnus.local> <4724A4ED.8060008@pressure.to> Message-ID: <1193581171.934.9.camel@capsaicin.machnus.local> On Sun, 2007-10-28 at 15:04 +0000, Alex Fenton wrote: > Hi Magnus > > Magnus Engstr?m wrote: > > My problem comes when I call the edit_label method, specifically that I > > think that I don't quite understand the argument passed to it (item as > > integer). This would seem to be the row, and when passed a row number, > > the edit control shows up just fine, for the first column. How would I > > go about to specifiy a label in another column? > > > I was a bit surprised to find that editing a second column label is not > supported in wxWidgets, because the Windows native control doesn't allow > that: > http://lists.wxwidgets.org/archive/wx-users/msg35847.html > > You could try using a Wx::Grid, or perhaps capturing evt_list_dclick, > and draw a TextCtrl yourself on top of the ListItem. > > hth > alex Ah, Wx::Grid looks nice. Thanks. /Magnus