From lists at ruby-forum.com Wed Jan 2 03:16:50 2008 From: lists at ruby-forum.com (Bass Guitar) Date: Wed, 2 Jan 2008 09:16:50 +0100 Subject: [wxruby-users] how can I use draw line in wxruby?? Message-ID: I use dc = DC.new() dc.draw_line(50, 50, 100, 100) but it can't be compiled I don't know how to declare DC variable?? in http://wxruby.rubyforge.org/doc/dc.html it don't tell me how to declare now variable plese tell me :'( -- Posted via http://www.ruby-forum.com/. From mario at ruby-im.net Wed Jan 2 04:00:32 2008 From: mario at ruby-im.net (Mario Steele) Date: Wed, 2 Jan 2008 03:00:32 -0600 Subject: [wxruby-users] how can I use draw line in wxruby?? In-Reply-To: References: Message-ID: Hello Bass Guitar, Unfortunately, you cannot instantiate the DC (Device Context) directly from the DC Class. You need to utilize Window#draw or Window#paint to create a DC. The difference between these two methods, is that when you are in a paint event (EG: evt_paint), you utilize the Window#paint method to acquire a Device Context. When your outside of the paint event, you utilize Window#draw to acquire the Device Context. An Example of inside an paint event would be this: evt_paint() do self.paint do |dc| dc.draw_line(50, 50, 100, 100) end end And an example of how to draw outside of a paint event: def run_draw() self.draw do |dc| dc.draw_line(50, 50, 100, 100) end end Once you implement this, it will work. L8ers, Mario Steele On 1/2/08, Bass Guitar wrote: > > I use > > dc = DC.new() > dc.draw_line(50, 50, 100, 100) > > but it can't be compiled > I don't know how to declare DC variable?? > in http://wxruby.rubyforge.org/doc/dc.html > it don't tell me how to declare now variable > plese tell me :'( > -- > Posted via http://www.ruby-forum.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/20080102/130bb4e7/attachment-0001.html From alex at pressure.to Wed Jan 2 10:30:19 2008 From: alex at pressure.to (Alex Fenton) Date: Wed, 02 Jan 2008 15:30:19 +0000 Subject: [wxruby-users] how can I use draw line in wxruby?? In-Reply-To: References: Message-ID: <477BAE0B.8030008@pressure.to> Mario Steele wrote: > Unfortunately, you cannot instantiate the DC (Device Context) directly > from the DC Class. You need to utilize Window#draw or Window#paint to > create a DC. The difference between these two methods, is that when > you are in a paint event (EG: evt_paint), you utilize the Window#paint > method to acquire a Device Context. When your outside of the paint > event, you utilize Window#draw to acquire the Device Context. Just a quick follow-up; Mario's quite right that you use the Window#paint method to acquire a DeviceContext to do drawing. It is recommended that this is within an evt_paint handler which means that drawing will only be done when necessary. The sample image/images.rb is probably the simplest example to look at. However, there isn't a "draw" method as far as I know. "paint" is used in all circumstances, but the exact type of DC will be different dependent on the, um, context. But there will be no functional difference hth alex From alex at pressure.to Wed Jan 2 18:17:19 2008 From: alex at pressure.to (Alex Fenton) Date: Wed, 02 Jan 2008 23:17:19 +0000 Subject: [wxruby-users] ReOrdering Wx::TreeCtrl Items In-Reply-To: <477762AD.608@gmail.com> References: <477762AD.608@gmail.com> Message-ID: <477C1B7F.9050608@pressure.to> Hi EchoB wrote: > The big picture is to be able to populate the tree control and then > re-order (NOT sorting) the items in the tree control. Is this possible? > > There's two ways to sort a TreeCtrl. Either 1) Subclass TreeCtrl and create an on_compare_items method in your subclass. This will be called whenever the 'sort_items' is called. The method will be passed pairs of TreeItem ids to compare, and should return -1, 0 or 1 to indicate whether the first item comes before, equal to or after the second item. http://wxruby.rubyforge.org/doc/treectrl.html#TreeCtrl_oncompareitems 2) Maintain the order of the items as they are inserted. TreeCtrl#append_item is commonly used in the samples and adds the new item as the last child of the specified parent. But you can also add items to the tree using TreeCtrl#insert_item and #insert_item_before. With these you pass an additional argument to specify where the new item should be placed relative to the existing children of the parent item: http://wxruby.rubyforge.org/doc/treectrl.html#TreeCtrl_insertitem The second way is probably better (simpler, more efficient) if the project/task children in your example should always be shown in the same order. 1) is really useful if you want the user to be able to vary the order in which children are shown, for example, if you want them to be able to order by start date OR end date OR name. As a side hint in case you hadn't seen this feature, if the items in a TreeCtrl are closely linked to program or database objects like a "Project" or "Task", look into using item_data (which can be passed as an argument to insert/append) to maintain that link. It means the TreeCtrl can work like a Ruby hash using get_item_data. This will make sorting the items easier. Note that there is no method in Wx to _move_ a TreeItem. It must be deleted and re-inserted/re-appended somewhere else. > Also I am noticing an odd thing (and I'm sure this must be something I'm > doing) - When looking at my TreeCtrl - Contract0/Contract1 show up at > the _bottom_ of the list, not at the top. Contract3 is at the top. This is because in ruby 1.8 the order in which key/value pairs are added to a hash isn't guaranteed to be the order in which calling "each" and similar will yield the pairs. Hashes, unlike Arrays, aren't ordered. Testing your example with ruby 1.8, Contract3 _is_ the first key yielded by each. This changes in Ruby 1.9, in which hash is ordered and "each" will return the items in your example in order they're declared. cheers alex From alex at pressure.to Wed Jan 2 19:29:27 2008 From: alex at pressure.to (Alex Fenton) Date: Thu, 03 Jan 2008 00:29:27 +0000 Subject: [wxruby-users] Drawing thread not getting enough time from scheduler? In-Reply-To: <839490bc0712300022r27e10f7v87fbd9d99241653b@mail.gmail.com> References: <839490bc0712300022r27e10f7v87fbd9d99241653b@mail.gmail.com> Message-ID: <477C2C67.1050807@pressure.to> Jay McGavren wrote: > It did speed things up a bit, but it still runs many times faster (55 > seconds vs. 5 seconds) if I join the animation thread. > ... > Any idea how I can get the thread scheduler to devote a bit more time > to animation, without completely freezing the GUI? Just had a chance to try your code. For me on OS X it doesn't work at all if thread.join is called, but runs pretty smoothly (about 8s total) otherwise. At some level you'll also be caught by the granularity of Ruby's thread time slices (10ms IIRC), and garbage collection, which is taking up to 9ms tracking wxRuby objects alone in your example. I see a couple of further potential optimisations in your code which improve smoothness for me: * Take the calls to surface.pen= and surface.pen.cap= out of the 30.times loop. * See whether the drawing could be more efficiently done with a single draw_polygon (which acccepts an Array of Wx::Points) Another untested possibility to improve perceived smoothness might be to drive the animation from a Wx::Timer. Have it run at regular intervals, calling window.refresh to invalidate the window, then copy from the bitmap inside an evt_paint handler. Let us know how it goes... cheers alex From echobinary at gmail.com Thu Jan 3 00:59:20 2008 From: echobinary at gmail.com (EchoB) Date: Thu, 03 Jan 2008 00:59:20 -0500 Subject: [wxruby-users] Wx::Menu, get parent menu functions? Message-ID: <477C79B8.9060503@gmail.com> I have been looking in the API Docs for get_parent type stuff for the Menu's - so I can track a click path across sub-menus and have not found anything. Are there really no functions for that or did I just miss the right place to look? If it is true then consider this below: class MyMenu < Wx::Menu def initialize(mymasterclass, name = nil, id = -1, parent_menu = nil, title = "", style = 0) super(title, style) @name = name #string name @id = id #integer id @parent_menu = parent_menu #MyMenu parent_menu if @id == -1 @id = mymasterclass.newid() #generates newid (WxPython?) #for reference #def newid() # new_id = Wx::ID_HIGHEST + @@i_highest_counter # @@i_highest_counter = @@i_highest_counter + 1 # return new_id # end #============= end end def get_name() return @name end def get_id() return @id end def get_parent() return @parent_menu end def get_parent_id() return @parent_menu.get_id() end def has_parent() hasparent = false if @parent_menu != nil hasparent = true end return hasparent end end ==================== Thoughts? Ideas? Alternatives? Death Threats? (heehee) From bureaux.sebastien at neuf.fr Thu Jan 3 03:03:26 2008 From: bureaux.sebastien at neuf.fr (sebastien) Date: Thu, 3 Jan 2008 09:03:26 +0100 Subject: [wxruby-users] checklistbox/htmlwindow Message-ID: <000601c84ddf$1ec0d9a0$0201a8c0@sebastien> Bonjour Alex. Vous n'avez pas r?pondu ? ma question pr?c?dente! Vous m'avez peut-?tre oubli?? merci sebastien http://beusse.liveror.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20080103/ec5a2817/attachment.html From lists at ruby-forum.com Thu Jan 3 07:28:01 2008 From: lists at ruby-forum.com (Bass Guitar) Date: Thu, 3 Jan 2008 13:28:01 +0100 Subject: [wxruby-users] how can I use draw line in wxruby?? In-Reply-To: References: Message-ID: <83749109f95b9b5317ce0152c2f7da90@ruby-forum.com> thank you :D -- Posted via http://www.ruby-forum.com/. From rwa000 at gmail.com Fri Jan 4 15:21:21 2008 From: rwa000 at gmail.com (Robert Anderson) Date: Fri, 4 Jan 2008 12:21:21 -0800 Subject: [wxruby-users] problem with Menu.append_check_item() Message-ID: <9af502e50801041221m5d7c57adw4a5a19f21388e7e6@mail.gmail.com> Menu.append_check_item(), like Menu.append(), is supposed to return a reference to the created menu item. Here is a test code which seems to show that this behavior works for append(), but fails for append_check_item(). This is the output I get: % ruby test-menu.rb # nil Am I missing something or is this a bug? Both menu items are created and work as expected. I am running the 1.9.2 tarball. #!/usr/bin/env ruby begin require 'wx' rescue LoadError => no_wx_err begin require 'rubygems' load 'wx' rescue raise no_wx_err end end include Wx class MinimalFrame < Wx::Frame def initialize(title) # The main application frame has no parent (nil) super(nil, :title => title, :size => [ 700, 400 ]) menu_bar = Wx::MenuBar.new menu_file = Wx::Menu.new item1 = menu_file.append(1000, "Test Item 1") item2 = menu_file.append_check_item(1001, "Test Checked Item") puts item1 puts item2 menu_bar.append(menu_file, "Test1") self.menu_bar = menu_bar end end Wx::App.run do self.app_name = 'Minimal' frame = MinimalFrame.new("Minimal wxRuby App") frame.show end Thanks, Bob -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20080104/4564b66b/attachment.html From alex at pressure.to Fri Jan 4 16:02:10 2008 From: alex at pressure.to (Alex Fenton) Date: Fri, 04 Jan 2008 21:02:10 +0000 Subject: [wxruby-users] problem with Menu.append_check_item() In-Reply-To: <9af502e50801041221m5d7c57adw4a5a19f21388e7e6@mail.gmail.com> References: <9af502e50801041221m5d7c57adw4a5a19f21388e7e6@mail.gmail.com> Message-ID: <477E9ED2.1010905@pressure.to> Robert Anderson wrote: > Menu.append_check_item(), like Menu.append(), is supposed to return a > reference to the created menu item. Here is a test code which seems > to show that this behavior works for append(), but fails for > append_check_item(). This is the output I get: > > % ruby test-menu.rb > # > nil > > Am I missing something or is this a bug? Both menu items are created > and work as expected. I am running the 1.9.2 tarball. Thank you for the report and the clear test-case. It's a bug; the wrong C++ method signature was in one of the header files from which the API is generated. It's now fixed by SVN:1486 for the next release. If you need to work around n the interim, you should can use the long form of append_item and give Wx::ITEM_CHECK as the fourth parameter. cheers alex From bureaux.sebastien at neuf.fr Fri Jan 4 16:07:07 2008 From: bureaux.sebastien at neuf.fr (sebastien) Date: Fri, 4 Jan 2008 22:07:07 +0100 Subject: [wxruby-users] checklistbox Message-ID: <000601c84f15$c5fb08d0$0201a8c0@sebastien> Salut Alex. En fait je me suis rendu compte de mon erreur ? propos de "HSCROLL", ?a marche correctement. La scrollbarre appara?t et fonctionne bien. La derni?re fois j'ai eu l'impression qu'elle ne marchait pas, car cela peut arriver que la derni?re lettre de la ligne de charact?res qui s'affiche soit un peu coup?e par la "VSCROLL". Excuse-moi!!! A propos du contenu de la "checklistbox", si je ne me trompe pas, on est obliger de fermer et r?ouvrir l'application pour pouvoir le changer. Est-ce que vous comptez apporter une am?lioration ? la prochaine version de wxruby, pour pouvoir le changer directement? Merci sebastien http://beusse.liveror.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20080104/987572d0/attachment.html From rwa000 at gmail.com Fri Jan 4 16:37:37 2008 From: rwa000 at gmail.com (Robert Anderson) Date: Fri, 4 Jan 2008 13:37:37 -0800 Subject: [wxruby-users] problem with Menu.append_check_item() In-Reply-To: <477E9ED2.1010905@pressure.to> References: <9af502e50801041221m5d7c57adw4a5a19f21388e7e6@mail.gmail.com> <477E9ED2.1010905@pressure.to> Message-ID: <9af502e50801041337n42e5c1f2w796a507d88c13b75@mail.gmail.com> On Jan 4, 2008 1:02 PM, Alex Fenton wrote: > Robert Anderson wrote: > > Menu.append_check_item(), like Menu.append(), is supposed to return a > > reference to the created menu item. Here is a test code which seems > > to show that this behavior works for append(), but fails for > > append_check_item(). This is the output I get: > > > > % ruby test-menu.rb > > # > > nil > > > > Am I missing something or is this a bug? Both menu items are created > > and work as expected. I am running the 1.9.2 tarball. > > Thank you for the report and the clear test-case. It's a bug; the wrong > C++ method signature was in one of the header files from which the API > is generated. > > It's now fixed by SVN:1486 for the next release. If you need to work > around n the interim, you should can use the long form of append_item > and give Wx::ITEM_CHECK as the fourth parameter. > > cheers > alex > Beautiful. Thanks for the confirmation, fix, and work-around. Bob -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20080104/8e3e8f87/attachment-0001.html From rwa000 at gmail.com Fri Jan 4 18:08:54 2008 From: rwa000 at gmail.com (Robert Anderson) Date: Fri, 4 Jan 2008 15:08:54 -0800 Subject: [wxruby-users] use of Marshal with wxruby classes Message-ID: <9af502e50801041508t3a0fa691y21b4b413b50253d8@mail.gmail.com> Is it possible to use Marshal with wxruby classes to serialize an application's state? I tried a minimal example of simply serializing a minimal frame object, and I get the error "no marshal_dump is defined for class MinimalFrame". I don't fully understand this because I also tried another minimal example of dumping a class which did not defined a marshal_dump, and it worked fine. Is there some reason this has been disabled in wxruby classes? Sorry, I picked up ruby a few days ago so I may be missing something obvious. Here's a test program showing that the simple class will serialize but the simple frame will not. #!/usr/bin/env ruby require 'wx' include Wx class MinimalClass def initialize @data = 1234 end def save File.open("dump-class","w+") do |f| Marshal.dump(self, f) end end end class MinimalFrame < Frame def initialize(title) # The main application frame has no parent (nil) super(nil, :title => title, :size => [ 700, 400 ]) @data = 1234 end def save File.open("dump-frame","w+") do |f| Marshal.dump(self, f) end end end App.run do obj = MinimalClass.new obj.save self.app_name = 'Minimal' frame = MinimalFrame.new("Minimal wxRuby App") frame.save end -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20080104/a4ae5d73/attachment.html From bureaux.sebastien at neuf.fr Fri Jan 4 19:49:39 2008 From: bureaux.sebastien at neuf.fr (sebastien) Date: Sat, 5 Jan 2008 01:49:39 +0100 Subject: [wxruby-users] checklistbox Message-ID: <000601c84f34$da178f90$0201a8c0@sebastien> J'ai fouill? et en fin de compte j'ai trouv? la solution pour pouvoir changer le contenu de "checklistbox" sans avoir besoin de fermer et r?ouvrir mon application. Je me suis reporter ? la doc de "listbox". Mon probl?me est que je ne fouille pas assez dans les docs et je pose un peu trop vite mes questions. Je vais y penser pour l'avenir. Merci toute l'?quipe de wxruby. sebastien http://beusse.liveror.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20080105/3525674c/attachment.html From alex at pressure.to Fri Jan 4 21:09:55 2008 From: alex at pressure.to (Alex Fenton) Date: Sat, 05 Jan 2008 02:09:55 +0000 Subject: [wxruby-users] checklistbox In-Reply-To: <000601c84f34$da178f90$0201a8c0@sebastien> References: <000601c84f34$da178f90$0201a8c0@sebastien> Message-ID: <477EE6F3.7020502@pressure.to> Salut sebastien wrote: > J'ai fouill? et en fin de compte j'ai trouv? la solution pour pouvoir > changer le contenu de "checklistbox" sans avoir besoin de fermer et > r?ouvrir mon application. > Je me suis reporter ? la doc de "listbox". [Sebastien said: I found a solution to the problem with changing the contents of a checklistbox without having to restart the app...] Je suis heureux que tu as trouv? la solution, et pardonnes-moi de n'avoir pas r?pondu jusqu'? maintenant. Je me rends compte qu'on manque des docs en fran?ais, et nous aimons aider - mais, en generale, il est beaucoup plus facile de repondre a des questions si on suppl?e un but de code complet que nous pouvons executer. Avec ?a, nous pouvons voir exactement ce que tu attendais, et ce qui se passe en fait. [I'm glad you found the solution, and please excuse me for not having responded before I realise that we lack docs in french, and we like to help - but in general it is much easier to reply to questions if a working sample of code is provided. Then we can see exactly what was expected, and what happened] cheers alex From alex at pressure.to Fri Jan 4 21:21:35 2008 From: alex at pressure.to (Alex Fenton) Date: Sat, 05 Jan 2008 02:21:35 +0000 Subject: [wxruby-users] use of Marshal with wxruby classes In-Reply-To: <9af502e50801041508t3a0fa691y21b4b413b50253d8@mail.gmail.com> References: <9af502e50801041508t3a0fa691y21b4b413b50253d8@mail.gmail.com> Message-ID: <477EE9AF.5060502@pressure.to> Robert Anderson wrote: > Is it possible to use Marshal with wxruby classes to serialize an > application's state? > > I tried a minimal example of simply serializing a minimal frame > object, and I get the error "no marshal_dump is defined for class > MinimalFrame". > > I don't fully understand this because I also tried another minimal > example of dumping a class which did not defined a marshal_dump, and > it worked fine. Is there some reason this has been disabled in wxruby > classes? Sorry, I picked up ruby a few days ago so I may be missing > something obvious. It's not completely obvious, but I'm fairly sure what's happening is this: Marshal is able to store ordinary ruby objects that are composed, in the end, of core ruby types, like Float, Fixnum, String, Hash etc. So if you write any class just in ruby, Marshal can serialise its instances. Objects like a Wx::Frame, or any other ruby object that comes from a ruby C extension is different. It's a wrapper or pointer to compiled code (a C++ object in wxRuby). Ruby can't serialise and restore such objects without extra information. Not sure why you'd want to serialise a Wx::Frame. If you're interested in storing and restoring the size, position or layout of a Frame between runs, just store that information and a hash and serialise it, and then when the "same" window is re-opened, Marshal.load the hash and restore the settings. The first few methods in this real-life app do this sort of thing: http://weft-qda.rubyforge.org/svn/trunk/weft-qda/lib/weft/wxgui/inspectors.rb hth alex From mario at ruby-im.net Sat Jan 5 05:08:11 2008 From: mario at ruby-im.net (Mario Steele) Date: Sat, 5 Jan 2008 04:08:11 -0600 Subject: [wxruby-users] use of Marshal with wxruby classes In-Reply-To: <477EE9AF.5060502@pressure.to> References: <9af502e50801041508t3a0fa691y21b4b413b50253d8@mail.gmail.com> <477EE9AF.5060502@pressure.to> Message-ID: Hello Alex and Robert, Sorry I wasn't able to respond when I saw this, cause it takes a bit of explanation of the ways Marshal works, to fully express what is being done, and why Wx::Frame can't be saved through Marshaling. Alex, to a certain extent is correct. However, the main thing to note here, is that Marshal simply doesn't know how to "dump" the information within a Class, that doesn't explicitly have a marsha_dump method defined on it. The primary Ruby objects / classes, such as Hash, Array, Fixnum and Bignum have basic initialization techniques behind them, that Marshal already knows about, and how to store them in a format that it can later re-load up. The problem when it comes to Extensions, such as wxRuby, Ruby-Gnome/GTK, RubyQT, Fox and so forth, is that these are formats that it doesn't know about, and doesn't know how to save the said data. And it's a good thing as well, since most of that information, is dynamically created whenever the application creates them. No two runnings have the same information. A perfect comparison for this, is the handle for a Window/Frame/Widget. No two handles are going to be the same. As with Memory actually allocated, no two allocated addresses will be the same between runnings, as the OS finds where it can for the Memory, and then returns that information back to the executing program. However, the stuff that is consistent, such as size, title or style for a Window/Frame/Widget, or the actual data stored within a Memory Address, can be saved, if you supply the marshal_dump method on the class, so Marshal knows how to dump, and restore the data. As with marshal_dump, there's also a method called marshal_load. The marshal_dump should return a string that has the specific data in it, in which you can write to a file, the same goes for marshal_load(), it'll be given the string that marshal_dump returns, so that you can restore it. So, you can go the route as I have suggested it, or you can do like Alex suggest, and just store the information in a Hash, or an Array, and then Marshal that to load, and save the data. Hope this gives you a little more insight into how the Marshaling is handled. L8ers, Mario Steele On 1/4/08, Alex Fenton wrote: > > Robert Anderson wrote: > > Is it possible to use Marshal with wxruby classes to serialize an > > application's state? > > > > I tried a minimal example of simply serializing a minimal frame > > object, and I get the error "no marshal_dump is defined for class > > MinimalFrame". > > > > I don't fully understand this because I also tried another minimal > > example of dumping a class which did not defined a marshal_dump, and > > it worked fine. Is there some reason this has been disabled in wxruby > > classes? Sorry, I picked up ruby a few days ago so I may be missing > > something obvious. > > It's not completely obvious, but I'm fairly sure what's happening is > this: Marshal is able to store ordinary ruby objects that are composed, > in the end, of core ruby types, like Float, Fixnum, String, Hash etc. So > if you write any class just in ruby, Marshal can serialise its instances. > > Objects like a Wx::Frame, or any other ruby object that comes from a > ruby C extension is different. It's a wrapper or pointer to compiled > code (a C++ object in wxRuby). Ruby can't serialise and restore such > objects without extra information. > > Not sure why you'd want to serialise a Wx::Frame. If you're interested > in storing and restoring the size, position or layout of a Frame between > runs, just store that information and a hash and serialise it, and then > when the "same" window is re-opened, Marshal.load the hash and restore > the settings. The first few methods in this real-life app do this sort > of thing: > > > http://weft-qda.rubyforge.org/svn/trunk/weft-qda/lib/weft/wxgui/inspectors.rb > > hth > alex > _______________________________________________ > 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/20080105/42daeb7e/attachment.html From danieldoorduin at gmail.com Mon Jan 7 08:39:44 2008 From: danieldoorduin at gmail.com (Daniel Doorduin) Date: Mon, 7 Jan 2008 14:39:44 +0100 Subject: [wxruby-users] =?iso-8859-1?q?Displaying_special_characters_=28li?= =?iso-8859-1?q?ke_=E9=29?= Message-ID: <58c9baf40801070539i3d7ba420w3dc3bf4c52509f34@mail.gmail.com> Hi wx guru's, When I want to display strings with special characters like ? (e + /) in a wxRuby gui element, only an empty string is displayed. Not only the 'special' characters are hidden but all characters! I am using wxRuby on windows XP. It doesn't matter if I include the special characters directly in the Ruby source code, or read them from an external file (with IO.open). If you have any suggestions how to fix this problem, it would be greatly appreciated! Kind regard, Dani?l -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20080107/3cb71d21/attachment.html From alex at pressure.to Mon Jan 7 09:27:52 2008 From: alex at pressure.to (Alex Fenton) Date: Mon, 07 Jan 2008 14:27:52 +0000 Subject: [wxruby-users] =?iso-8859-1?q?Displaying_special_characters_=28li?= =?iso-8859-1?q?ke_=E9=29?= In-Reply-To: <58c9baf40801070539i3d7ba420w3dc3bf4c52509f34@mail.gmail.com> References: <58c9baf40801070539i3d7ba420w3dc3bf4c52509f34@mail.gmail.com> Message-ID: <478236E8.40905@pressure.to> Hi Daniel Daniel Doorduin wrote: > When I want to display strings with special characters like ? (e + /) > in a wxRuby gui element, only an empty string is displayed. Not only > the 'special' characters are hidden but all characters! > I am using wxRuby on windows XP. It doesn't matter if I include the > special characters directly in the Ruby source code, or read them from > an external file (with IO.open). To display non-ASCII eg accented characters, you need to ensure that the string to be displayed is in UTF-8 encoding. wxRuby uses UTF-8 internally, so a single application can display characters in any language for which the user has fonts installed. I suggest you take a look at the sample text/unicode.rb which shows both how to display accented latin and non-Latin characters, and also how to use ruby's iconv to convert to and from UTF-8. hth alex From jay at mcgavren.com Thu Jan 10 11:14:50 2008 From: jay at mcgavren.com (Jay McGavren) Date: Thu, 10 Jan 2008 09:14:50 -0700 Subject: [wxruby-users] Drawing thread not getting enough time from scheduler? Message-ID: <839490bc0801100814h1468ab80t43889d40ee9d44a@mail.gmail.com> Alex Fenton wrote: > Jay McGavren wrote: > > It did speed things up a bit, but it still runs many > times faster (55 > > seconds vs. 5 seconds) if I join the animation thread. > > > ... > > Any idea how I can get the thread scheduler to devote a > bit more time > > to animation, without completely freezing the GUI? > Just had a chance to try your code. For me on OS X it > doesn't work at all if thread.join is called, but runs > pretty smoothly (about 8s total) otherwise. At some level > you'll also be caught by the granularity of Ruby's thread > time slices (10ms IIRC), and garbage collection, which is > taking up to 9ms tracking wxRuby objects alone in your > example. OK, so avoid excessive object creation... Oh, yes, and I forgot (again) to mention I'm on Windows, as are my main target users. Interesting that the thread handling seems to be so much better on OSX. > I see a couple of further potential optimisations in your > code which improve smoothness for me: > > * Take the calls to surface.pen= and surface.pen.cap= out > of the 30.times loop. > * See whether the drawing could be more efficiently done > with a single draw_polygon (which acccepts an Array of > Wx::Points) It only happens to look like a polygon - my actual game needs to draw individual lines (in varying colors and line widths). But that's OK, because your below suggestion allowed me to draw everything at decent speed... > Another untested possibility to improve perceived > smoothness might be to drive the animation from a > Wx::Timer. Have it run at regular intervals, calling > window.refresh to invalidate the window, then copy from the > bitmap inside an evt_paint handler. This was the key. It's drawing 300 lines in under 33 milliseconds now, even on my laptop. The close button and window dragging respond immediately. require 'rubygems' require 'wx' class MyApp < Wx::App def on_init #Containing frame. frame = Wx::Frame.new(nil, :size => [300, 300]) frame.show #Offscreen drawing buffer. buffer = Wx::Bitmap.new(300, 300) #Displays drawing. window = Wx::Window.new(frame, :size => [300, 300]) window.evt_paint do |event| update_window(window, buffer) end #Initialize drawing loop counter. @i = 0 #Animate periodically. timer_id = Wx::ID_HIGHEST + 1 t = Wx::Timer.new(self, timer_id) evt_timer(timer_id) {animate(window, buffer)} t.start(33) end def animate(window, buffer) green_pen = Wx::Pen.new(Wx::Colour.new(128, 255, 128), 3) black_pen = Wx::Pen.new(Wx::Colour.new(0, 0, 0), 0) buffer.draw do |surface| #Clear screen. surface.pen = black_pen surface.brush = Wx::BLACK_BRUSH surface.draw_rectangle(0, 0, 300, 300) #Draw lines. surface.pen = green_pen surface.pen.cap = Wx::CAP_ROUND 300.times do |j| x = @i + j surface.draw_line(x, 0, x+100, 100) end end #Update screen. update_window(window, buffer) @i += 1 @i = 0 if @i > 300 end def update_window(window, buffer) window.paint do |dc| #Copy the buffer to the viewable window. dc.draw_bitmap(buffer, 0, 0, false) end end end app = MyApp.new app.main_loop Now to see if I can get similar results from the game itself. Thanks to everyone for the assistance! -Jay McGavren http://jay.mcgavren.com/zyps From lists at ruby-forum.com Mon Jan 14 03:31:47 2008 From: lists at ruby-forum.com (Anton Komarov) Date: Mon, 14 Jan 2008 09:31:47 +0100 Subject: [wxruby-users] Focus on TextCtrl Message-ID: <4e06776c508b2c02ad3e25f0272ca14b@ruby-forum.com> Hello. I have a problem with set focus on a TextCtrl in wxRuby. I must do something like Login TextCtrl and set focus on a next TextCtrl by clicking Tab key. -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Jan 14 04:23:28 2008 From: lists at ruby-forum.com (Anton Komarov) Date: Mon, 14 Jan 2008 10:23:28 +0100 Subject: [wxruby-users] Focus on TextCtrl In-Reply-To: <4e06776c508b2c02ad3e25f0272ca14b@ruby-forum.com> References: <4e06776c508b2c02ad3e25f0272ca14b@ruby-forum.com> Message-ID: I'm find something like this. somebody have a same problem If I create a window containing two TextCtrl widgets, enter text in one, and press the tab key, focus should move to the other one. That doesn't happen automatically. Is there some configuration I have to do to make that happen? maybe it will more clear to explain -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Jan 14 04:49:39 2008 From: lists at ruby-forum.com (Anton Komarov) Date: Mon, 14 Jan 2008 10:49:39 +0100 Subject: [wxruby-users] Focus on TextCtrl In-Reply-To: References: <4e06776c508b2c02ad3e25f0272ca14b@ruby-forum.com> Message-ID: Here is a sample code for this problem ... @login_field = Wx::TextCtrl.new(@loginokno, -1, '',Wx::Point.new(30,60), Wx::Size.new(150,25)) @haslo_field = Wx::TextCtrl.new(@loginokno, -1, '',Wx::Point.new(30,110), Wx::Size.new(150,25)) @lastname_field = Wx::TextCtrl.new(@loginokno, -1, '',Wx::Point.new(30,160), Wx::Size.new(150,25)) @login_field.set_focus @login_field.evt_key_down { |evt| on_log_key_down(evt) } @haslo_field.evt_key_down { |evt| on_pas_key_down(evt) } ... def on_log_key_down(evt) keycode = evt.get_key_code() if (keycode == 9) @haslo_field.set_focus else evt.skip() end end def on_pas_key_down(evt) keycode = evt.get_key_code() if (keycode == 9) @lastname_field.set_focus else evt.skip() end end -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Mon Jan 14 04:51:26 2008 From: alex at pressure.to (Alex Fenton) Date: Mon, 14 Jan 2008 09:51:26 +0000 Subject: [wxruby-users] Focus on TextCtrl In-Reply-To: References: <4e06776c508b2c02ad3e25f0272ca14b@ruby-forum.com> Message-ID: <478B309E.20205@pressure.to> Hi Anton Komarov wrote: > If I create a window containing two TextCtrl widgets, enter text in > one, and press the tab key, focus should move to the other one. That > doesn't happen automatically. Is there some configuration I have to do > to make that happen? Arrange the TextCtrl widgets within a Wx::Panel, and then tabbing should work automatically. Panel organises a group of widgets so that the operating system knows which to tab between. For example: -------- require 'wx' Wx::App.run do frame = Wx::Frame.new(nil, :title => 'text tab') panel = Wx::Panel.new(frame) txt1 = Wx::TextCtrl.new(panel, :pos => [ 10, 10 ]) txt2 = Wx::TextCtrl.new(panel, :pos => [ 10, 50 ]) frame.show end -------- Using Wx::Panel is also recommended because it ensures the frame has the right background colour, esp on Windows. alex From lists at ruby-forum.com Mon Jan 14 05:23:36 2008 From: lists at ruby-forum.com (Anton Komarov) Date: Mon, 14 Jan 2008 11:23:36 +0100 Subject: [wxruby-users] Focus on TextCtrl In-Reply-To: <478B309E.20205@pressure.to> References: <4e06776c508b2c02ad3e25f0272ca14b@ruby-forum.com> <478B309E.20205@pressure.to> Message-ID: Thank you very match. your code sample is shorter and changing focus with Tab key press is really working:) -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Jan 14 06:20:42 2008 From: lists at ruby-forum.com (Anton Komarov) Date: Mon, 14 Jan 2008 12:20:42 +0100 Subject: [wxruby-users] Adding menu items to a TaskBar Message-ID: <26cdfac566bb5c2a844d0e38e87587dd@ruby-forum.com> Hello I'm looking for a way to add menu items to a task bar icon menu. I have created a popup menu. And I want to add to a task bar icon menu items for example projects but it must be after user log in. 1. User log in 2. getting list of projects 3. adding menu items into task bar menu with project I attch a file with source code which I already written Thenks for reply's Attachments: http://www.ruby-forum.com/attachment/1303/taskbariconmenu -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Mon Jan 14 06:28:15 2008 From: alex at pressure.to (Alex Fenton) Date: Mon, 14 Jan 2008 11:28:15 +0000 Subject: [wxruby-users] Adding menu items to a TaskBar In-Reply-To: <26cdfac566bb5c2a844d0e38e87587dd@ruby-forum.com> References: <26cdfac566bb5c2a844d0e38e87587dd@ruby-forum.com> Message-ID: <478B474F.5080607@pressure.to> Anton Komarov wrote: > I'm looking for a way to add menu items to a task bar icon menu. > I have created a popup menu. > And I want to add to a task bar icon menu items for example projects but > it must be after user log in. > 1. User log in > 2. getting list of projects > 3. adding menu items into task bar menu with project > I attch a file with source code which I already written > This came up recently on the mailing list: http://rubyforge.org/pipermail/wxruby-users/2007-December/003506.html Basically, just have your create_popup_menu method check whether the login has taken place, and show the appropriate menu items. The method's called anew each time the menu is shown. alex From lists at ruby-forum.com Mon Jan 14 06:51:27 2008 From: lists at ruby-forum.com (Anton Komarov) Date: Mon, 14 Jan 2008 12:51:27 +0100 Subject: [wxruby-users] Adding menu items to a TaskBar In-Reply-To: <478B474F.5080607@pressure.to> References: <26cdfac566bb5c2a844d0e38e87587dd@ruby-forum.com> <478B474F.5080607@pressure.to> Message-ID: <06056c367bd4d7da147451ad87d23a3e@ruby-forum.com> Yes I was read this message before write my post. I'm quite new in Ruby and not understand this code :( actually I understand what this code doing but I don't understand how I can use this code in my project. Thanks for reply -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Mon Jan 14 12:01:18 2008 From: alex at pressure.to (Alex Fenton) Date: Mon, 14 Jan 2008 17:01:18 +0000 Subject: [wxruby-users] Adding menu items to a TaskBar In-Reply-To: <06056c367bd4d7da147451ad87d23a3e@ruby-forum.com> References: <26cdfac566bb5c2a844d0e38e87587dd@ruby-forum.com> <478B474F.5080607@pressure.to> <06056c367bd4d7da147451ad87d23a3e@ruby-forum.com> Message-ID: <478B955E.3000604@pressure.to> Anton Komarov wrote: > Yes I was read this message before write my post. > I'm quite new in Ruby and not understand this code :( > actually I understand what this code doing but I don't understand how I > can use this code in my project Have you actually tried working at it? As the previous emails said, create_popup_menu is called EVERY time the user clicks on the taskbar icon. So if the contents of that menu should change depending on the program's state (eg if the user is logged in), test for that state in create_popup_menu and the correct menu will be shown. From your example, what you could change is move the "if @user.login?" test into create_popup_menu. If the user is logged in, show the extra project menu items, if not, don't. hth alex From Peter_Ellis at nrel.gov Mon Jan 14 17:53:53 2008 From: Peter_Ellis at nrel.gov (Ellis, Peter) Date: Mon, 14 Jan 2008 15:53:53 -0700 Subject: [wxruby-users] How to get a Window handle from another app? Message-ID: Hello, I would like to get a window handle from another app outside of wxRuby and convert it into a wxRuby Window handle so that I can use it as the parent Window for several wxRuby child windows. Basically I want to use the FRAME_FLOAT_ON_PARENT window style so that my wxRuby windows become associated with the outside app kind of like toolbars, e.g., they don't show up in the taskbar and are always floating on top of my target app. Going through the archives I found a related question here, but I think it's the opposite of what I want to do: http://rubyforge.org/pipermail/wxruby-users/2007-December/003485.html I already have wxRuby and my target app talking to each other pretty well, it would just make for a cleaner interface to make the target app into the parent window somehow. Oh, and did I mention?, I'm looking for a cross-platform solution for Windows and OSX! Or I'll just settle for Windows-only if I have to. Any ideas? Thanks, P -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20080114/4c894028/attachment-0001.html From alex at pressure.to Tue Jan 15 06:55:50 2008 From: alex at pressure.to (Alex Fenton) Date: Tue, 15 Jan 2008 11:55:50 +0000 Subject: [wxruby-users] How to get a Window handle from another app? In-Reply-To: References: Message-ID: <478C9F46.1030306@pressure.to> Hi Ellis, Peter wrote: > > I would like to get a window handle from another app outside of wxRuby > and convert it into a wxRuby Window handle so that I can use it as the > parent Window for several wxRuby child windows. Basically I want to > use the FRAME_FLOAT_ON_PARENT window style so that my wxRuby windows > become associated with the outside app kind of like toolbars, e.g., > they don't show up in the taskbar and are always floating on top of my > target app. > [plain text is preferred on this list, please] This reference from C++ wxWidgets and a few others seem to suggest a HWND window identifier can be linked to a Wx::Window using the AssociateHandle method call: http://www.wxwidgets.org/wiki/index.php/WxWidgets_For_MFC_Programmers#Associating_HWNDs_with_wxWindow_instances However, although the AssociateHandle call is listed in the headers, it's not listed in the wxWidgets documentation. So at present it's not available in wxRuby. I will see if it's possible to add this call for the next release. alex From alex at pressure.to Tue Jan 15 15:46:49 2008 From: alex at pressure.to (Alex Fenton) Date: Tue, 15 Jan 2008 20:46:49 +0000 Subject: [wxruby-users] version 1.9.3 released Message-ID: <478D1BB9.1030702@pressure.to> Hi We're pleased to invite you to try the latest version of wxRuby, 1.9.3. http://rubyforge.org/frs/?group_id=35&release_id=18145 == WHAT'S NEW == Thanks to a number of contributors, this is a feature-packed release: * GraphicsContext, for high-quality, anti-aliased drawing and sophisticated image transforms * MediaCtrl, for playing and controlling sound and video files * GLCanvas, for drawing with OpenGL (requires ruby-opengl) * Drag'n'drop and Clipboard support for exchanging data within and between applications * Other minor additions, including SearchCtrl and GridTableBase * Support for universal binaries on OS X, and dynamic linking on Linux * Support for building with ruby 1.9 (although there are problems with 1.9 bugs) * Bugfixes to existing classes, and fixes for various build and install problems == INSTALLATION == As usual, the easiest way to get wxRuby is to install an all-in-one precompiled rubygem: gem install wxruby Gems are currently available for Microsoft Windows, OS X Leopard (universal) and Linux i686. Feedback is welcome on the range of binary gems offered. == THANKS == Thank you very much to everyone who helped with this release with patches, bug reports and suggestions and discussions on the mailing lists. Contributors to the 1.9.3 code include Sean Long, Mario Steele, Albin Holmgren, Ryuichi Sakamoto and Dale Edmons == WHAT'S NEXT == There's some smaller issues to iron out, so we'll look to have a 1.9.4 release with a bit less of a gap than before this release. In the interim, look out for an updated release of wxSugar, with some nifty new code generation tools. cheers alex From Peter_Ellis at nrel.gov Tue Jan 15 19:03:14 2008 From: Peter_Ellis at nrel.gov (Ellis, Peter) Date: Tue, 15 Jan 2008 17:03:14 -0700 Subject: [wxruby-users] How to get a Window handle from another app? In-Reply-To: <478C9F46.1030306@pressure.to> References: <478C9F46.1030306@pressure.to> Message-ID: Thanks, Alex. That sounds very promising. I know I can get an HWND in Ruby using the Win32API library in Windows. Just curious how might that work in OS X? I've been mainly developing my app on Windows, but it will also need to work on OS X eventually. P -----Original Message----- From: wxruby-users-bounces at rubyforge.org [mailto:wxruby-users-bounces at rubyforge.org] On Behalf Of Alex Fenton Sent: Tuesday, January 15, 2008 4:56 AM To: General discussion of wxRuby Subject: Re: [wxruby-users] How to get a Window handle from another app? Hi Ellis, Peter wrote: > > I would like to get a window handle from another app outside of wxRuby > and convert it into a wxRuby Window handle so that I can use it as the > parent Window for several wxRuby child windows. Basically I want to > use the FRAME_FLOAT_ON_PARENT window style so that my wxRuby windows > become associated with the outside app kind of like toolbars, e.g., > they don't show up in the taskbar and are always floating on top of my > target app. > [plain text is preferred on this list, please] This reference from C++ wxWidgets and a few others seem to suggest a HWND window identifier can be linked to a Wx::Window using the AssociateHandle method call: http://www.wxwidgets.org/wiki/index.php/WxWidgets_For_MFC_Programmers#As sociating_HWNDs_with_wxWindow_instances However, although the AssociateHandle call is listed in the headers, it's not listed in the wxWidgets documentation. So at present it's not available in wxRuby. I will see if it's possible to add this call for the next release. alex _______________________________________________ wxruby-users mailing list wxruby-users at rubyforge.org http://rubyforge.org/mailman/listinfo/wxruby-users From ac251404 at ohio.edu Wed Jan 16 11:41:04 2008 From: ac251404 at ohio.edu (Alex Ciarlillo) Date: Wed, 16 Jan 2008 11:41:04 -0500 Subject: [wxruby-users] Question about WxNotebook, threads, and GUI refreshing Message-ID: <478E33A0.2070809@ohio.edu> I'm running into a problem I've had before with wxRuby where the GUI does not update while my App is processing some set of data. The fix for this I know is to put the data processing piece in a new thread and in the Wx::App code make a timer to pass the threads. This has always worked in the past, but now my problem is slightly more complex and I'm at a loss. Basically I am trying to put together a bunch of small reporting apps I've made into one single application using tabs to separate them. I've redesigned each of the other applications so that they each contain their own panel class and controller class (for doing the processing) then I have the main application which contains the Wx::App and Wx::Notebook and the notebook simply adds pages using instances of the panel classes I created. So the problem (I assume) is that I'm not setting up the thread switching properly for use with a Wx::Notebook. Here is the main app code: --- MultiTool.rb --- require 'wx' require 'wx_sugar/all' require 'panels/all.rb' class MainNB < Wx::Notebook def initialize(parent, id) super(parent, id, Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE, Wx::NB_TOP) fpar_page = add_page(FPARPanel.new(self), "Acct. Report", true, 0) gsbis_page = add_page(GSBISPanel.new(self), "Inv. Scan", true, 0) mpa_page = add_page(MPAPanel.new(self), "Product Addition", true, 0) msrpc_page = add_page(MSRPCPanel.new(self), "SRP Change", true, 0) payparse_page = add_page(PayParsePanel.new(self), "Payroll Report", true, 0) set_selection(0) end end class MyApp < Wx::App def on_init frame = Wx::Frame.new(nil, :size => Wx::Size.new(686, 303), :title => "MultiTool") notebook = MainNB.new(frame, 0) t = Wx::Timer.new(self, 55) evt_timer(55) { Thread.pass } t.start(20) frame.show end end MyApp.new.main_loop --- END --- So that is where I create the timer and pass the thread... then the thread is actually created when a button is pressed on one of the panels in the notebook. The end result is that whatever is in the new thread just never executes. I'm trying to break this up into a larger but easily maintainable set of applications which is why I have all the files separated out in the way I do, but I'm really unsure of how this affecting the execution of the code. The code for the panels is all pretty lengthy and in the middle of being cleaned up and re-written, but its basically in the form: --- example panel --- class GSBISPanel < Wx::Panel def initialize(*args) super(*args) # bunch of crap in a grid # button that starts data processing add(Wx::Button[:label => 'Run']) do |@b_run| listen(:button, @b_run, :run) end end def run t = Thread.new { #process a bunch of data (this never runs)} end end --- END example --- I hope I am explaining this thoroughly and clearly. If anyone has some pointers or ideas of how to approach this please let me know. thanks, -alex From alex at pressure.to Wed Jan 16 17:41:49 2008 From: alex at pressure.to (Alex Fenton) Date: Wed, 16 Jan 2008 22:41:49 +0000 Subject: [wxruby-users] Question about WxNotebook, threads, and GUI refreshing In-Reply-To: <478E33A0.2070809@ohio.edu> References: <478E33A0.2070809@ohio.edu> Message-ID: <478E882D.3070204@pressure.to> Hi Alex Alex Ciarlillo wrote: > I'm running into a problem I've had before with wxRuby where the GUI > does not update while my App is processing some set of data. The fix for > this I know is to put the data processing piece in a new thread and in > the Wx::App code make a timer to pass the threads. This has always > worked in the past, but now my problem is slightly more complex and I'm > at a loss. > I can't see anything wrong with the way you've set things out. As the etc/threaded.rb sample shows, there should be no problem with having multiple ruby 1.8 threads running in the background of a wxRuby application. Perhaps ensure that you set abort_on_exception = true for each of the child threads. I've sometimes been puzzled that a thread's not running, only to find that there's some bug in the thread's code which means it's crashed and stopped, but silently. Incidentally, as of wxRuby 1.9.4, you'll be able to use a slightly neater notation to pass control among ruby threads, eg: Wx::Timer.every(50) { Thread.pass } to rotate every 50ms > Basically I am trying to put together a bunch of small reporting apps > I've made into one single application using tabs to separate them. THere's probably different ways to design this. Depending on what the child notebooks are doing, you could run two timers, one to make ruby's threads run, and another to check a queue for updates to the GUI. Then the child threads could add updates to this queue. alex From alex at pressure.to Thu Jan 17 17:16:22 2008 From: alex at pressure.to (Alex Fenton) Date: Thu, 17 Jan 2008 22:16:22 +0000 Subject: [wxruby-users] 1.9.4 released Message-ID: <478FD3B6.1000905@pressure.to> Hi Just a quick note to say we released a new version, 1.9.4. The main purpose of this release is to offer an OS X gem that's compatible with both 10.4 and 10.5 - The wxruby-1.9.3 OS X binary gem would only work with version 10.5 (Leopard). Version 1.9.4 also includes a couple of other minor fixes and enhancements, including * Some new AuiNotebook methods added in recent wxWidgets 2.8 * Use normal wxRuby-style event handling for HtmlLinkEvent and HtmlCellEvent * Added Wx::Timer.every and Wx::Timer.after convenience methods If you have an application that uses HtmlWindow, you may need to check the latest docs and current version of the html sample to see how event handling now works. Thanks very much to Sean for quickly fixing the OS X gem problem and getting the new builds up there. cheers alex From echobinary at gmail.com Fri Jan 18 01:34:45 2008 From: echobinary at gmail.com (EchoB) Date: Fri, 18 Jan 2008 01:34:45 -0500 Subject: [wxruby-users] Noob question for wxMenu.get_menu_items() Message-ID: <47904885.2010804@gmail.com> How do I iterate through the pseudo-template list class containing wxMenuItem pointers. Am still a bit of a Ruby/wxRuby noob. Currently have this: pp mymenu.get_menu_items() which prints: # However when I try to do: mymenu.get_menu_items().each {|key| ...} it tells me there is no each method for this class (SWIG::TYPE_p_wxMenuItemList) From alex at pressure.to Fri Jan 18 10:20:17 2008 From: alex at pressure.to (Alex Fenton) Date: Fri, 18 Jan 2008 15:20:17 +0000 Subject: [wxruby-users] Noob question for wxMenu.get_menu_items() In-Reply-To: <47904885.2010804@gmail.com> References: <47904885.2010804@gmail.com> Message-ID: <4790C3B1.8060306@pressure.to> EchoB wrote: > How do I iterate through the pseudo-template list class containing > wxMenuItem pointers. > Am still a bit of a Ruby/wxRuby noob. > Currently have this: > > pp mymenu.get_menu_items() > > which prints: > # Ooops, it's a bug. Thanks for the report. In the meantime you should be able to do something like the following to iterate over each item inside a Menu class MyMenu < Wx::Menu def each (0...menu_item_count).each do | i | yield find_item_by_position(i) end end end cheers alex From mortonda at dgrmm.net Sat Jan 19 11:50:25 2008 From: mortonda at dgrmm.net (David Morton) Date: Sat, 19 Jan 2008 10:50:25 -0600 Subject: [wxruby-users] lose focus event? Message-ID: <71A10258-CBA7-482C-83AB-5B254D01C852@dgrmm.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I'm new to wxruby, and I haven't found any answer with google: Is there a way to capture a lose focus event on controls, such as a combo box? All my experiments show events when changing the text, but not when leaving the box. I want to make a combobox that autocompletes if I press tab (or down arrow or something), but if I click out or hit enter it needs to prompt me to add a new value. I'm trying to duplicate a behaviour in an Access app - I'd really like to ditch Access! On a higher level explanation, in case there's a better way to do it... I want it to search as I type, displaying possible matches, and let me complete with one of the matches, or if there is no match use the current search to create a new record. David Morton Maia Mailguard http://www.maiamailguard.com mortonda at dgrmm.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) iD8DBQFHkipRUy30ODPkzl0RAi1bAKDNUbpfevGbpbkDQ8SqXXLZdDcrwQCfcE9G 3SLeVn92PcX8dgBXonwo0TA= =ndvX -----END PGP SIGNATURE----- From mario at ruby-im.net Sat Jan 19 12:39:49 2008 From: mario at ruby-im.net (Mario Steele) Date: Sat, 19 Jan 2008 11:39:49 -0600 Subject: [wxruby-users] lose focus event? In-Reply-To: <71A10258-CBA7-482C-83AB-5B254D01C852@dgrmm.net> References: <71A10258-CBA7-482C-83AB-5B254D01C852@dgrmm.net> Message-ID: Hello David, First off, welcome to the wxRuby community. Always nice to see new faces around, and more interest being sparked in wxRuby, especially since it is getting more stable with every release we make. To capture Focus Lost, you would need to use evt_kill_focus(), this detects when a control looses focus. It's specifically for Windows, but since 99.9 percent of the classes we use in wxRuby, are derived from wxWindow, you should be able to utilize the evt_kill_focus() to detect when a control (Such as a combo box), has lost focus. Don't think we have a full example of evt_kill_focus() and it's counterpart evt_set_focus(), but it's pretty simple, and you can find the docs for it here: http://wxruby.rubyforge.org/doc/focusevent.html If you have any more questions, feel free to ask, we're more then happy to help out. L8ers, Mario Steele On 1/19/08, David Morton wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > I'm new to wxruby, and I haven't found any answer with google: Is > there a way to capture a lose focus event on controls, such as a combo > box? All my experiments show events when changing the text, but not > when leaving the box. > > I want to make a combobox that autocompletes if I press tab (or down > arrow or something), but if I click out or hit enter it needs to > prompt me to add a new value. I'm trying to duplicate a behaviour in > an Access app - I'd really like to ditch Access! > > > On a higher level explanation, in case there's a better way to do it... > > I want it to search as I type, displaying possible matches, and let me > complete with one of the matches, or if there is no match use the > current search to create a new record. > > David Morton > Maia Mailguard http://www.maiamailguard.com > mortonda at dgrmm.net > > > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.7 (Darwin) > > iD8DBQFHkipRUy30ODPkzl0RAi1bAKDNUbpfevGbpbkDQ8SqXXLZdDcrwQCfcE9G > 3SLeVn92PcX8dgBXonwo0TA= > =ndvX > -----END PGP SIGNATURE----- > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -- Mario Steele http://www.trilake.net http://www.ruby-im.net http://rubyforge.org/projects/wxruby/ http://rubyforge.org/projects/wxride/ http://rubyforge.org/projects/vwmc/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20080119/ac39483a/attachment-0001.html From mortonda at dgrmm.net Sat Jan 19 16:27:22 2008 From: mortonda at dgrmm.net (David Morton) Date: Sat, 19 Jan 2008 15:27:22 -0600 Subject: [wxruby-users] lose focus event? In-Reply-To: References: <71A10258-CBA7-482C-83AB-5B254D01C852@dgrmm.net> Message-ID: <33935CFF-2F92-459F-8469-1DEED5F996DC@dgrmm.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Jan 19, 2008, at 11:39 AM, Mario Steele wrote: > Hello David, > > First off, welcome to the wxRuby community. Always nice to see new > faces around, and more interest being sparked in wxRuby, especially > since it is getting more stable with every release we make. To > capture Focus Lost, you would need to use evt_kill_focus(), this > detects when a control looses focus. It's specifically for Windows, > but since 99.9 percent of the classes we use in wxRuby, are derived > from wxWindow, you should be able to utilize the evt_kill_focus() to > detect when a control (Such as a combo box), has lost focus. > > Don't think we have a full example of evt_kill_focus() and it's > counterpart evt_set_focus(), but it's pretty simple, and you can > find the docs for it here: http://wxruby.rubyforge.org/doc/focusevent.html > > If you have any more questions, feel free to ask, we're more then > happy to help out. > Thanks for the generous welcome. I'm usually a unix person, and web based, but got roped into working on an Access project. (Hence why I'd rather do this in ruby) GUI stuff by hand is quite new to me. :) I see that event firing, but it appears global, firing for everything that loses focus. I've tried to identify what object was responsible via #get_event_object, #get_id, and #id, but no luck so far. How do I associate it with the combo box? require 'rubygems' require "wx" include Wx class HelloWorld < App def on_init helloframe = Frame.new(nil, -1, "Hello World") button = Button.new(helloframe, :label => 'Close', :pos => [200,200]) evt_button(button) {exit} cbo = ComboBox.new(helloframe, :pos =>Point.new(10,10), :choices => ["foo","bar"], :value => "asdasd", :style => CB_SORT) helloframe.show() evt_set_focus() {|w| # how do I tie this to cbo ? } end end HelloWorld.new.main_loop David Morton Maia Mailguard http://www.maiamailguard.com mortonda at dgrmm.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) iD8DBQFHkms6Uy30ODPkzl0RAm6nAJ0QM8C4BJpIVduRleF1ci2F45cnsgCguqSU SD4j0BzY9WsCl+egTkwjxxU= =qXox -----END PGP SIGNATURE----- From jay at mcgavren.com Sat Jan 19 18:27:31 2008 From: jay at mcgavren.com (Jay McGavren) Date: Sat, 19 Jan 2008 16:27:31 -0700 Subject: [wxruby-users] No joy from Wx::App.dispatch, Wx::App.yield... Message-ID: <839490bc0801191527j4b9caa01h6ffda19a49be29a7@mail.gmail.com> OK, back with another iteration of the same problem... I updated my game demo, but the Close button failed to respond when (and only when) there were too many objects onscreen. The drawing loop is probably lasting longer than my drawing timer interval. I was able to reproduce the problem in my (probably familiar by now) test script just by boosting the number of lines drawn per frame. After each frame, I tried Wx::App.dispatch, Wx::App.dispatch while Wx::App.pending, and Wx::App.yield, all without effect. The (commented out) statements are in the code below. I'm running Ruby 1.8.6 on Windows with wxRuby 1.9.2 (1.9.3 and 1.9.4 both give me errors). If wxRuby is busy drawing when the close button is clicked, is the window close event getting lost altogether, or merely going unhandled? If it's just going unhandled, how can I find it and process it? Help is, as always, most appreciated! -Jay McGavren http://jay.mcgavren.com/zyps require 'rubygems' require 'wx' class MyApp < Wx::App def on_init #Containing frame. frame = Wx::Frame.new(nil, :size => [300, 300]) frame.show #Offscreen drawing buffer. buffer = Wx::Bitmap.new(300, 300) #Displays drawing. window = Wx::Window.new(frame, :size => [300, 300]) window.evt_paint do |event| update_window(window, buffer) end #Initialize drawing loop counter. @i = 0 #Animate periodically. timer_id = Wx::ID_HIGHEST + 1 t = Wx::Timer.new(self, timer_id) evt_timer(timer_id) do animate(window, buffer) #No effect. #self.dispatch #No effect. #self.dispatch while self.pending #No effect. #self.yield end t.start(33) end def animate(window, buffer) green_pen = Wx::Pen.new(Wx::Colour.new(128, 255, 128), 3) black_pen = Wx::Pen.new(Wx::Colour.new(0, 0, 0), 0) buffer.draw do |surface| #Clear screen. surface.pen = black_pen surface.brush = Wx::BLACK_BRUSH surface.draw_rectangle(0, 0, 300, 300) #Draw lines. surface.pen = green_pen surface.pen.cap = Wx::CAP_ROUND 30000.times do |j| x = @i + j surface.draw_line(x, 0, x+100, 100) end end #Update screen. update_window(window, buffer) @i += 1 @i = 0 if @i > 300 end def update_window(window, buffer) window.paint do |dc| #Copy the buffer to the viewable window. dc.draw_bitmap(buffer, 0, 0, false) end end end app = MyApp.new app.main_loop From mortonda at dgrmm.net Sat Jan 19 19:13:23 2008 From: mortonda at dgrmm.net (David Morton) Date: Sat, 19 Jan 2008 18:13:23 -0600 Subject: [wxruby-users] lose focus event? In-Reply-To: <33935CFF-2F92-459F-8469-1DEED5F996DC@dgrmm.net> References: <71A10258-CBA7-482C-83AB-5B254D01C852@dgrmm.net> <33935CFF-2F92-459F-8469-1DEED5F996DC@dgrmm.net> Message-ID: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > > I see that event firing, but it appears global, firing for everything > that loses focus. I've tried to identify what object was responsible > via #get_event_object, #get_id, and #id, but no luck so far. How do > I associate it with the combo box? I found and example in HTTP://wxruby.rubyforge.org/svn/trunk/wxruby2/samples/controls/ but it doesn't work. Did you mean MS Windows when you said it was related to windows, or WX windows? class MyComboBox < ComboBox def initialize(*args) super(*args)#, style) evt_set_focus {|event| onFocusGot(event)} end def onFocusGot(event) log_message("MyComboBox::OnFocusGot") event.skip() end end David Morton Maia Mailguard http://www.maiamailguard.com mortonda at dgrmm.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) iD8DBQFHkpIjUy30ODPkzl0RAj9MAKCRdrzr370rQyJ3TIkAzhe+WhLl8wCeK355 Xc40BF9/81vJO1zZ6m1NXFU= =OGub -----END PGP SIGNATURE----- From mario at ruby-im.net Sat Jan 19 19:18:59 2008 From: mario at ruby-im.net (Mario Steele) Date: Sat, 19 Jan 2008 18:18:59 -0600 Subject: [wxruby-users] No joy from Wx::App.dispatch, Wx::App.yield... In-Reply-To: <839490bc0801191527j4b9caa01h6ffda19a49be29a7@mail.gmail.com> References: <839490bc0801191527j4b9caa01h6ffda19a49be29a7@mail.gmail.com> Message-ID: Hello Jay, To process an exit event, or rather a close event, utilize evt_close event handler. Also, what errors are you getting with 1.9.3/4? On 1/19/08, Jay McGavren wrote: > > OK, back with another iteration of the same problem... I updated my > game demo, but the Close button failed to respond when (and only when) > there were too many objects onscreen. The drawing loop is probably > lasting longer than my drawing timer interval. I was able to > reproduce the problem in my (probably familiar by now) test script > just by boosting the number of lines drawn per frame. > > After each frame, I tried Wx::App.dispatch, Wx::App.dispatch while > Wx::App.pending, and Wx::App.yield, all without effect. The > (commented out) statements are in the code below. > > I'm running Ruby 1.8.6 on Windows with wxRuby 1.9.2 (1.9.3 and 1.9.4 > both give me errors). > > If wxRuby is busy drawing when the close button is clicked, is the > window close event getting lost altogether, or merely going unhandled? > If it's just going unhandled, how can I find it and process it? Help > is, as always, most appreciated! > > -Jay McGavren > http://jay.mcgavren.com/zyps > > > require 'rubygems' > require 'wx' > > class MyApp < Wx::App > > def on_init > > #Containing frame. > frame = Wx::Frame.new(nil, :size => [300, 300]) > frame.show > > #Offscreen drawing buffer. > buffer = Wx::Bitmap.new(300, 300) > > #Displays drawing. > window = Wx::Window.new(frame, :size => [300, 300]) > window.evt_paint do |event| > update_window(window, buffer) > end > > #Initialize drawing loop counter. > @i = 0 > > #Animate periodically. > timer_id = Wx::ID_HIGHEST + 1 > t = Wx::Timer.new(self, timer_id) > evt_timer(timer_id) do > animate(window, buffer) > #No effect. > #self.dispatch > #No effect. > #self.dispatch while self.pending > #No effect. > #self.yield > end > t.start(33) > > end > > def animate(window, buffer) > green_pen = Wx::Pen.new(Wx::Colour.new(128, 255, 128), 3) > black_pen = Wx::Pen.new(Wx::Colour.new(0, 0, 0), 0) > buffer.draw do |surface| > #Clear screen. > surface.pen = black_pen > surface.brush = Wx::BLACK_BRUSH > surface.draw_rectangle(0, 0, 300, 300) > #Draw lines. > surface.pen = green_pen > surface.pen.cap = Wx::CAP_ROUND > 30000.times do |j| > x = @i + j > surface.draw_line(x, 0, x+100, 100) > end > end > #Update screen. > update_window(window, buffer) > @i += 1 > @i = 0 if @i > 300 > end > > def update_window(window, buffer) > window.paint do |dc| > #Copy the buffer to the viewable window. > dc.draw_bitmap(buffer, 0, 0, false) > end > end > > end > > app = MyApp.new > app.main_loop > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -- Mario Steele http://www.trilake.net http://www.ruby-im.net http://rubyforge.org/projects/wxruby/ http://rubyforge.org/projects/wxride/ http://rubyforge.org/projects/vwmc/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20080119/3c7ea8b5/attachment.html From mario at ruby-im.net Sat Jan 19 19:22:41 2008 From: mario at ruby-im.net (Mario Steele) Date: Sat, 19 Jan 2008 18:22:41 -0600 Subject: [wxruby-users] lose focus event? In-Reply-To: References: <71A10258-CBA7-482C-83AB-5B254D01C852@dgrmm.net> <33935CFF-2F92-459F-8469-1DEED5F996DC@dgrmm.net> Message-ID: evt_focus does capture all focus changes. The thing to do, is utilize EvtFocus.get_window, that will return the window that the focus is being called for. On 1/19/08, David Morton wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > > > I see that event firing, but it appears global, firing for everything > > that loses focus. I've tried to identify what object was responsible > > via #get_event_object, #get_id, and #id, but no luck so far. How do > > I associate it with the combo box? > > > I found and example in > HTTP://wxruby.rubyforge.org/svn/trunk/wxruby2/samples/controls/ > > but it doesn't work. Did you mean MS Windows when you said it was > related to windows, or WX windows? > > class MyComboBox < ComboBox > def initialize(*args) > super(*args)#, style) > > evt_set_focus {|event| onFocusGot(event)} > end > > > def onFocusGot(event) > log_message("MyComboBox::OnFocusGot") > event.skip() > end > > end > > > > David Morton > Maia Mailguard http://www.maiamailguard.com > mortonda at dgrmm.net > > > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.7 (Darwin) > > iD8DBQFHkpIjUy30ODPkzl0RAj9MAKCRdrzr370rQyJ3TIkAzhe+WhLl8wCeK355 > Xc40BF9/81vJO1zZ6m1NXFU= > =OGub > -----END PGP SIGNATURE----- > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -- Mario Steele http://www.trilake.net http://www.ruby-im.net http://rubyforge.org/projects/wxruby/ http://rubyforge.org/projects/wxride/ http://rubyforge.org/projects/vwmc/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20080119/a456e8fb/attachment-0001.html From mortonda at dgrmm.net Sat Jan 19 19:40:05 2008 From: mortonda at dgrmm.net (David Morton) Date: Sat, 19 Jan 2008 18:40:05 -0600 Subject: [wxruby-users] lose focus event? In-Reply-To: References: <71A10258-CBA7-482C-83AB-5B254D01C852@dgrmm.net> <33935CFF-2F92-459F-8469-1DEED5F996DC@dgrmm.net> Message-ID: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Jan 19, 2008, at 6:22 PM, Mario Steele wrote: > evt_focus does capture all focus changes. The thing to do, is > utilize EvtFocus.get_window, that will return the window that the > focus is being called for. test.rb:63:in `on_init': undefined method 'get_window' for # (NoMethodError) from test.rb:68:in `call' from test.rb:68:in `main_loop' from test.rb:68 class HelloWorld < App def on_init helloframe = Frame.new(nil, -1, "Hello World") button = Button.new(helloframe, :label => 'Close', :pos => [200,200]) evt_button(button) {exit} cbo = MyComboBox.new(helloframe, :pos =>Point.new(10,10), :choices => ["foo","bar"], :value => "asdasd", :style => CB_SORT) helloframe.show() evt_set_focus() {|w| puts w.get_window # how do I tie this to cbo ? } end end HelloWorld.new.main_loop David Morton Maia Mailguard http://www.maiamailguard.com mortonda at dgrmm.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) iD8DBQFHkphlUy30ODPkzl0RAmhIAJ4oTI9fQSCMlotalaYNvNa1EXvkTQCgkdVf CgiQBdFCoEdUE1ZU6bC1Deo= =8NQI -----END PGP SIGNATURE----- From jay at mcgavren.com Sat Jan 19 20:33:52 2008 From: jay at mcgavren.com (Jay McGavren) Date: Sat, 19 Jan 2008 18:33:52 -0700 Subject: [wxruby-users] No joy from Wx::App.dispatch, Wx::App.yield... Message-ID: <839490bc0801191733o63849758he1247c3a32c6c5e8@mail.gmail.com> Mario Steele wrote: > To process an exit event, or rather a close event, utilize > evt_close event handler. Well, look at that. It had always worked on its own before, so I got lazy. But one line of code in on_init did it: frame.evt_close {|event| exit} > Also, what errors are you getting with 1.9.3/4? In a pop-up dialog: The dynamic link library gdiplus.dll could not be found in the specified path [long path omitted] And on STDERR: C:/ruby/lib/ruby/gems/1.8/gems/wxruby-1.9.4-i386-mswin32/lib/wxruby2.so: 126: The specified module could not be found. - C:/ruby/lib/ruby/gems/1.8/gems/wxruby-1.9.4-i386-mswin32/lib/wxruby2.so (LoadError) This is on Windows 2000, BTW, I haven't tried it on my XP setup (but will if needed). Many thanks for the help! -Jay McGavren http://jay.mcgavren.com/zyps From mortonda at dgrmm.net Sat Jan 19 21:38:24 2008 From: mortonda at dgrmm.net (David Morton) Date: Sat, 19 Jan 2008 20:38:24 -0600 Subject: [wxruby-users] lose focus event? In-Reply-To: References: <71A10258-CBA7-482C-83AB-5B254D01C852@dgrmm.net> <33935CFF-2F92-459F-8469-1DEED5F996DC@dgrmm.net> Message-ID: <61084737-5A31-4E34-B359-E3DCF315211B@dgrmm.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 From what I can tell from various wxwidget sources, it seems that most controls do not send the event up to the control level, and I saw one post that was attempting to bind an event... is this the EvtHandler#connect method? On Jan 19, 2008, at 6:22 PM, Mario Steele wrote: > evt_focus does capture all focus changes. The thing to do, is > utilize EvtFocus.get_window, that will return the window that the > focus is being called for. > > On 1/19/08, David Morton wrote: -----BEGIN PGP > SIGNED MESSAGE----- > Hash: SHA1 > > > > > I see that event firing, but it appears global, firing for > everything > > that loses focus. I've tried to identify what object was > responsible > > via #get_event_object, #get_id, and #id, but no luck so far. How > do > > I associate it with the combo box? > > > I found and example in HTTP://wxruby.rubyforge.org/svn/trunk/wxruby2/samples/controls/ > > but it doesn't work. Did you mean MS Windows when you said it was > related to windows, or WX windows? > > class MyComboBox < ComboBox > def initialize(*args) > super(*args)#, style) > > evt_set_focus {|event| onFocusGot(event)} > end > > > def onFocusGot(event) > log_message("MyComboBox::OnFocusGot") > event.skip() > end > > end > > > > David Morton > Maia Mailguard http://www.maiamailguard.com > mortonda at dgrmm.net > > > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.7 (Darwin) > > iD8DBQFHkpIjUy30ODPkzl0RAj9MAKCRdrzr370rQyJ3TIkAzhe+WhLl8wCeK355 > Xc40BF9/81vJO1zZ6m1NXFU= > =OGub > -----END PGP SIGNATURE----- > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > > > > -- > Mario Steele > http://www.trilake.net > http://www.ruby-im.net > http://rubyforge.org/projects/wxruby/ > http://rubyforge.org/projects/wxride/ > http://rubyforge.org/projects/vwmc/ > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users David Morton Maia Mailguard http://www.maiamailguard.com mortonda at dgrmm.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) iD8DBQFHkrQhUy30ODPkzl0RApl/AKDV5mFHh7YCGNKd8ji2TXKG+u3d+QCcDnG/ GLo2hIMbyp7bi7uqLlAIZD0= =EAfD -----END PGP SIGNATURE----- From chauk.mean at gmail.com Sun Jan 20 14:47:18 2008 From: chauk.mean at gmail.com (Chauk-Mean P) Date: Sun, 20 Jan 2008 20:47:18 +0100 Subject: [wxruby-users] 1.9.4 released In-Reply-To: <478FD3B6.1000905@pressure.to> References: <478FD3B6.1000905@pressure.to> Message-ID: Hi, 2008/1/17, Alex Fenton : > Hi > > Just a quick note to say we released a new version, 1.9.4. Just a quick reply to say that wxRuby 1.9.3 and wxRuby 1.9.4 are great releases. Cheers. Chauk-Mean. From alex at pressure.to Sun Jan 20 16:26:14 2008 From: alex at pressure.to (Alex Fenton) Date: Sun, 20 Jan 2008 21:26:14 +0000 Subject: [wxruby-users] 1.9.4 released In-Reply-To: References: <478FD3B6.1000905@pressure.to> Message-ID: <4793BC76.9090004@pressure.to> Chauk-Mean P wrote: > Just a quick reply to say that wxRuby 1.9.3 and wxRuby 1.9.4 are great releases. > Thanks, it's kind of you to mention it. Looking over the Changelog, I realised I forgot to give you credit for your work on 1.9.3 in the email. So, +thanks a From alex at pressure.to Sun Jan 20 18:54:19 2008 From: alex at pressure.to (Alex Fenton) Date: Sun, 20 Jan 2008 23:54:19 +0000 Subject: [wxruby-users] How to get a Window handle from another app? In-Reply-To: References: <478C9F46.1030306@pressure.to> Message-ID: <4793DF2B.7040002@pressure.to> Ellis, Peter wrote: > Thanks, Alex. That sounds very promising. I know I can get an HWND in > Ruby using the Win32API library in Windows. Just curious how might that > work in OS X? I've been mainly developing my app on Windows, but it > will also need to work on OS X eventually. I had a look at the wxWidgets headers, and it seems that AssociateHandle and SetHandle aren't implemented on OS X, so it won't work the same way. GetHandle is, and I'm pretty sure you can already get a meaningful system window id on OS X with get_hwnd. Whether you can do anything useful with this + RubyCocoa I don't know. alex From alex at pressure.to Sun Jan 20 19:07:29 2008 From: alex at pressure.to (Alex Fenton) Date: Mon, 21 Jan 2008 00:07:29 +0000 Subject: [wxruby-users] lose focus event? In-Reply-To: <33935CFF-2F92-459F-8469-1DEED5F996DC@dgrmm.net> References: <71A10258-CBA7-482C-83AB-5B254D01C852@dgrmm.net> <33935CFF-2F92-459F-8469-1DEED5F996DC@dgrmm.net> Message-ID: <4793E241.1010409@pressure.to> Hi David David Morton wrote: > I see that event firing, but it appears global, firing for everything > that loses focus. I've tried to identify what object was responsible > via #get_event_object, #get_id, and #id, but no luck so far. How do > I associate it with the combo box? > FocusEvents aren't CommandEvents, so they don't "bubble" upwards to parent widgets. So I think you need to call the evt_kill_focus method on each ComboBox instance. Have a look at the event handling tutorial in the main API docs for more info. get_event_object should return the widget that triggered any event. > cbo = ComboBox.new(helloframe, > :pos =>Point.new(10,10), > :choices => ["foo","bar"], > :value => "asdasd", > :style => CB_SORT) > helloframe.show() > evt_set_focus() {|w| > # how do I tie this to cbo ? > } > end try: cbo.evt_set_focus { ... } Note that there's a bug on OS X that means ComboBoxes aren't firing evt_kill_focus for some reason. But it should work fine on Windows or Linux. hth alex From mortonda at dgrmm.net Sun Jan 20 19:16:07 2008 From: mortonda at dgrmm.net (David Morton) Date: Sun, 20 Jan 2008 18:16:07 -0600 Subject: [wxruby-users] lose focus event? *Works in XP ; fails in OS X* In-Reply-To: <61084737-5A31-4E34-B359-E3DCF315211B@dgrmm.net> References: <71A10258-CBA7-482C-83AB-5B254D01C852@dgrmm.net> <33935CFF-2F92-459F-8469-1DEED5F996DC@dgrmm.net> <61084737-5A31-4E34-B359-E3DCF315211B@dgrmm.net> Message-ID: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Starting over on this thread. I found an example in the sample code controls/controls.rb around line 110-149: class MyComboBox < ComboBox def initialize(parent,id,value = EmptyString, pos = DEFAULT_POSITION, size = DEFAULT_SIZE, choices = [], style = 0) super(parent, id, value, pos, size, choices)#, style) evt_char {|event| onChar(event)} evt_key_down {|event| onKeyDown(event)} evt_key_up {|event| onKeyUp(event)} evt_set_focus {|event| onFocusGot(event)} end # [snip] def onFocusGot(event) log_message("MyComboBox::OnFocusGot") event.skip() end end I uncommented that log_message call in onFocusGot(). It works in WinXP, but it does not work in OS X. In XP, I get a popup with that message, but in OS X, nothing happens at all. Eventually the pp is going to be used in XP, but I'd like to develop on OS X. Any ideas? David Morton Maia Mailguard http://www.maiamailguard.com mortonda at dgrmm.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) iD8DBQFHk+RHUy30ODPkzl0RAtXYAKDINuBBaAqfOEfJRUajNpPKedileACg06VR vxNQodbw6F0UErkeI5JuTKY= =tMwM -----END PGP SIGNATURE----- From mortonda at dgrmm.net Sun Jan 20 19:17:56 2008 From: mortonda at dgrmm.net (David Morton) Date: Sun, 20 Jan 2008 18:17:56 -0600 Subject: [wxruby-users] lose focus event? In-Reply-To: <4793E241.1010409@pressure.to> References: <71A10258-CBA7-482C-83AB-5B254D01C852@dgrmm.net> <33935CFF-2F92-459F-8469-1DEED5F996DC@dgrmm.net> <4793E241.1010409@pressure.to> Message-ID: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Jan 20, 2008, at 6:07 PM, Alex Fenton wrote: > > Note that there's a bug on OS X that means ComboBoxes aren't firing > evt_kill_focus for some reason. But it should work fine on Windows > or Linux. Hah, I just fired off a message about that. lol. Is this a wxwidgets thing, or a deeper OS X thing? David Morton Maia Mailguard http://www.maiamailguard.com mortonda at dgrmm.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) iD8DBQFHk+S0Uy30ODPkzl0RAieJAJoCbnOf5jz4oDIstyj/1Hs119SLIACfeFhH QQGxQv8+NnQtC0eZAvOa/z0= =auOH -----END PGP SIGNATURE----- From alex at pressure.to Sun Jan 20 19:19:02 2008 From: alex at pressure.to (Alex Fenton) Date: Mon, 21 Jan 2008 00:19:02 +0000 Subject: [wxruby-users] No joy from Wx::App.dispatch, Wx::App.yield... In-Reply-To: <839490bc0801191733o63849758he1247c3a32c6c5e8@mail.gmail.com> References: <839490bc0801191733o63849758he1247c3a32c6c5e8@mail.gmail.com> Message-ID: <4793E4F6.1030207@pressure.to> Jay McGavren wrote: > In a pop-up dialog: > > The dynamic link library gdiplus.dll could not be found in the specified path > [long path omitted] Thanks for the report. gdiplus.dll became a new dependency in 1.9.3 with the addition of the GraphicsContext classes for antialiased drawing. We build and test on Win XP where it's always available, and didn't realise it wasn't included in a default install of W2K. However it seems it can downloaded and installed for free on 2000, and is often required by other apps. Zyps looks a fascinating project, perhaps the most interesting I've seen in Ruby GUI programming. I'm keen to try it out; do let me know when there's a release, or even when it's runnable from SVN with wxRuby. alex From alex at pressure.to Sun Jan 20 19:32:42 2008 From: alex at pressure.to (Alex Fenton) Date: Mon, 21 Jan 2008 00:32:42 +0000 Subject: [wxruby-users] lose focus event? *Works in XP ; fails in OS X* In-Reply-To: References: <71A10258-CBA7-482C-83AB-5B254D01C852@dgrmm.net> <33935CFF-2F92-459F-8469-1DEED5F996DC@dgrmm.net> <61084737-5A31-4E34-B359-E3DCF315211B@dgrmm.net> Message-ID: <4793E82A.2000907@pressure.to> David Morton wrote: > I uncommented that log_message call in onFocusGot(). It works in > WinXP, but it does not work in OS X. In XP, I get a popup with that > message, but in OS X, nothing happens at all. Eventually the pp is > going to be used in XP, but I'd like to develop on OS X. Any ideas? > http://rubyforge.org/tracker/index.php?func=detail&aid=5532&group_id=35&atid=218 It's a bug I would very much like to fix as I want to do something similar to what you describe in my own app. But I suspect it's a wxWidgets problem, and haven't got around to writing a C++ test case to find out. As a workaround you could use evt_child_focus, which definitely does work on OS X. You cna use get_window to see what child received focus, and if you track what the last focus was, you could see when the CB lost focus. alex From jay at mcgavren.com Mon Jan 21 00:39:47 2008 From: jay at mcgavren.com (Jay McGavren) Date: Sun, 20 Jan 2008 22:39:47 -0700 Subject: [wxruby-users] No joy from Wx::App.dispatch, Wx::App.yield... Message-ID: <839490bc0801202139v4a179c29mfebd9f6320456391@mail.gmail.com> Alex Fenton wrote: > Thanks for the report. gdiplus.dll became a new dependency > in 1.9.3 with the addition of the GraphicsContext classes > for antialiased drawing. We build and test on Win XP where > it's always available, and didn't realise it wasn't > included in a default install of W2K. However it seems it > can downloaded and installed for free on 2000, and is often > required by other apps. OK, I'll look into getting it on Win2K. 1.9.4 did indeed run out-of-the-box on my WinXP machine. > Zyps looks a fascinating project, perhaps the most > interesting I've seen in Ruby GUI programming. I'm keen to > try it out; do let me know when there's a release, or even > when it's runnable from SVN with wxRuby. Thanks for the kind words. The library demo is runnable - just check out HEAD (rev. 193), cd to the working copy, and say: $ set RUBYLIB=lib $ ruby bin/zyps_demo ...or the equivalents for your OS. You'll be gratified to know I'm getting far better framerates from wxRuby than I was with Ruby-Gnome2. -Jay McGavren http://jay.mcgavren.com/zyps From alex at pressure.to Mon Jan 21 04:43:07 2008 From: alex at pressure.to (Alex Fenton) Date: Mon, 21 Jan 2008 09:43:07 +0000 Subject: [wxruby-users] Zyps In-Reply-To: <839490bc0801202139v4a179c29mfebd9f6320456391@mail.gmail.com> References: <839490bc0801202139v4a179c29mfebd9f6320456391@mail.gmail.com> Message-ID: <4794692B.6050501@pressure.to> Jay McGavren wrote: > The library demo is runnable - just check > out HEAD (rev. 193), cd to the working copy, and say: > > $ set RUBYLIB=lib > $ ruby bin/zyps_demo > > Great demo: fun, absorbing and a nice aesthetic too. If I get some time I might try to write a foxes/rabbits or simple genetics simulator. > ...or the equivalents for your OS. You'll be gratified to know I'm > getting far better framerates from wxRuby than I was with Ruby-Gnome2. > That's good to know. Having a quick glance at the wx code helped turn up a bug - I realised the docs for Wx::Brush are cut off. A custom brush is created thus: Wx::Brush.new(Wx::Colour.new(r, g, b), Wx::SOLID) The second argument is the fill style - other options are things like Wx::CROSS_HATCH. Brushes that stipple Bitmaps can also be used to create textures. http://www.wxwidgets.org/manuals/2.8/wx_wxbrush.html The simplest constructor should be: Wx::Brush.new(Wx::Colour(r, g, b) But this form was missing - now added to SVN for the next release. cheers alex From jay at mcgavren.com Fri Jan 25 15:01:40 2008 From: jay at mcgavren.com (Jay McGavren) Date: Fri, 25 Jan 2008 13:01:40 -0700 Subject: [wxruby-users] "undefined symbol" with wxRuby gem on Fedora Core 5... Message-ID: <839490bc0801251201n3db9ae6do5891938402956d82@mail.gmail.com> I'm trying to test on platforms other than Windows, starting with my Fedora Core 5 box. I'm getting this error when trying to run the Hello World script (http://wxruby.rubyforge.org/wiki/wiki.pl?Hello_World): undefined symbol: gtk_widget_is_composited - /usr/local/lib/ruby/gems/1.8/gems/wxruby-1.9.4-x86- linux/lib/wxruby2.so (LoadError) This happens with both the wxRuby 1.9.4 and 1.9.2 gems. I'm not really looking to build from source; I want the gem to auto-download and "just work" for users of my full application. Hopefully I'm just missing something that can be downloaded via a package manager, which I can include in installation instructions. Can anyone advise? -Jay McGavren http://jay.mcgavren.com/zyps From alex at pressure.to Fri Jan 25 17:17:29 2008 From: alex at pressure.to (Alex Fenton) Date: Fri, 25 Jan 2008 22:17:29 +0000 Subject: [wxruby-users] "undefined symbol" with wxRuby gem on Fedora Core 5... In-Reply-To: <839490bc0801251201n3db9ae6do5891938402956d82@mail.gmail.com> References: <839490bc0801251201n3db9ae6do5891938402956d82@mail.gmail.com> Message-ID: <479A5FF9.7030700@pressure.to> Hi Jay Jay McGavren wrote: > I'm trying to test on platforms other than Windows, starting with my > Fedora Core 5 box. I'm getting this error when trying to run the > Hello World script > (http://wxruby.rubyforge.org/wiki/wiki.pl?Hello_World): > > undefined symbol: gtk_widget_is_composited - > /usr/local/lib/ruby/gems/1.8/gems/wxruby-1.9.4-x86- > linux/lib/wxruby2.so (LoadError) > Thanks for the report. I'm pretty sure this will be because the version of GTK on the (Ubuntu 7.10) machine that I build wxWidgets and the wxRuby gem on is newer than that on the machine you're trying to install on. It looks like that method is referenced in one place in the wxWidgets source and conditionally compiled for version 2.10 of GTK. Could you see what version of GTK2 is provided with your distro please? > This happens with both the wxRuby 1.9.4 and 1.9.2 gems. I'm not > really looking to build from source; I want the gem to auto-download > and "just work" for users of my full application. Hopefully I'm just > missing something that can be downloaded via a package manager, which > I can include in installation instructions. Can anyone advise? > First step would be to see if there is an upgrade to the latest GTK2.10 available from your repo. That would verify that's the issue. More generally, for the binary gems we aim for the commonest platforms - hence Windows XP, Ubuntu, and OS X 10.4. But if we can make the gems more compatible with little compromise on features, we will, as Sean did to make the 1.9.4 release work on OS X 10.4 as well as 10.5. I'll seek some advice on whether I can compile wxWidgets in a more backwards-compatible way re GTK, although some of the stuff that's being used to do conditional compilation is actually direct from GTK. cheers alex From lists at ruby-forum.com Fri Jan 25 17:48:47 2008 From: lists at ruby-forum.com (Muzaffar Hameed) Date: Fri, 25 Jan 2008 23:48:47 +0100 Subject: [wxruby-users] About wxRuby Message-ID: Hi All! I am beginner to Ruby and much interested to learn wxRuby, but still not able to find some useful tutorial for this topic. I have installed wxRuby but not able to run its a single exmaple yet. I will be thankful, if some one guide me on Ruby Wx as I have to develop a final thesis in wxRuby. Bye /Muzaffar -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Fri Jan 25 20:28:38 2008 From: alex at pressure.to (Alex Fenton) Date: Sat, 26 Jan 2008 01:28:38 +0000 Subject: [wxruby-users] About wxRuby In-Reply-To: References: Message-ID: <479A8CC6.7030504@pressure.to> Muzaffar Hameed wrote: > I am beginner to Ruby and much interested to learn wxRuby, but still > not able to find some useful tutorial for this topic. I have installed > wxRuby but not able to run its a single exmaple yet. The best place to start is probably with the samples included with wxRuby. These can be found in your 'gems' directory. A good one to look at is the "minimal" sample. If you are having problems running the samples, please post any error message you are getting, and tell us what platform you are running on (Windows, OS X, Linux). http://wxruby.rubyforge.org/wiki/wiki.pl?Getting_Started alex From lists at ruby-forum.com Sat Jan 26 02:19:25 2008 From: lists at ruby-forum.com (Muzaffar Hameed) Date: Sat, 26 Jan 2008 08:19:25 +0100 Subject: [wxruby-users] About wxRuby In-Reply-To: <479A8CC6.7030504@pressure.to> References: <479A8CC6.7030504@pressure.to> Message-ID: Hi Alex! Many thanks for your reply. I am using Windows XP and I am getting "msvcp71.dll missing", although I have installed the wxRuby using gem command from command line. I will be thankful if you guide me step by step to run my first wxRuby example on my windows XP plateform. Thanks in Advance. Bye /Muzaffar -- Posted via http://www.ruby-forum.com/. From ajnabi at gmail.com Sat Jan 26 12:34:41 2008 From: ajnabi at gmail.com (Dr.Web) Date: Sat, 26 Jan 2008 18:34:41 +0100 Subject: [wxruby-users] About wxRuby Installation on Windows Message-ID: Hi All! I am beginner to Ruby and much interested to learn wxRuby, but still not able to find some useful tutorial for this topic. I have installed wxRuby but not able to run its a single exmaple yet. I am using Windows XP and I am getting "msvcp71.dll missing", although I have installed the wxRuby using gem command from command line. I will be thankful if you guide me step by step to run my first wxRuby example on my windows XP plateform. Bye /Muzaffar From alex at pressure.to Sat Jan 26 13:06:51 2008 From: alex at pressure.to (Alex Fenton) Date: Sat, 26 Jan 2008 18:06:51 +0000 Subject: [wxruby-users] About wxRuby In-Reply-To: References: <479A8CC6.7030504@pressure.to> Message-ID: <479B76BB.50201@pressure.to> Muzaffar Hameed wrote: > I am using Windows XP and I am getting "msvcp71.dll missing", although I > have installed the wxRuby using gem command from command line. This is Microsoft's C runtime library. I don't think we're permitted to redistribute it to users, but if you search on google you will find numerous free sites where you can download it. Once you have downloaded it you should put the .dll file in C:/Windows/system32/. If it requires any other .dll files (eg mscvr71.dll) you should be able to do the same. With that in place you should be all set to go. It's unusual these days that XP doesn't have this .dll available already. What "Service Pack" of XP do you have installed - do you have SP2 installed? hth alex From lists at ruby-forum.com Sat Jan 26 14:05:09 2008 From: lists at ruby-forum.com (Muzaffar Hameed) Date: Sat, 26 Jan 2008 20:05:09 +0100 Subject: [wxruby-users] About wxRuby In-Reply-To: <479B76BB.50201@pressure.to> References: <479A8CC6.7030504@pressure.to> <479B76BB.50201@pressure.to> Message-ID: Hi Alex! Many thanks, using your advice, I download the file and put it in system32 directory and the problem is solved. Thanks again, its a nice support from this forum. Bye /Muzaffar -- Posted via http://www.ruby-forum.com/. From rvnues at tesco.net Sun Jan 27 15:36:56 2008 From: rvnues at tesco.net (rvnues at tesco.net) Date: Sun, 27 Jan 2008 20:36:56 +0000 Subject: [wxruby-users] 1.9.4 released Message-ID: <20080127203656.VJQW5.1906.root@web10-winn.ispmail.private.ntl.com> Hi, I upgraded from 1.9.2. to 1.9.4 and cannot run any (demo-) applications anymore, giving the error message below, which seems related to libgstreamer, not present on my linux box (slackware, pre-12.1). The file wxruby2.so is correctly installed at the expected place. With 1.9.2 no problem, with 1.9.3 same problem as with 1.9.4: ------------------------------------------------ bash-3.1$ ruby dictionary_app.rb dictionaryfile <= run with 1.9.2 bash-3.1$ ruby dictionary_app.rb dictionaryfile <= after 'sudo gem install wxruby' i.e. 1.9.4 /usr/lib/ruby/gems/1.8/gems/wxruby-1.9.4-x86-linux/lib/wxruby2.so: libgstreamer-0.10.so.0: cannot open shared object file: No such file or directory - /usr/lib/ruby/gems/1.8/gems/wxruby-1.9.4-x86-linux/lib/wxruby2.so (LoadError) from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' from /usr/lib/ruby/gems/1.8/gems/wxruby-1.9.4-x86-linux/lib/wx.rb:12 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `require' from ./dictionary_frame.rb:3 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' from dictionary_app.rb:3 bash-3.1$ ruby dictionary_app.rb dictionaryfile <= after 'sudo gem uninstall wxruby -v 1.9.4' -------------------------------------------------- What to do? rob From mario at ruby-im.net Sun Jan 27 20:50:21 2008 From: mario at ruby-im.net (Mario Steele) Date: Sun, 27 Jan 2008 19:50:21 -0600 Subject: [wxruby-users] 1.9.4 released In-Reply-To: <20080127203656.VJQW5.1906.root@web10-winn.ispmail.private.ntl.com> References: <20080127203656.VJQW5.1906.root@web10-winn.ispmail.private.ntl.com> Message-ID: Hello Rob, Just looking quicky at a few things, it looks as though libgstreamer 0.10 is not available as a package for Slackware. My suggestion, is to download the source code for LibGStreamer (Which can be found here: http://gstreamer.freedesktop.org/) and compile libgstreamer yourself. If you have any questions, feel free to send me an email personally, and I'll be happy to guide you through the process of compiling libgstreamer. L8ers, On 1/27/08, rvnues at tesco.net wrote: > > Hi, > > I upgraded from 1.9.2. to 1.9.4 and cannot run any (demo-) applications > anymore, giving the error message below, which seems related to > libgstreamer, not present on my linux box (slackware, pre-12.1). The file > wxruby2.so is correctly installed at the expected place. > With 1.9.2 no problem, with 1.9.3 same problem as with 1.9.4: > ------------------------------------------------ > bash-3.1$ ruby dictionary_app.rb dictionaryfile <= run with 1.9.2 > bash-3.1$ ruby dictionary_app.rb dictionaryfile <= after 'sudo gem > install wxruby' i.e. 1.9.4 > /usr/lib/ruby/gems/1.8/gems/wxruby-1.9.4-x86-linux/lib/wxruby2.so: > libgstreamer-0.10.so.0: cannot open shared object file: No such file or > directory - /usr/lib/ruby/gems/1.8/gems/wxruby-1.9.4-x86-linux/lib/wxruby2.so > (LoadError) > from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in > `require' > from /usr/lib/ruby/gems/1.8/gems/wxruby-1.9.4-x86-linux > /lib/wx.rb:12 > from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in > `gem_original_require' > from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in > `require' > from ./dictionary_frame.rb:3 > from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in > `gem_original_require' > from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in > `require' > from dictionary_app.rb:3 > bash-3.1$ ruby dictionary_app.rb dictionaryfile <= after 'sudo gem > uninstall wxruby -v 1.9.4' > -------------------------------------------------- > > What to do? > > > rob > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -- Mario Steele http://www.trilake.net http://www.ruby-im.net http://rubyforge.org/projects/wxruby/ http://rubyforge.org/projects/wxride/ http://rubyforge.org/projects/vwmc/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20080127/0752be6f/attachment.html From Franz.Irlweg.ZNT at wacker.com Mon Jan 28 05:28:07 2008 From: Franz.Irlweg.ZNT at wacker.com (Irlweg, Franz (ZNT)) Date: Mon, 28 Jan 2008 11:28:07 +0100 Subject: [wxruby-users] GridTableBase Message-ID: Hello all, i'm using wxruby 1.9.4 with Grid and the model class: "GridTableBase" like in the code below. But the method set_table of the grid does'nt work. Can anyone help me? require 'wx' include Wx class MyGridTableBase < GridTableBase def get_attr row, col, attr_kind ## end def get_number_rows 0 end def get_number_cols 0 end def get_col_label_value col return "empty" end def is_empty_cell row, col return false end def get_value row, col return "empty" end end g = Grid.new gt = MyGridTableBase.new g.set_table gt # i get one of this errors: # TypeError: in method 'SetTable', argument 2 of type 'wxGridTableBase *' # or a "unknown software exception" (0xc0000094) on 0x030dc124 is thrown Best Regards, Franz

This communication and any files or attachments transmitted with it may contain information that is copyrighted or confidential and exempt from
disclosure under applicable law. It is intended solely for the use of the individual or the entity to which it is addressed.
If you are not the intended recipient, you are hereby notified that any use, dissemination, or copying of this communication is strictly prohibited.
If you have received this communication in error, please notify us at once so that we may take the appropriate action and avoid troubling you further.
Thank you for your cooperation. Please contact your local IT staff or email info at siltronic.com if you need assistance.
 
Siltronic AG, Sitz München, Hanns-Seidel-Platz 4, 81737 München, Germany. Amtsgericht München HRB 150884
Vorstand: Wilhelm Sittenthaler (Vorsitz), Gerhard Brehm, Paul Lindblad, Joachim Manke, Michael Peterat. Vorsitzender des Aufsichtsrats: Peter-Alexander Wacker

-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20080128/7026e3eb/attachment.html From mario at ruby-im.net Mon Jan 28 06:33:10 2008 From: mario at ruby-im.net (Mario Steele) Date: Mon, 28 Jan 2008 05:33:10 -0600 Subject: [wxruby-users] GridTableBase In-Reply-To: References: Message-ID: If this is all top level code, you need to initialize the Wx::App class first. When I try this, and change the bottom part where you create the new grid and gridtablebase, it runs alright. App.new do g = Grid.new gt = MyGridTablebBase.new g.set_table(gt) end What platform are you running on? On 1/28/08, Irlweg, Franz (ZNT) wrote: > > Hello all, > i'm using wxruby 1.9.4 with Grid and the model class: "GridTableBase" > like in the code below. But the method set_table of the grid does'nt work. > Can anyone help me? > > require 'wx' > include Wx > > class MyGridTableBase < GridTableBase > def get_attr row, col, attr_kind > ## > end > > def get_number_rows > 0 > end > > def get_number_cols > 0 > end > > def get_col_label_value col > return "empty" > end > > def is_empty_cell row, col > return false > end > > def get_value row, col > return "empty" > end > end > > g = Grid.new > gt = MyGridTableBase.new > g.set_table gt > > # i get one of this errors: > # TypeError: in method 'SetTable', argument 2 of type 'wxGridTableBase *' > # or a "unknown software exception" (0xc0000094) on 0x030dc124 is > thrown > > Best Regards, > Franz > > This communication and any files or attachments transmitted with it may > contain information that is copyrighted or confidential and exempt from > disclosure under applicable law. It is intended solely for the use of the > individual or the entity to which it is addressed. > If you are not the intended recipient, you are hereby notified that any > use, dissemination, or copying of this communication is strictly prohibited. > > If you have received this communication in error, please notify us at once > so that we may take the appropriate action and avoid troubling you further. > Thank you for your cooperation. Please contact your local IT staff or > email info at siltronic.com if you > need assistance. > > Siltronic AG, Sitz M?nchen, Hanns-Seidel-Platz 4, 81737 M?nchen, Germany. > Amtsgericht M?nchen HRB 150884 > Vorstand: Wilhelm Sittenthaler (Vorsitz), Gerhard Brehm, Paul Lindblad, > Joachim Manke, Michael Peterat. Vorsitzender des Aufsichtsrats: > Peter-Alexander Wacker > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -- Mario Steele http://www.trilake.net http://www.ruby-im.net http://rubyforge.org/projects/wxruby/ http://rubyforge.org/projects/wxride/ http://rubyforge.org/projects/vwmc/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20080128/04ae25ec/attachment.html From Franz.Irlweg.ZNT at wacker.com Mon Jan 28 07:53:04 2008 From: Franz.Irlweg.ZNT at wacker.com (Irlweg, Franz (ZNT)) Date: Mon, 28 Jan 2008 13:53:04 +0100 Subject: [wxruby-users] GridTableBase In-Reply-To: References: Message-ID: Hello, ok, it was only a code snippet, but normally it should run in a window, like in the code below: I'm running Windows XP and i always get the error: in `set_table': in method 'SetTable', argument 2 of type 'wxGridTableBase *' (ObjectPreviouslyDeleted) require 'wx' include Wx class MyGridTableBase < GridTableBase def initialize rowObjs, objType @objType = objType @rowObjs = rowObjs @colNames = ["aa", "bb"] end def get_attr row, col, attr_kind # todo "" end def get_number_rows return @rowObjs.size end def get_number_cols return @colNames.size end def get_col_label_value col return @colNames[col] end def is_empty_cell row, col return false end def get_value row, col @rowObjs[col] end def set_value row, col, value end end class TestWin < Frame def initialize *args super(*args) StaticText.new self, -1, "Test Test Test" @g = Grid.new self @gt = MyGridTableBase.new ["aa", "bb"], String @g.set_table(@gt) ## !!!!!!!!!!!!!!!!!!!!!!!! end end class TestApp < Wx::App def on_init frame = TestWin.new(nil, -1, "Grid Sample",Wx::Point.new(10, 100),Wx::Size.new(630,400)) set_top_window(frame) frame.show() end end TestApp.new.main_loop() # App.new do # end Best regards, Franz ________________________________ From: wxruby-users-bounces at rubyforge.org [mailto:wxruby-users-bounces at rubyforge.org] On Behalf Of Mario Steele Sent: Monday, January 28, 2008 12:33 PM To: General discussion of wxRuby Subject: Re: [wxruby-users] GridTableBase If this is all top level code, you need to initialize the Wx::App class first. When I try this, and change the bottom part where you create the new grid and gridtablebase, it runs alright. App.new do g = Grid.new gt = MyGridTablebBase.new g.set_table(gt) end What platform are you running on? On 1/28/08, Irlweg, Franz (ZNT) wrote:

This communication and any files or attachments transmitted with it may contain information that is copyrighted or confidential and exempt from
disclosure under applicable law. It is intended solely for the use of the individual or the entity to which it is addressed.
If you are not the intended recipient, you are hereby notified that any use, dissemination, or copying of this communication is strictly prohibited.
If you have received this communication in error, please notify us at once so that we may take the appropriate action and avoid troubling you further.
Thank you for your cooperation. Please contact your local IT staff or email info at siltronic.com if you need assistance.
 
Siltronic AG, Sitz München, Hanns-Seidel-Platz 4, 81737 München, Germany. Amtsgericht München HRB 150884
Vorstand: Wilhelm Sittenthaler (Vorsitz), Gerhard Brehm, Paul Lindblad, Joachim Manke, Michael Peterat. Vorsitzender des Aufsichtsrats: Peter-Alexander Wacker

-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20080128/f2720f96/attachment-0001.html From alex at pressure.to Mon Jan 28 17:41:08 2008 From: alex at pressure.to (Alex Fenton) Date: Mon, 28 Jan 2008 22:41:08 +0000 Subject: [wxruby-users] GridTableBase In-Reply-To: References: Message-ID: <479E5A04.1080009@pressure.to> Hi Franz Irlweg, Franz (ZNT) wrote: > I'm running Windows XP and i always get the error: > *in `set_table': in method 'SetTable', argument 2 of type > 'wxGridTableBase *' (ObjectPreviouslyDeleted)* ... > class MyGridTableBase < GridTableBase > > def initialize rowObjs, objType > @objType = objType > @rowObjs = rowObjs > @colNames = ["aa", "bb"] > end You need to call super() in your constructor. Sorry the (SWIG-generated) exception isn't very informative, but it's trying to say that the underlying C++ object hasn't been initialised. alex From Franz.Irlweg.ZNT at wacker.com Tue Jan 29 02:33:22 2008 From: Franz.Irlweg.ZNT at wacker.com (Irlweg, Franz (ZNT)) Date: Tue, 29 Jan 2008 08:33:22 +0100 Subject: [wxruby-users] GridTableBase In-Reply-To: <479E5A04.1080009@pressure.to> References: <479E5A04.1080009@pressure.to> Message-ID: A lot of thanks, I thought because GridTableBase is a interface, ... but we are in Ruby, and here a interface is a class! franz -----Original Message----- From: wxruby-users-bounces at rubyforge.org [mailto:wxruby-users-bounces at rubyforge.org] On Behalf Of Alex Fenton Sent: Monday, January 28, 2008 11:41 PM To: General discussion of wxRuby Subject: Re: [wxruby-users] GridTableBase Hi Franz Irlweg, Franz (ZNT) wrote: > I'm running Windows XP and i always get the error: > *in `set_table': in method 'SetTable', argument 2 of type > 'wxGridTableBase *' (ObjectPreviouslyDeleted)* ... > class MyGridTableBase < GridTableBase > > def initialize rowObjs, objType > @objType = objType > @rowObjs = rowObjs > @colNames = ["aa", "bb"] > end You need to call super() in your constructor. Sorry the (SWIG-generated) exception isn't very informative, but it's trying to say that the underlying C++ object hasn't been initialised. alex _______________________________________________ wxruby-users mailing list wxruby-users at rubyforge.org http://rubyforge.org/mailman/listinfo/wxruby-users If you are not the intended recipient, you are hereby notified that any use, dissemination, or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us at once so This communication and any files or attachments transmitted with it may contain information that is copyrighted or confidential and exempt from disclosure under applicable law. It is intended solely for the use of the individual or the entity to which it is addressed. that we may take the appropriate action and avoid troubling you further. Thank you for your cooperation. Please contact your local IT staff or email info at siltronic.com if you need assistance. Siltronic AG, Sitz Muenchen, Hanns-Seidel-Platz 4, 81737 Muenchen, Germany. Amtsgericht Muenchen HRB 150884 Vorstand: Wilhelm Sittenthaler (Vorsitz), Gerhard Brehm, Paul Lindblad, Joachim Manke, Michael Peterat. Vorsitzender des Aufsichtsrats: Peter-Alexander Wacker From Franz.Irlweg.ZNT at wacker.com Tue Jan 29 05:50:04 2008 From: Franz.Irlweg.ZNT at wacker.com (Irlweg, Franz (ZNT)) Date: Tue, 29 Jan 2008 11:50:04 +0100 Subject: [wxruby-users] wxruby and ActiveRecord Message-ID: Hello, i'm running wxruby 1.9.4, and i show my ActiveRecord data in a grid (with GridTableBase) (a grid with 30 columns) >From my base Window, i open and close the GridWindow. After several openings and closes, this message appears: c:/Programme/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_ record/base.rb:1860: [BUG] Segmentation fault ruby 1.8.6 (2007-03-13) [i386-mswin32] (Somtimes, (every hour) a segmentation fault on the wxruby main loop is also registered!) Did someone have a similar problem? With wxruby 1.9.2 i do not have this problem, even though in some rare cases, a segmentation fault appears. franz

This communication and any files or attachments transmitted with it may contain information that is copyrighted or confidential and exempt from
disclosure under applicable law. It is intended solely for the use of the individual or the entity to which it is addressed.
If you are not the intended recipient, you are hereby notified that any use, dissemination, or copying of this communication is strictly prohibited.
If you have received this communication in error, please notify us at once so that we may take the appropriate action and avoid troubling you further.
Thank you for your cooperation. Please contact your local IT staff or email info at siltronic.com if you need assistance.
 
Siltronic AG, Sitz München, Hanns-Seidel-Platz 4, 81737 München, Germany. Amtsgericht München HRB 150884
Vorstand: Wilhelm Sittenthaler (Vorsitz), Gerhard Brehm, Paul Lindblad, Joachim Manke, Michael Peterat. Vorsitzender des Aufsichtsrats: Peter-Alexander Wacker

-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20080129/3ae8c0f8/attachment.html From alex at pressure.to Tue Jan 29 07:07:18 2008 From: alex at pressure.to (Alex Fenton) Date: Tue, 29 Jan 2008 12:07:18 +0000 Subject: [wxruby-users] 1.9.4 released In-Reply-To: <20080127203656.VJQW5.1906.root@web10-winn.ispmail.private.ntl.com> References: <20080127203656.VJQW5.1906.root@web10-winn.ispmail.private.ntl.com> Message-ID: <479F16F6.1050704@pressure.to> rvnues at tesco.net wrote: > Hi, > > I upgraded from 1.9.2. to 1.9.4 and cannot run any (demo-) applications anymore, giving the error message below, which seems related to libgstreamer, not present on my linux box (slackware, pre-12.1). > .. > What to do? > The wxRuby 1.9.3 binaries added Wx::MediaCtrl, which requires libgstreamer on Linux. You can either: 1) Fufil this dependency by installing libgstreamer or 2) Build your own wxRuby. Wx::MediaCtrl is an optional component, and if you're compiling your own wxRuby and it's not found to be supported, it'll be skipped without error. hth alex From Franz.Irlweg.ZNT at wacker.com Tue Jan 29 09:02:47 2008 From: Franz.Irlweg.ZNT at wacker.com (Irlweg, Franz (ZNT)) Date: Tue, 29 Jan 2008 15:02:47 +0100 Subject: [wxruby-users] 1.9.4 released In-Reply-To: <479F16F6.1050704@pressure.to> References: <20080127203656.VJQW5.1906.root@web10-winn.ispmail.private.ntl.com> <479F16F6.1050704@pressure.to> Message-ID: But my application is running on Windows XP ! ?? -----Original Message----- From: wxruby-users-bounces at rubyforge.org [mailto:wxruby-users-bounces at rubyforge.org] On Behalf Of Alex Fenton Sent: Tuesday, January 29, 2008 1:07 PM To: General discussion of wxRuby Subject: Re: [wxruby-users] 1.9.4 released rvnues at tesco.net wrote: > Hi, > > I upgraded from 1.9.2. to 1.9.4 and cannot run any (demo-) applications anymore, giving the error message below, which seems related to libgstreamer, not present on my linux box (slackware, pre-12.1). > .. > What to do? > The wxRuby 1.9.3 binaries added Wx::MediaCtrl, which requires libgstreamer on Linux. You can either: 1) Fufil this dependency by installing libgstreamer or 2) Build your own wxRuby. Wx::MediaCtrl is an optional component, and if you're compiling your own wxRuby and it's not found to be supported, it'll be skipped without error. hth alex _______________________________________________ wxruby-users mailing list wxruby-users at rubyforge.org http://rubyforge.org/mailman/listinfo/wxruby-users If you are not the intended recipient, you are hereby notified that any use, dissemination, or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us at once so This communication and any files or attachments transmitted with it may contain information that is copyrighted or confidential and exempt from disclosure under applicable law. It is intended solely for the use of the individual or the entity to which it is addressed. that we may take the appropriate action and avoid troubling you further. Thank you for your cooperation. Please contact your local IT staff or email info at siltronic.com if you need assistance. Siltronic AG, Sitz Muenchen, Hanns-Seidel-Platz 4, 81737 Muenchen, Germany. Amtsgericht Muenchen HRB 150884 Vorstand: Wilhelm Sittenthaler (Vorsitz), Gerhard Brehm, Paul Lindblad, Joachim Manke, Michael Peterat. Vorsitzender des Aufsichtsrats: Peter-Alexander Wacker From mortonda at dgrmm.net Tue Jan 29 10:35:54 2008 From: mortonda at dgrmm.net (David Morton) Date: Tue, 29 Jan 2008 09:35:54 -0600 Subject: [wxruby-users] 1.9.4 released In-Reply-To: References: <20080127203656.VJQW5.1906.root@web10-winn.ispmail.private.ntl.com> <479F16F6.1050704@pressure.to> Message-ID: <990BE295-BCB7-444D-8B12-A33A8F7845DE@dgrmm.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Jan 29, 2008, at 8:02 AM, Irlweg, Franz (ZNT) wrote: > But my application is running on Windows XP ! ?? > > rvnues at tesco.net wrote: >> Hi, >> >> I upgraded from 1.9.2. to 1.9.4 and cannot run any (demo-) > applications anymore, giving the error message below, which seems > related to libgstreamer, not present on my linux box (slackware, > pre-12.1). What does XP have to do with the question about Linux? David Morton Maia Mailguard http://www.maiamailguard.com mortonda at dgrmm.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) iD8DBQFHn0faUy30ODPkzl0RAkyQAJwNkI887YMeswOonbXUpSPX7QsbQACfZ2Uj YFqdJjld9R0CXYY39258Ve8= =5XeW -----END PGP SIGNATURE----- From alex at pressure.to Tue Jan 29 11:23:38 2008 From: alex at pressure.to (Alex Fenton) Date: Tue, 29 Jan 2008 16:23:38 +0000 Subject: [wxruby-users] wxruby and ActiveRecord In-Reply-To: References: Message-ID: <479F530A.6060700@pressure.to> Irlweg, Franz (ZNT) wrote: > > i'm running wxruby 1.9.4, and i show my ActiveRecord data in a grid > (with GridTableBase) (a grid with 30 columns) > From my base Window, i open and close the GridWindow. After several > openings and closes, this message appears: > > *c:/Programme/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1860: > [BUG] Segmentation fault* > *ruby 1.8.6 (2007-03-13) [i386-mswin32]* > Thanks for the report. This is a generic crash message. I'd guess there may be a memory problem relating to the Wx::GridTableBase class. We can and do fix these crashes, but we need to identify where it's coming from. To do this, we need either: 1) A debugger backtrace. This is not so easy on Windows, as the relevant software isn't so convenient to install. or 2) A complete, minimal working sample that demostrates the problem, along with a description of any steps needed to trigger the crash. So, if you could provide 2) I'd be happy to look into it. Ideally create a new bug on the wxRuby bug tracker, and add the sample to it as an attachment. http://rubyforge.org/tracker/?atid=218&group_id=35 thanks alex ** From jay at mcgavren.com Tue Jan 29 14:23:30 2008 From: jay at mcgavren.com (Jay McGavren) Date: Tue, 29 Jan 2008 12:23:30 -0700 Subject: [wxruby-users] "undefined symbol" with wxRuby gem on Fedora Core 5... Message-ID: <839490bc0801291123j6ece421mcf66a93837e968a6@mail.gmail.com> Alex Fenton wrote: > Jay McGavren wrote: > > Fedora Core 5 box. I'm getting this error when trying to > run the > > Hello World script > > (http://wxruby.rubyforge.org/wiki/wiki.pl?Hello_World): > > > > undefined symbol: gtk_widget_is_composited - > > /usr/local/lib/ruby/gems/1.8/gems/wxruby-1.9.4-x86- > > linux/lib/wxruby2.so (LoadError) > > > Thanks for the report. > > I'm pretty sure this will be because the version of GTK on > the (Ubuntu 7.10) machine that I build wxWidgets and the > wxRuby gem on is newer than that on the machine you're > trying to install on. It looks like that method is > referenced in one place in the wxWidgets source and > conditionally compiled for version 2.10 of GTK. > > Could you see what version of GTK2 is provided with your > distro please? OK, yeah, I'm at 2.8.20, and can't even update from the FC5 repositories (I'd have to go to at least FC6). I installed FC5 off a co-worker's CD, and didn't realize just how outdated it was. I think I'll do a fresh install of FC8 and test there (as well as with Ubuntu). Unless I'm not the only one running such an outdated distro, it'd be silly to support something so old. Thanks for looking into it, though! -Jay McGavren http://jay.mcgavren.com/zyps From lists at ruby-forum.com Tue Jan 29 20:43:13 2008 From: lists at ruby-forum.com (Herman Munster) Date: Wed, 30 Jan 2008 02:43:13 +0100 Subject: [wxruby-users] =?utf-8?q?XRCise_says_=22Cannot_create_wrapper_for?= =?utf-8?q?_subclass_of=09wxWiz?= In-Reply-To: <4738AC46.30505@pressure.to> References: <15339.64.142.64.96.1194834148.squirrel@webmail.sonic.net> <4738AC46.30505@pressure.to> Message-ID: <3993c9319a68d05096d69a3d7498a9b8@ruby-forum.com> Hi Peralta, I use wxFormBuilder v3.0 and had the same error message. But I found the solution. For the topmost element "MyFrame1:Frame" in the object tree I can set the value of a parameter "subclass". By default the value is ";" (probably for C++ use), and when I change it to something like "blabla", it works. Cheers, pink-ink -- Posted via http://www.ruby-forum.com/. From mario at ruby-im.net Wed Jan 30 00:42:49 2008 From: mario at ruby-im.net (Mario Steele) Date: Tue, 29 Jan 2008 23:42:49 -0600 Subject: [wxruby-users] XRCise says "Cannot create wrapper for subclass of wxWiz In-Reply-To: <3993c9319a68d05096d69a3d7498a9b8@ruby-forum.com> References: <15339.64.142.64.96.1194834148.squirrel@webmail.sonic.net> <4738AC46.30505@pressure.to> <3993c9319a68d05096d69a3d7498a9b8@ruby-forum.com> Message-ID: Hello Herman, I also use wxFormBuilder myself, and I ran into the same problem with it. I found this less annoying, as I just put in the class I plan to implement all my methods and such onto the Object in question, and this allows for everything to work when utilizing xrcise. It actually makes it a bit simpler to keep track of what object is what. Heh. L8ers, Mario Steele On 1/29/08, Herman Munster wrote: > > Hi Peralta, > > I use wxFormBuilder v3.0 and had the same error message. > But I found the solution. > For the topmost element "MyFrame1:Frame" in the object tree I can set > the value of a parameter "subclass". > By default the value is ";" (probably for C++ use), and when I change it > to something like "blabla", it works. > > Cheers, > pink-ink > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -- Mario Steele http://www.trilake.net http://www.ruby-im.net http://rubyforge.org/projects/wxruby/ http://rubyforge.org/projects/wxride/ http://rubyforge.org/projects/vwmc/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20080129/a35e5ef0/attachment.html From rvnues at tesco.net Wed Jan 30 07:19:56 2008 From: rvnues at tesco.net (rvnues at tesco.net) Date: Wed, 30 Jan 2008 12:19:56 +0000 Subject: [wxruby-users] libgstreamer, slackware => libgconf.......??? Message-ID: <20080130121956.A8I9S.67184.root@web10-winn.ispmail.private.ntl.com> Hoi, Mario and Alex, Thanks for your ideas and I'll be able to get ahead with them. I dunno whether I am the only sole on linux planet wihout gconf or libgstreamer.... but I used the gem system of installing wxruby, which is a great tool. Of course I can give it a try to compile wxRuby myself (and hopefully not running into other dependencies when omitting Wx::MediaCtrl ) but, by accidentally stumbling on your discussion about modularisation on http://rubyforge.org/pipermail/wxruby-development/2007-June/000790.html , the ideas in here might provide a long-term solution to the problems I encountered. Please do not start changing things for my sake (I was only trying wxRuby out as part of discovering ruby. I've made stuff with Java and am looking for a friendlier programming environment) and probably can get enough done with 1.9.2 before needing to upgrade... Please keep focused on the main direction of wxRuby. rob > The wxRuby 1.9.3 binaries added Wx::MediaCtrl, which requires > libgstreamer on Linux. You can either: > > 1) Fufil this dependency by installing libgstreamer > > or > > 2) Build your own wxRuby. Wx::MediaCtrl is an optional component, and if > you're compiling your own wxRuby and it's not found to be supported, > it'll be skipped without error. > > hth > alex Mario Steele wrote: > gconf, is actually not a gnome library, per say, as it's more generalized storage library, that Gnome popularized. I've seen gconf used in many console apps (As I've recently started messing with SourceMage GNU/Linux, which is a full blown source based distro). > > As for portability, I will talk with alex, to see if we can possibly put up a specialized version of wxruby for linux, that does not have these dependencies, as to reduce dependencies that are not needed. I think OpenGL is another one that may require an additional dependency, but it shouldn't be that large of one, since most Modern Distro's come with OpenGL. > > I will get back with you, and let you know what me and Alex discuss about this problem. > > L8ers, > Mario Steele > > On 1/29/08, rob wrote: > > Hi Mario, > > I did install gstreamer in the end to see what happened and now running of wxruby apps hangs because of the lack of gconf (libgconf-2.so.4) which is a gnome library. > > > /usr/lib/ruby/gems/1.8/gems/wxruby-1.9.4-x86-linux/lib/wxruby2.so: libgconf-2.so.4: > > cannot open shared object file: No such file or directory - > > /usr/lib/ruby/gems/1.8/gems/wxruby-1.9.4-x86-linux/lib/wxruby2.so (LoadError) > > from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' > > ... etc > > I dunno, but the whole thing looks to me as if for the latest wxruby versions suddenly unneeded depencencies have been smuggled in from the build-system that has all this stuff on it. Why does a gui wrapper program needs coupling to a media streaming library or a system to store user-preferences??? ("GStreamer is a library that allows the construction of graphs of media-handling components, ranging from simple Ogg/Vorbis playback to complex audio"), ("GConf is a system for storing application preferences. It is intended for user preferences"). Also nothing of such new dependencies can be found in the ChangeLog (for 1.9.3, the 'oldest' version that does not run properly). I hope one can sort this at the wxruby end. Until then I will have to use 1.9.2, or try the Java libaries (SWT or Swing) via Jruby. > > Cause the question with all these dependencies becomes: how can one really ship a portable application????? > > Thanks for any suggestions, > > rob > From Peter_Ellis at nrel.gov Wed Jan 30 18:43:00 2008 From: Peter_Ellis at nrel.gov (Ellis, Peter) Date: Wed, 30 Jan 2008 16:43:00 -0700 Subject: [wxruby-users] chart extension for wxRuby? In-Reply-To: References: <478C9F46.1030306@pressure.to> Message-ID: Does anyone know of a chart making extension written with wxRuby? I know there are a few Ruby gems out there to make charts (as SVG or an image), but they seem to have a lot of overhead associated with them. The ones I've found that seem most interesting (Gruff, Scruffy, gnuplot) require a big bulky graphics/image processing library to be installed. Seems like wxRuby has all the pieces one would need to make a nice chart API or custom chart widget, although probably without the SVG, which is fine for my purposes. Thanks. From alex at pressure.to Thu Jan 31 02:06:36 2008 From: alex at pressure.to (Alex Fenton) Date: Thu, 31 Jan 2008 07:06:36 +0000 Subject: [wxruby-users] chart extension for wxRuby? In-Reply-To: References: <478C9F46.1030306@pressure.to> Message-ID: <47A1737C.7060602@pressure.to> Ellis, Peter wrote: > Does anyone know of a chart making extension written with wxRuby? I > know there are a few Ruby gems out there to make charts (as SVG or an > image), but they seem to have a lot of overhead associated with them. > The ones I've found that seem most interesting (Gruff, Scruffy, gnuplot) > require a big bulky graphics/image processing library to be installed. > Seems like wxRuby has all the pieces one would need to make a nice chart > API or custom chart widget, Yes, all the pieces should be there. There are several charting libraries written in C++ for wxWidgets which might offer a good starting point [1] Basically, you use a DC (DeviceContext) to draw lines, polygons, ellipses, text etc. DC can draw images from files and do textured fills. Wx::Grid would be an excellent component for editing and viewing the source data points. The target canvas can be either the screen (using Window#paint to create a PaintDC), or a bitmap (using Bitmap#draw to create a MemoryDC). The same actual drawing code is used regardless of the target. Once the drawing's been done on a bitmap, call Bitmap.save_file to save the image to a variety of formats, including BMP, PNG, TIF or JPG. For higher-quality output there's also GraphicsContext, which can be created by calling GraphicsDC.create(dc) from any other DC. This will give anti-aliased edges and also offers gradient fills but is otherwise very similar. > although probably without the SVG, which is fine for my purposes. > There's an SVG-writer as an optional contrib-module in the main wxWidgets tree, which allows DC drawing code to be output as SVG. This isn't currently porrted to wxRuby, but if there's interest we could have a look at adding it. In my day job I do a lot of charting in Excel and SPSS so I'd be interested to hear how it goes if you decide to pursue this. cheers alex [1] http://wxcode.sourceforge.net/complist.php?compperpage=1000&viewmode=full&browseby=category§ion=graphics&page=1 From alex at pressure.to Thu Jan 31 02:17:51 2008 From: alex at pressure.to (Alex Fenton) Date: Thu, 31 Jan 2008 07:17:51 +0000 Subject: [wxruby-users] libgstreamer, slackware => libgconf.......??? In-Reply-To: <20080130121956.A8I9S.67184.root@web10-winn.ispmail.private.ntl.com> References: <20080130121956.A8I9S.67184.root@web10-winn.ispmail.private.ntl.com> Message-ID: <47A1761F.1070700@pressure.to> rvnues at tesco.net wrote: > I dunno whether I am the only sole on linux planet wihout gconf or libgstreamer.... You're certainly not the only one. It's not installed by default on Ubuntu, although straightforward with the package manager. > by accidentally stumbling on your discussion about modularisation on http://rubyforge.org/pipermail/wxruby-development/2007-June/000790.html , the ideas in here might provide a long-term solution to the problems I encountered. > I got a proof of concept working last night making one trivial class (ToggleButton) a separately loaded compiled feature. It's definitely do-able, but would require a substantial restructure which I'm not sure we're up for doing right now. > Mario Steele wrote: > >> As for portability, I will talk with alex, to see if we can possibly put up a specialized version of wxruby for linux, that does not have these dependencies, as to reduce dependencies that are not needed. I think this is a real concern. On the one hand, we want a consistent set of features across the binaries for different platforms. One the other, we want easy installation everywhere. It might be worth looking again at wxruby-lite as an interim which would be smaller and have no external dependencies anywhere. alex From Peter_Ellis at nrel.gov Thu Jan 31 13:13:09 2008 From: Peter_Ellis at nrel.gov (Ellis, Peter) Date: Thu, 31 Jan 2008 11:13:09 -0700 Subject: [wxruby-users] chart extension for wxRuby? In-Reply-To: <47A1737C.7060602@pressure.to> References: <478C9F46.1030306@pressure.to> <47A1737C.7060602@pressure.to> Message-ID: Thanks, Alex. I was hoping that we wouldn't have to create our own, but we might do it if that turns out to be the best solution. I'll keep the list posted. I did find this project, but it looks dead. http://rubyforge.org/projects/wxryplot/ http://files.rubyforge.vm.bytemark.co.uk/wxryplot/WxRyPlot.doc P -----Original Message----- From: wxruby-users-bounces at rubyforge.org [mailto:wxruby-users-bounces at rubyforge.org] On Behalf Of Alex Fenton Sent: Thursday, January 31, 2008 12:07 AM To: General discussion of wxRuby Subject: Re: [wxruby-users] chart extension for wxRuby? Ellis, Peter wrote: > Does anyone know of a chart making extension written with wxRuby? I > know there are a few Ruby gems out there to make charts (as SVG or an > image), but they seem to have a lot of overhead associated with them. > The ones I've found that seem most interesting (Gruff, Scruffy, gnuplot) > require a big bulky graphics/image processing library to be installed. > Seems like wxRuby has all the pieces one would need to make a nice chart > API or custom chart widget, Yes, all the pieces should be there. There are several charting libraries written in C++ for wxWidgets which might offer a good starting point [1] Basically, you use a DC (DeviceContext) to draw lines, polygons, ellipses, text etc. DC can draw images from files and do textured fills. Wx::Grid would be an excellent component for editing and viewing the source data points. The target canvas can be either the screen (using Window#paint to create a PaintDC), or a bitmap (using Bitmap#draw to create a MemoryDC). The same actual drawing code is used regardless of the target. Once the drawing's been done on a bitmap, call Bitmap.save_file to save the image to a variety of formats, including BMP, PNG, TIF or JPG. For higher-quality output there's also GraphicsContext, which can be created by calling GraphicsDC.create(dc) from any other DC. This will give anti-aliased edges and also offers gradient fills but is otherwise very similar. > although probably without the SVG, which is fine for my purposes. > There's an SVG-writer as an optional contrib-module in the main wxWidgets tree, which allows DC drawing code to be output as SVG. This isn't currently porrted to wxRuby, but if there's interest we could have a look at adding it. In my day job I do a lot of charting in Excel and SPSS so I'd be interested to hear how it goes if you decide to pursue this. cheers alex [1] http://wxcode.sourceforge.net/complist.php?compperpage=1000&viewmode=ful l&browseby=category§ion=graphics&page=1 _______________________________________________ wxruby-users mailing list wxruby-users at rubyforge.org http://rubyforge.org/mailman/listinfo/wxruby-users From alex at pressure.to Thu Jan 31 14:41:58 2008 From: alex at pressure.to (Alex Fenton) Date: Thu, 31 Jan 2008 19:41:58 +0000 Subject: [wxruby-users] chart extension for wxRuby? In-Reply-To: References: <478C9F46.1030306@pressure.to> <47A1737C.7060602@pressure.to> Message-ID: <47A22486.3080303@pressure.to> Ellis, Peter wrote: > Thanks, Alex. > > I was hoping that we wouldn't have to create our own, but we might do it > if that turns out to be the best solution. I'll keep the list posted. > Following your earlier message I had a closer look at Scruffy and Gruff. Scruffy has the drawing code very nicely separated from the logic that organises the chart elements. So in about 20 mins I was able to replace enough of the svg-based drawing code with dc-based code to get it to draw the chart background, title, frame, axis and labels in a Wx::Window (see below for the app code) It's a fairly mechanical job of replacing calls to svg.text with dc.draw_text, svg.line with dc.draw_line etc in scruffy/components and scruffy/layers. I'm sure the individual chart types would need a little more work, but each is still only a couple of calls to the same basic methods. I would recommend looking into it. hth alex __ require 'scruffy' require 'wx' class Chart < Wx::Window attr_reader :graph def initialize(*args) super evt_paint :on_paint @graph = Scruffy::Graph.new(:title => "Monthly Profits") graph.add(:line, 'John', [100, -20, 30, 60]) graph.add(:line, 'Sara', [120, 50, -80, 20]) end def on_paint paint do | dc | graph.render(dc, :width => size.width, :height => size.height) end end end Wx::App.run do frame = Wx::Frame.new(nil, :title => 'chart demo') chart = Chart.new(frame) frame.show end From Peter_Ellis at nrel.gov Thu Jan 31 14:47:04 2008 From: Peter_Ellis at nrel.gov (Ellis, Peter) Date: Thu, 31 Jan 2008 12:47:04 -0700 Subject: [wxruby-users] chart extension for wxRuby? In-Reply-To: <47A22486.3080303@pressure.to> References: <478C9F46.1030306@pressure.to> <47A1737C.7060602@pressure.to> <47A22486.3080303@pressure.to> Message-ID: That's fantastic! I'll definitely took a closer look at this. P -----Original Message----- From: wxruby-users-bounces at rubyforge.org [mailto:wxruby-users-bounces at rubyforge.org] On Behalf Of Alex Fenton Sent: Thursday, January 31, 2008 12:42 PM To: General discussion of wxRuby Subject: Re: [wxruby-users] chart extension for wxRuby? Ellis, Peter wrote: > Thanks, Alex. > > I was hoping that we wouldn't have to create our own, but we might do it > if that turns out to be the best solution. I'll keep the list posted. > Following your earlier message I had a closer look at Scruffy and Gruff. Scruffy has the drawing code very nicely separated from the logic that organises the chart elements. So in about 20 mins I was able to replace enough of the svg-based drawing code with dc-based code to get it to draw the chart background, title, frame, axis and labels in a Wx::Window (see below for the app code) It's a fairly mechanical job of replacing calls to svg.text with dc.draw_text, svg.line with dc.draw_line etc in scruffy/components and scruffy/layers. I'm sure the individual chart types would need a little more work, but each is still only a couple of calls to the same basic methods. I would recommend looking into it. hth alex __ require 'scruffy' require 'wx' class Chart < Wx::Window attr_reader :graph def initialize(*args) super evt_paint :on_paint @graph = Scruffy::Graph.new(:title => "Monthly Profits") graph.add(:line, 'John', [100, -20, 30, 60]) graph.add(:line, 'Sara', [120, 50, -80, 20]) end def on_paint paint do | dc | graph.render(dc, :width => size.width, :height => size.height) end end end Wx::App.run do frame = Wx::Frame.new(nil, :title => 'chart demo') chart = Chart.new(frame) frame.show end _______________________________________________ wxruby-users mailing list wxruby-users at rubyforge.org http://rubyforge.org/mailman/listinfo/wxruby-users From lists at ruby-forum.com Thu Jan 31 15:48:32 2008 From: lists at ruby-forum.com (Dan Teitsort) Date: Thu, 31 Jan 2008 21:48:32 +0100 Subject: [wxruby-users] Question about WxNotebook, threads, and GUI refreshing In-Reply-To: <478E882D.3070204@pressure.to> References: <478E33A0.2070809@ohio.edu> <478E882D.3070204@pressure.to> Message-ID: If you are running 1.8.6, make sure you have patch level 36 or later. There were some thread-related defects fixed at p36. -- Posted via http://www.ruby-forum.com/. From rvnues at tesco.net Thu Jan 31 18:12:36 2008 From: rvnues at tesco.net (rvnues at tesco.net) Date: Thu, 31 Jan 2008 23:12:36 +0000 Subject: [wxruby-users] libgstreamer, slackware => libgconf.......??? Message-ID: <20080131231236.PTH6C.213176.root@web11-winn.ispmail.private.ntl.com> Hi Mario, I tried to persevere a bit, i.e. tried to compile gconf .... Slackware does support a couple of libraries linked to the gtk/gnome-world but not officially: I found install scripts for GCconf and Orbit2 on Slackbuilds.org but after having these bits in my system I ran (with irb: require 'rubygems' => ok; require 'wx' => error) into lacking dependency libgstinterfaces-0.10.... which I hope is part of the gst-plugins-base but I could not get that one compiled without liboil...... all done now... o.k. last test before I walk my dog: cd /usr/lib/ruby/gems/1.8/gems/wxruby-1.9.4-x86-linux/samples/bigdemo ruby bigdemo.rb It runs ! And of course I found something odd... using sizers and clicking on the close button of the gtk-window (thus not via a button within the wxwidgets frame) the program crashes with: (wxruby:12285): Gtk-CRITICAL **: gtk_window_realize_icon: assertion `info->icon_pixmap == NULL' failed bigdemo.rb:438: [BUG] Segmentation fault ruby 1.8.6 (2007-09-24) [i486-linux] Anyway, so far so good. Now I have to see whether with a minimal gstreamer install I can get this stuff done as well...... so required dependencies (for slackware pre12.1): ORBit2 GCconf gstreamer (libgstreamer) liboil gst-plugins-base rob