From lists at ruby-forum.com Fri Jan 2 12:39:19 2009 From: lists at ruby-forum.com (Ridge Mcghee) Date: Fri, 2 Jan 2009 18:39:19 +0100 Subject: [wxruby-users] wxruby 1.9.9 menu - strange corruption Message-ID: <87371d6a91dcc77fd60f5dd4f7fd7f27@ruby-forum.com> Environment: Windows XP Pro + SP3 ruby (1.8.6) wxruby (1.9.9) Please see attached code (smallest code to reproduce). I'd like to know if others can reproduce this problem. I completely removed and then re-installed ruby and wxruby and was able to reproduce. I'm subclassing menus to add an extra tag. However, after some repeated menu use, the menu item becomes corrupted. The more menu items there are, the more quickly the menu item becomes corrupted. It appears (speculation) that a garbage collector or some memory reclamation code is at work that reallocates the MyMenuItem and transforms it into a MenuItem. Anybody able to reproduce? Attachments: http://www.ruby-forum.com/attachment/3119/test.rb -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Sat Jan 3 19:23:14 2009 From: alex at pressure.to (Alex Fenton) Date: Sun, 04 Jan 2009 00:23:14 +0000 Subject: [wxruby-users] wxruby 1.9.9 menu - strange corruption In-Reply-To: <87371d6a91dcc77fd60f5dd4f7fd7f27@ruby-forum.com> References: <87371d6a91dcc77fd60f5dd4f7fd7f27@ruby-forum.com> Message-ID: <49600172.8010607@pressure.to> Hi Ridge Mcghee wrote: > I'm subclassing menus to add an extra tag. > However, after some repeated menu use, the menu > item becomes corrupted. The more menu items > there are, the more quickly the menu item becomes > corrupted. > > It appears (speculation) that a garbage collector > or some memory reclamation code is at work that > reallocates the MyMenuItem and transforms it into > a MenuItem. Hopefully I can explain. You're right that it's to do with garbage collection. When Ruby's GC runs, there's no reference anywhere to the MyMenuItems, so they're swept away and the ruby object is deleted. Next time find_item is called, there is no Ruby object matching the found MenuItem, so it is re-wrapped as an ordinary MenuItem. This is expected behaviour - "info" type objects such as MenuItem are not preserved. I'll have a look whether there is a way to change this without causing crashes or leaking memory, but I would suggest that you find an alternate way round this: 1) Keep a reference (eg in an Array or Hash as a member of MyMenu) to each menu item, perhaps setting this up as part of the addEntry method of MyMenu. This will preserve the items from GC. 2) Override MyMenu#find_item to return a MyMenuItem, rather than an ordinary MenuItem. hth alex From lists at ruby-forum.com Sun Jan 4 18:22:30 2009 From: lists at ruby-forum.com (Ridge Mcghee) Date: Mon, 5 Jan 2009 00:22:30 +0100 Subject: [wxruby-users] wxruby 1.9.9 menu - strange corruption In-Reply-To: <49600172.8010607@pressure.to> References: <87371d6a91dcc77fd60f5dd4f7fd7f27@ruby-forum.com> <49600172.8010607@pressure.to> Message-ID: <4c1ab821ae10e8b0c5e2a7462007956c@ruby-forum.com> Alex Fenton wrote: > Hi > > Ridge Mcghee wrote: >> I'm subclassing menus to add an extra tag. >> However, after some repeated menu use, the menu >> item becomes corrupted. The more menu items >> there are, the more quickly the menu item becomes >> corrupted. >> >> It appears (speculation) that a garbage collector >> or some memory reclamation code is at work that >> reallocates the MyMenuItem and transforms it into >> a MenuItem. > > Hopefully I can explain. You're right that it's to do with garbage > collection. When Ruby's GC runs, there's no reference anywhere to the > MyMenuItems, so they're swept away and the ruby object is deleted. Next > time find_item is called, there is no Ruby object matching the found > MenuItem, so it is re-wrapped as an ordinary MenuItem. > > This is expected behaviour - "info" type objects such as MenuItem are > not preserved. I'll have a look whether there is a way to change this > without causing crashes or leaking memory, but I would suggest that you > find an alternate way round this: > > 1) Keep a reference (eg in an Array or Hash as a member of MyMenu) to > each menu item, perhaps setting this up as part of the addEntry method > of MyMenu. This will preserve the items from GC. > > 2) Override MyMenu#find_item to return a MyMenuItem, rather than an > ordinary MenuItem. > > hth > alex Thanks for your response. Good suggestion (1) and that is actually what I did to move forward. However, I consider it a work-around. I welcome your explanations because I want to understand. Here's my view: As a developer, I don't want just the "native" superclass to work properly with the GC. I want my sub-classes to work properly, too. (e.g., my sub-class should inherit the reference count or whatever to make it a fully-qualified class, huh?) If I understood your message, the GC is making decisions based on the type (MenuItem). Isn't this just what an object-oriented system should *not* do? Some questions: Is this a generic ruby issue (or is it unique to wxruby)? What triggers the GC ? (While testing, I found that the "rewrapping" occurred whether or not I called find_item. Just repeatedly selecting the MyMenuItem, which triggered a menu_event and caused on_menu_event to be called, would result in the MyMenuItem being "rewrapped" as a MenuItem. As such, over-riding MyMenu#find_item would not be expected to solve the problem.) I appreciate your offer to "have a look" and I'd be interested to know whatever you find out. Cheers, Ridge -- Posted via http://www.ruby-forum.com/. From mario at ruby-im.net Sun Jan 4 23:36:16 2009 From: mario at ruby-im.net (Mario Steele) Date: Sun, 4 Jan 2009 22:36:16 -0600 Subject: [wxruby-users] wxruby 1.9.9 menu - strange corruption In-Reply-To: <4c1ab821ae10e8b0c5e2a7462007956c@ruby-forum.com> References: <87371d6a91dcc77fd60f5dd4f7fd7f27@ruby-forum.com> <49600172.8010607@pressure.to> <4c1ab821ae10e8b0c5e2a7462007956c@ruby-forum.com> Message-ID: Hello Ridge, Let me explain this a bit further in detail as to the process the Garbage Collector, and wxRuby's own classes work about things. On Sun, Jan 4, 2009 at 5:22 PM, Ridge Mcghee wrote: > Thanks for your response. > > Good suggestion (1) and that is actually what I did to move forward. > However, I consider it a work-around. I welcome your explanations > because I want to understand. > > Here's my view: > As a developer, I don't want just the "native" superclass to work > properly with the GC. I want my sub-classes to work properly, too. > (e.g., my sub-class should inherit the reference count or whatever > to make it a fully-qualified class, huh?) If I understood your > message, the GC is making decisions based on the type (MenuItem). > Isn't this just what an object-oriented system should *not* do? What Alex was trying to explain here, is that some classes, such as Menu, MenuItem, Rect, Point, and various other ones, are considered Information Classes. Information classes only hold the information of what is relevent at the point and time of the execution of the code. To make it a bit more clearer to understand, let's take the problem of MenuItem. Imagine that MenuItem is a Ruby Struct class. Defining it as such: MenuItem = Struct.new(:title,:id,:parent,:bitmap) my_new_menu_item = MenuItem.new("&Open",Wx::ID_OPEN,my_file_menu,Wx::ICON_FOLDER) This is a silly mockup of what I'm trying to explain, but this is what it boils down to. Once you actually create the control, there's no further need to reference this control, till something happens with it, such as evt_menu(Wx::ID_OPEN), this is where we re-retrive the actual wxRuby control, for any association needed to do special things, such as changing the title of the Menu item. There is no other things you can really do with a MenuItem, aside from either updating it, or deleting it. Atleast, as far as wxWidgets is concerned. Therefore, if you don't store the instance of the MenuItem in a variable, where the Garbage Collector can see that it is still being referenced within your code, Ruby thinks that it is no longer needed, and therefore frees it up for others to use. Some questions: > Is this a generic ruby issue (or is it unique to wxruby)? This is a unique problem with wxRuby. It's mainly a decision of what we need to continue to keep tracking, without tracking every single object created. What triggers the GC ? (While testing, I found that the "rewrapping" > occurred whether or not I called find_item. Just repeatedly > selecting > the MyMenuItem, which triggered a menu_event and caused on_menu_event > to be called, would result in the MyMenuItem being "rewrapped" as a > MenuItem. As such, over-riding MyMenu#find_item would not be > expected > to solve the problem.) Garbage Collection, especially in a wxRuby app, happens quite often, as there are many times that a Ruby object is temporarly created, to associate it with a wxWidget's object. And 9 times out of 10, it's a temporary reference, which is immediately de-referenced within the code, and when Garbage Collection runs again, it'll delete this instance. However, in the particular instance of Menu Event (evt_menu), there is no particular reference to review to say, Oh, this needs to be referenced by previous instance creation. I appreciate your offer to "have a look" and I'd be interested to > know whatever you find out. Unfortunately, in this case, the procedure that Alex has referenced, would be the best way, as it would be nearly neigh improbable to track every single custom class creation, between wxWidgets and wxRuby. As with wxWidgets, there's nothing to allow us to track custom classes created in Ruby of wxWidgets classes, least we create a new memory structure, that would inherit from one of our classes. It may be doable, in the Ruby level, at the actual Ruby level itself, but not on the C++ Side. Cheers, > Ridge > > > -- > 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/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Mon Jan 5 04:06:33 2009 From: lists at ruby-forum.com (Ridge Mcghee) Date: Mon, 5 Jan 2009 10:06:33 +0100 Subject: [wxruby-users] wxruby 1.9.9 menu - strange corruption In-Reply-To: References: <87371d6a91dcc77fd60f5dd4f7fd7f27@ruby-forum.com> <49600172.8010607@pressure.to> <4c1ab821ae10e8b0c5e2a7462007956c@ruby-forum.com> Message-ID: <010993a637d0eb2a56713c69f1846edd@ruby-forum.com> Mario Steele wrote: > Hello Ridge, Hi Mario, Thanks for joining the discussion. Hopefully, we can have some significant mindshare. > Let me explain this a bit further in detail as to the process the > Garbage > Collector, and wxRuby's own classes work about things. > > On Sun, Jan 4, 2009 at 5:22 PM, Ridge Mcghee > wrote: > >> to make it a fully-qualified class, huh?) If I understood your >> message, the GC is making decisions based on the type (MenuItem). >> Isn't this just what an object-oriented system should *not* do? > > > What Alex was trying to explain here, is that some classes, such as > Menu, > MenuItem, Rect, Point, and various other ones, are considered > Information > Classes. Information classes only hold the information of what is > relevent > at the point and time of the execution of the code. To make it a bit > more > clearer to understand, let's take the problem of MenuItem. Imagine that > MenuItem is a Ruby Struct class. > > Defining it as such: > > MenuItem = Struct.new(:title,:id,:parent,:bitmap) > > my_new_menu_item = > MenuItem.new("&Open",Wx::ID_OPEN,my_file_menu,Wx::ICON_FOLDER) > > This is a silly mockup of what I'm trying to explain, but this is what > it > boils down to. Once you actually create the control, there's no further > need to reference this control, till something happens with it, such as > evt_menu(Wx::ID_OPEN), this is where we re-retrive the actual wxRuby > control, for any association needed to do special things, such as > changing > the title of the Menu item. There is no other things you can really do > with > a MenuItem, aside from either updating it, or deleting it. Atleast, as > far > as wxWidgets is concerned. Therefore, if you don't store the instance > of > the MenuItem in a variable, where the Garbage Collector can see that it > is > still being referenced within your code, Ruby thinks that it is no > longer > needed, and therefore frees it up for others to use. Your explanation is clear and I appreciate your effort to make it so. I'm hoping I can be as clear. I understand your perspective but respectfully disagree with your assertion: "There is no other things you can really do with a MenuItem, aside from either updating it, or deleting it." One of the hallmarks and most powerful aspects of an object-oriented language is that new developers are able to extend the capabilities of existing classes via subclassing (in ways that the class originators didn't necessarily anticipate). By constraining classes in arbitrary ways (IMHO), that power is severely limited. I do understand (I think) your desire to free up memory that is not being used. However, there are already mechanisms in place: scoping rules and delete. Please help me understand why these mechanisms are not sufficient in this case. If you are providing extra GC as a convenience, then I respectfully submit that the developer should be permitted to accept or reject that convenience so that his/her code will behave as expected. By forcing extra GC upon the developer for certain classes that are considered "information classes" by the originators, the code (originally attached) behaves in a most unexpected way: On (approximately) the 25th time a class instance is used (in this case a menu appears), the (subclassed) menu items suddenly lose their identity and instead assume the identity of their superclass. Until I have the opportunity to understand your perspective more fully, I respectfully assert: Class instantiations should maintain their existence and identity until they move out of scope or until they are expressly deleted. > Some questions: >> Is this a generic ruby issue (or is it unique to wxruby)? > > > This is a unique problem with wxRuby. It's mainly a decision of what we > need to continue to keep tracking, without tracking every single object > created. I appreciate your candidness. I'm hoping we can find a way for wxruby to be more ruby-ish. > What triggers the GC ? (While testing, I found that the "rewrapping" >> occurred whether or not I called find_item. Just repeatedly >> selecting >> the MyMenuItem, which triggered a menu_event and caused on_menu_event >> to be called, would result in the MyMenuItem being "rewrapped" as a >> MenuItem. As such, over-riding MyMenu#find_item would not be >> expected >> to solve the problem.) > > Garbage Collection, especially in a wxRuby app, happens quite often, as > there are many times that a Ruby object is temporarly created, to > associate > it with a wxWidget's object. And 9 times out of 10, it's a temporary > reference, which is immediately de-referenced within the code, and when > Garbage Collection runs again, it'll delete this instance. However, in > the > particular instance of Menu Event (evt_menu), there is no particular > reference to review to say, Oh, this needs to be referenced by previous > instance creation. I understand your point that object creation is often temporary and that, with regard to Menu events, there is some difficulty in knowing what is a temporary instantiation and what is not. However, again I respectfully submit that it seems ill-advised to use probability as a solution without offering an alternative. > Unfortunately, in this case, the procedure that Alex has referenced, > would > be the best way, as it would be nearly neigh improbable to track every > single custom class creation, between wxWidgets and wxRuby. As with > wxWidgets, there's nothing to allow us to track custom classes created > in > Ruby of wxWidgets classes, least we create a new memory structure, that > would inherit from one of our classes. It may be doable, in the Ruby > level, > at the actual Ruby level itself, but not on the C++ Side. Thank you for your trying to educate me about wxruby and for offering work-arounds that I can put in my code. I am not sure at this point why you seem so concerned about "tracking every custom class creation" when, in both C++ and ruby, subclassing is such a fundamental part of the language. There are already mechanisms available to the developer to handle memory bloat (scoping rules and express deletion of unneeded instantiations). I am very happy that you folks are working hard to support wxruby. wxruby seems to be a comprehensive, cross-platform GUI toolkit that could meet my needs. I respect your willingness to discuss issues such as the present one. I also respect your willingness to explain why you have made the decisions you have made. I hope you can also understand my surprise to be faced with such an unexpected problem on the first day of wxruby development. I want to believe that there is a solution that will meet the needs of all developers. At the risk of sounding bold, would you consider supporting the following: "wxruby fully supports subclassing, respecting scoping rules to handle object persistence. However, developers should be advised that they can unwittingly consume memory resources if they do not properly manage their objects, specifically if they do not delete objects when they are no longer needed. We have learned this through bitter experience. "Since object management can be a daunting and tedious task for the developer, wxruby provides a super-cool garbage collection facility that can automatically delete objects that are no longer referenced, significantly reducing runtime memory usage. When creating your application, simply set supercool_gc to true, as in the following example: class MyApp < App def on_init @supercool_gc = true end end "The following classes are considered 'information classes' and will be specifically targeted by the GC: Menu MenuItem (any others) "If you subclass any of the information classes, please note that you may need to disable supercool_gc for those classes." At this point, I'm concerned that I will find other instances in which the GC will impede my development progress. But I hoping this will not be the case. It may be that the problem is limited to menu items and that the GC works beautifully in all other cases. In that case, developers would want to take advantage of the GC and would alternatively perfer to have a specific @supercool_menuitem_gc flag so that they could manage their menuitems independently but have the GC manage the rest of the objects. Or, perhaps there should be a flag for each "information class". I'm hoping we can sort this out. As noted, since I'm a wxruby newbie, I welcome further explanations to help me understand why the GC must behave as it does. I would very much like wxruby to succeed. > Cheers, Ridge -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Mon Jan 5 06:31:49 2009 From: alex at pressure.to (Alex Fenton) Date: Mon, 05 Jan 2009 11:31:49 +0000 Subject: [wxruby-users] wxruby 1.9.9 menu - strange corruption In-Reply-To: <4c1ab821ae10e8b0c5e2a7462007956c@ruby-forum.com> References: <87371d6a91dcc77fd60f5dd4f7fd7f27@ruby-forum.com> <49600172.8010607@pressure.to> <4c1ab821ae10e8b0c5e2a7462007956c@ruby-forum.com> Message-ID: <4961EFA5.3060403@pressure.to> Hi Ridge Ridge Mcghee wrote: > Good suggestion (1) and that is actually what I did to move forward. > Glad that worked, and also thanks for spotting this and bringing it up. > However, I consider it a work-around. I welcome your explanations > because I want to understand. > > Here's my view: > As a developer, I don't want just the "native" superclass to work > properly with the GC. I want my sub-classes to work properly, too. > > I understand that, and indeed most classes where you'd want that should already do that. First up I'll say that having seen your example, I agree that MenuItem should work correctly - ie that a custom subclass should be maintained. As you'll have realised wxRuby is a big library with 200+ classes, and for each of them we have to select a memory management strategy. It needs 1) to be safe - ie it won't crash under any various circumstance it's used 2) to be efficient - it won't leak memory, or unnecessarily slow the library (for example, GNOME2 can suffer pauses due to GC, which limits its usefulessness for real-time drawing apps) 3) to work well with Ruby's dynamic object model 4) to work OK with wxWidgets C++ object ownership and memory management The current implementation does 1, 2 and 4 but not 3 - I simply hadn't foreseen the use-case demonstrated by your sample. > I appreciate your offer to "have a look" and I'd be interested to > know whatever you find out. Over the weekend I made a change to my working tree. The result of this patch would be that MenuItems, once added to a Menu, would have the original object preserved. This would resolve your issue. Historically Menus and MenuItems have been among the most problematic for GC, so it's moderately high-risk. I'm going to test it further for a few days, then commit, then we can give it some further working out on all platforms. Since you're on Windows I'm guessing you don't have the compiler infrastructure, in which case it'll be available for the next 2.0 release. best alex From alex at pressure.to Mon Jan 5 06:57:55 2009 From: alex at pressure.to (Alex Fenton) Date: Mon, 05 Jan 2009 11:57:55 +0000 Subject: [wxruby-users] wxruby 1.9.9 menu - strange corruption In-Reply-To: <010993a637d0eb2a56713c69f1846edd@ruby-forum.com> References: <87371d6a91dcc77fd60f5dd4f7fd7f27@ruby-forum.com> <49600172.8010607@pressure.to> <4c1ab821ae10e8b0c5e2a7462007956c@ruby-forum.com> <010993a637d0eb2a56713c69f1846edd@ruby-forum.com> Message-ID: <4961F5C3.1070306@pressure.to> Hi Ridge/Mario Just read through the discussion, and think you're both making sense. Ridge, the OO philosophy which you describe is that which I've had in mind developing wxRuby, and I believe we already follow in large part. This is just an implementation issue of an unforeseen use case for a particular class, which hopefully we've resolved for the next release. Ridge Mcghee wrote: >> What Alex was trying to explain here, is that some classes, such as >> Menu, >> MenuItem, Rect, Point, and various other ones, are considered >> Information >> Classes. Information classes only hold the information of what is >> relevent >> at the point and time of the execution of the code. To make it a bit >> more >> clearer to understand, let's take the problem of MenuItem. Imagine that >> MenuItem is a Ruby Struct class. Just to add to Mario's comment - indeed Size/Rect/Point are always going to be 'info' classes and not have information added to them. This is probably clearer if you think of how they work window.size = Size.new(100, 50) # user uses application, including resizing window to 200 x 600 size = window.size # Size is now [200, 600] In this case it's a moot point whether it's the 'same' size object, as its properties (size, width) are inherent to its identity. And in reality, wxWidgets doesn't think it is, so we couldn't return a same MySize object in Ruby. I think the need arises where one could sensibly want to add member data (ie instance variables) in a subclass. Your example demonstrated this for MenuItem, and I think it's already covered for other classes. Indeed, I went through hoops to get this working right for some difficult cases (eg custom Event objects). > Class instantiations should maintain their existence and identity > until they move out of scope or until they are expressly deleted. > Yep, so far as the tools we have available (wxWidgets, Ruby's GC API, SWIG etc) permit. >>> Is this a generic ruby issue (or is it unique to wxruby)? It's an issue which any Ruby C extension library faces: how to make C/C++'s explicit alloc/free memory management interact smoothly with Ruby's GC, whilst supporting Ruby's highly dynamic OO scheme. It's a particularly acute problem for long-running (eg GUI or server) libraries. As an aside, it's also one reason that Ruby itself is a difficult language to implement efficiently - see the initial slowness of most early implementations. >> What triggers the GC ? Ruby's GC runs whenever the size of allocated objects has reached a certain maximum heap size, and ruby is asked to allocate a new object. So from a programmer's point of view, it's not determined, although GC.start can be used to invoke GC explicitly. > At this point, I'm concerned that I will find other > instances in which the GC will impede my development > progress. But I hoping this will not be the case. It > may be that the problem is limited to menu items and > that the GC works beautifully in all other cases. I believe this is the case. As Mario's mentioned, there are other classes which work like MenuItem (currently) works but I don't think they will impede your progress. Although technically a 'beta' release, 1.9.9 has a few years history behind it, and is one of the most widely-used GUI libraries. alex From alex at pressure.to Mon Jan 5 13:59:38 2009 From: alex at pressure.to (Alex Fenton) Date: Mon, 05 Jan 2009 18:59:38 +0000 Subject: [wxruby-users] How to use evt_update_ui (wrt RichTextCtrl ?) In-Reply-To: References: Message-ID: <4962589A.7060803@pressure.to> Hi Chauk-Mean I'm glad you asked about evt_update_ui. It's a really useful technique for changing the state of menu items, toolbars, controls etc as the application changes state. It's saved me a lot of time since I figured it out a while back, so I'm copying this to wxruby-users so others know about it. Attached is a complete 50-line sample which shows how to use evt_update_ui. A description below, which roughly approximates the attached code. Chauk-Mean P wrote: > The problem I have is I don't know how to update automatically the > state of each formatting button according to the position of the > caret. > The C++ sample rely on EVT_UPDATE_UI. I tried to use evt_update_ui > without success. The short answer is that you call methods (eg enable, check) on the UpdateUIEvent passed into the evt_update_ui handler. Let's say you have an application with a simple frame, containing a text field and a checkbox. It also has a menu. The text field can be in 'editing' or 'readonly' mode, and this is controlled by checking or unchecking the text box. The frame has an "Edit" menu, with an item called 'Toggle Case' which sets all the text in the control to uppercase or lowercase. However this menu option should only be enabled when the text field is in 'editing' mode. The obvious way to do this is to add something to the event handler for the toggle button, to enable or disable the menu item accordingly: evt_checkbox(my_cbx) do | event | # First, find the relevant item from the "Edit" menu case_menu_item = menu_bar.find_item("Edit", "Toggle Case") if event.checked? # if the checkbox was checked to enable editing menu_bar.enable(case_menu_item, true) else menu_bar.enable(case_menu_item, false) end end This works ok, but gets messy as the number of items increases. You have to remember to update all the relevant items in the checkbox event. You also have to worry about setting the initial state of the menu item correctly. How evt_update_ui works is to be called continuously to update the state (eg enabled/disabled) of a UI item, eg the menu item. The important bit: changes are effected by calling methods on the UpdateUIEvent object passed into this event handler. For the example above, to disable/enable the menu item depending on whether the checkbox is checked: evt_update_ui(case_menu_item) do | event | if my_cbox.checked? event.enable(true) else event.enable(false) end end Slightly less code, though the biggest advantage for this simple example is keeping the UI management of the menu item close to the item itself, rather than in the checkbox code, which may be a long way away. It's even better when you have, for example, both a menu item and a checkbox on-screen item which do the same thing, toggle the 'Edit' mode on and off. Then you can use evt_update_ui to make sure that both items are always in the correct checked state however the user chooses to change into editing mode: # Show the item as checked or unchecked depending on whether in edit_mode evt_update_ui(case_menu_item) do | event | event.check(@edit_mode) end # Toggle edit_mode on or off according to whether the menu item is checked evt_menu(case_menu_item) do | event | @edit_mode = event.checked? end Repeat this code for the checkbox button, or, even better, give the checkbox button and the menu item the same id, then the code will work for both with no extra work. Happiness: simple and reliable code. > I'm trying to create a very simple RichTextCtrl sample based on the C++ version. > This works pretty well now with the fixes for missing > RichTextCtrl.selection_bold? ... methods. > See the attached script. > Given the formatting buttons (bold, italics, underlined), I can type > text with the proper formatting, select some text and apply a > formatting later ... A sample for RichTextCtrl would be very cool, thanks. Did you mean to attach some code with this? cheers alex -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: update_ui_event.rb URL: From alex at pressure.to Mon Jan 5 14:30:05 2009 From: alex at pressure.to (Alex Fenton) Date: Mon, 05 Jan 2009 19:30:05 +0000 Subject: [wxruby-users] ruby19-linux gem : AVAILABLE In-Reply-To: <4949258B.1020506@pressure.to> References: <4947B5ED.3020407@pressure.to> <4947CDD1.1020700@pressure.to> <4948452C.3020100@pressure.to> <376324F6-A003-494B-B08C-71824BE3C3D2@malkier.net> <4949258B.1020506@pressure.to> Message-ID: <49625FBD.8040808@pressure.to> Hi Eric Alex Fenton wrote: > Eric Will wrote: >>>> On a similar note, I get "undefined symbol: rb_intern2" when I try >>>> to use the 'wxruby-ruby19' gem. Using the regular 'wxruby' gem >>>> causes it to core as soon as I load it. >>> >>> Which platform & ruby version are you using please? >> >> 1.9.0 on Linux-2.6.27. I've created a test gem for Ruby-1.9 on Linux. Because Ruby-1.9 and SWIG have both moved on since wxRuby 1.9.9 was released, I've have to build it against HEAD, and called it '1.9.10'. However it's a development snapshot so usual cautions apply. I don't propose to do a 1.9.10 release through Rubyforge, so it's available for download only via the website: http://wxruby.rubyforge.org/prerelease/wxruby-ruby19-1.9.10-x86-linux.gem To install, download it first then do 'gem install ' on the local file. Let me know if any installation problems occur. a From lists at ruby-forum.com Mon Jan 5 15:39:10 2009 From: lists at ruby-forum.com (Ridge Mcghee) Date: Mon, 5 Jan 2009 21:39:10 +0100 Subject: [wxruby-users] wxruby 1.9.9 menu - strange corruption In-Reply-To: <4961F5C3.1070306@pressure.to> References: <87371d6a91dcc77fd60f5dd4f7fd7f27@ruby-forum.com> <49600172.8010607@pressure.to> <4c1ab821ae10e8b0c5e2a7462007956c@ruby-forum.com> <010993a637d0eb2a56713c69f1846edd@ruby-forum.com> <4961F5C3.1070306@pressure.to> Message-ID: <20526325369c03dc9e2cbb129cdf3de4@ruby-forum.com> Alex Fenton wrote: > Hi Ridge/Mario > > Just read through the discussion, and think you're both making sense. > Ridge, the OO philosophy which you describe is that which I've had in > mind developing wxRuby, and I believe we already follow in large part. > > This is just an implementation issue of an unforeseen use case for a > particular class, which hopefully we've resolved for the next release. Great news. Thank you both for your prompt responses. > > alex -- Posted via http://www.ruby-forum.com/. From jas.shelton at hotmail.com Mon Jan 5 15:42:41 2009 From: jas.shelton at hotmail.com (Jason Shelton) Date: Mon, 5 Jan 2009 15:42:41 -0500 Subject: [wxruby-users] Creating a Progress Bar Message-ID: All, I am attempting to add a progress bar to my application. What is prompting the progress bar to be displayed is the pressing of a button. This button performs an action, and for the sake of an example, lets say that it is printing one million words to the screen. While these words are printing to the screen, I want a progress bar to be running. I want the bar to fill completely, then go blank, and fill completely over and over again until all of the words are printed to the screen. Once all of the words are printed, I want the progress bar to stop its routine. I have the progress bar up and running, but my problem is that I am using a while loop to continuously fill the bar, so in turn it is running infinitely, and the code that comes after it, the words printing, is never being executed. I can elaborate if necessary. Thanks in advance for all of your assistance. - Shelton _________________________________________________________________ Send e-mail anywhere. No map, no compass. http://windowslive.com/oneline/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_anywhere_122008 -------------- next part -------------- An HTML attachment was scrubbed... URL: From alex at pressure.to Mon Jan 5 17:09:30 2009 From: alex at pressure.to (Alex Fenton) Date: Mon, 05 Jan 2009 22:09:30 +0000 Subject: [wxruby-users] Creating a Progress Bar In-Reply-To: References: Message-ID: <4962851A.8070407@pressure.to> Jason Shelton wrote: I guess you mean ProgressDialog or Gauge. They will both do roughly the same thing, but the former will display it in a standalone dialog. > > I am attempting to add a progress bar to my application. What is > prompting the progress bar to be displayed is the pressing of a > button. This button performs an action, and for the sake of an > example, lets say that it is printing one million words to the > screen. While these words are printing to the screen, I want a > progress bar to be running. I want the bar to fill completely, then > go blank, and fill completely over and over again until all of the > words are printed to the screen. Once all of the words are printed, I > want the progress bar to stop its routine. Use the 'maximum' argument of ProgressDialog to set how many steps there are to progress through. In your case, it might be the number of words. Use the #update method to set how many steps have been completed. The dialog is automatically dismissed when the full number of steps is finished, or call #close to finish it early. It works the same with Gauge, except you use #value= to set how many steps have been done. > I have the progress bar up and running, but my problem is that I am > using a while loop to continuously fill the bar, so in turn it is > running infinitely, and the code that comes after it, the words > printing, is never being executed. Well, don't use an infinite while loop... either call break somewhere in the loop to exit it, or use an 'each' loop over the right number of items. If that's not it, perhaps describe your question more clearly, and if possible show a little sample of code that you're working on. a From lists at ruby-forum.com Thu Jan 8 11:52:14 2009 From: lists at ruby-forum.com (Tim Mcd) Date: Thu, 8 Jan 2009 17:52:14 +0100 Subject: [wxruby-users] Errors with TextCtrl.new! Message-ID: <67ec94e0fbc3e61ed96587a1b8ed2a58@ruby-forum.com> Here is my code: require 'rubygems' require 'wx' include Wx class GuiMudClientApp < App def on_init frame = Frame.new(nil, -1, "GMC: Incoming").show test = TextCtrl.new(frame, -1, "-----Mud stuff here-----", Point.new(500, 500), Size.new(500, 500), TE_READONLY) test.append_text "Pfft!" end end nowai = GuiMudClientApp.new nowai.main_loop I get this error: guimc.rb:8:in `new': Error initializing # (TypeError) : Expected argument 1 of type wxWindow *, but got TrueClass true in SWIG method 'wxTextCtrl' Correct parameters for Wxruby2::TextCtrl.new are: :id => (Fixnum) :value => (String) :pos => (Wxruby2::Point) :size => (Wxruby2::Size) :style => (Fixnum) :validator => (Wxruby2::Validator) :name => (String) from guimc.rb:8:in `on_init' from guimc.rb:15:in `main_loop' from guimc.rb:15 Before, I could use a 'Frame' class as the parent window, but now its having issues. I've followed it right off of the API docs. Any idea whats wrong/how to fix it? Thanks in advance, Zonbidesu -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Jan 8 12:58:34 2009 From: lists at ruby-forum.com (Tim Mcd) Date: Thu, 8 Jan 2009 18:58:34 +0100 Subject: [wxruby-users] Errors with TextCtrl.new! In-Reply-To: <67ec94e0fbc3e61ed96587a1b8ed2a58@ruby-forum.com> References: <67ec94e0fbc3e61ed96587a1b8ed2a58@ruby-forum.com> Message-ID: <6eb1c36727a2b9519b1e1cd66a3da446@ruby-forum.com> Addition: I'm on Mac OS 10.5(.9?)-- That's Leopard. Its a PPC, upgraded PowerBook G4. -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Thu Jan 8 13:22:06 2009 From: alex at pressure.to (Alex Fenton) Date: Thu, 08 Jan 2009 18:22:06 +0000 Subject: [wxruby-users] Errors with TextCtrl.new! In-Reply-To: <67ec94e0fbc3e61ed96587a1b8ed2a58@ruby-forum.com> References: <67ec94e0fbc3e61ed96587a1b8ed2a58@ruby-forum.com> Message-ID: <4966444E.3000608@pressure.to> Hi Tim Mcd wrote: > frame = Frame.new(nil, -1, "GMC: Incoming").show > You're assigning the return value of show() to the variable frame. show() returns a boolean true/false. > test = TextCtrl.new(frame, -1, "-----Mud stuff here-----", > Point.new(500, 500), Size.new(500, 500), TE_READONLY) Now you're passing that variable containing 'true' as the first arg to TextCtrl.new > guimc.rb:8:in `new': Error initializing # > (TypeError) > : Expected argument 1 of type wxWindow *, but got TrueClass true > in SWIG method 'wxTextCtrl' so you get this error :) > Before, I could use a 'Frame' class as the parent window, but now its > having issues. I've followed it right off of the API docs. Any idea > whats wrong/how to fix it? frame = Wx::Frame.new(...) frame.show text = Wx::TextCtrl.new(frame, ...) cheers a From lists at ruby-forum.com Thu Jan 8 14:04:58 2009 From: lists at ruby-forum.com (Tim Mcd) Date: Thu, 8 Jan 2009 20:04:58 +0100 Subject: [wxruby-users] Errors with TextCtrl.new! In-Reply-To: <4966444E.3000608@pressure.to> References: <67ec94e0fbc3e61ed96587a1b8ed2a58@ruby-forum.com> <4966444E.3000608@pressure.to> Message-ID: <37083d5c4326ca5f4df46cbc427333c1@ruby-forum.com> Ahahaha, thanks. I thought it was something silly like that... -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Jan 8 14:47:25 2009 From: lists at ruby-forum.com (Tim Mcd) Date: Thu, 8 Jan 2009 20:47:25 +0100 Subject: [wxruby-users] New problem: Newlines. Message-ID: <57c69327986f68bab5c1dc504f0d4062@ruby-forum.com> I have this: test2 = TextCtrl.new(frame, 10, "Output here!", Point.new(0, 501), Size.new(500, 25), TE_PROCESS_ENTER) display.write_text " \n You entered: #{str}" But the '\n' isn't... calculated? Inserted? It reads that there is SOMETHING there, because the \n doesn't show up in the text, but I can comment it out (\\n) and the \n will then show. It looked like to me that the API documentation says that newline characters are the only control characters allowed in write_text, and that they work. (Oh, and display is a variable for test2, in a different method) -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Jan 8 14:53:42 2009 From: lists at ruby-forum.com (Tim Mcd) Date: Thu, 8 Jan 2009 20:53:42 +0100 Subject: [wxruby-users] New problem: Newlines. In-Reply-To: <57c69327986f68bab5c1dc504f0d4062@ruby-forum.com> References: <57c69327986f68bab5c1dc504f0d4062@ruby-forum.com> Message-ID: <4738745e9b7090d8eb48be5457b2a0d4@ruby-forum.com> Oh and also, is it possible/would it be 'correct' for me to add some stuff into the 'main_loop'? I would like to add something like: def main_loop Thread.new do || inp = connection.recv(1000000) display.write_text inp end end would that screw with what is already in the main_loop too much? -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Thu Jan 8 15:29:20 2009 From: alex at pressure.to (Alex Fenton) Date: Thu, 08 Jan 2009 20:29:20 +0000 Subject: [wxruby-users] New problem: Newlines. In-Reply-To: <57c69327986f68bab5c1dc504f0d4062@ruby-forum.com> References: <57c69327986f68bab5c1dc504f0d4062@ruby-forum.com> Message-ID: <49666220.202@pressure.to> Tim Mcd wrote: > I have this: > > test2 = TextCtrl.new(frame, 10, "Output here!", Point.new(0, 501), > Size.new(500, 25), TE_PROCESS_ENTER) > display.write_text " \n You entered: #{str}" > > > But the '\n' isn't... calculated? Inserted? It reads that there is > SOMETHING there, because the \n doesn't show up in the text, I'm sure that'll be a newline; you could check by doing "p text2.value" in Ruby. I guess what's happening is that Ruby is translating \n into a newline because it's inside a double-quoted string. This is done before wxRuby gets the string, so wxRuby gets a literal newline character. But that works fine I think. > but I can > comment it out (\\n) and the \n will then show. So - what's the problem you're trying to solve? alex From alex at pressure.to Thu Jan 8 15:52:29 2009 From: alex at pressure.to (Alex Fenton) Date: Thu, 08 Jan 2009 20:52:29 +0000 Subject: [wxruby-users] New problem: Newlines. In-Reply-To: <4738745e9b7090d8eb48be5457b2a0d4@ruby-forum.com> References: <57c69327986f68bab5c1dc504f0d4062@ruby-forum.com> <4738745e9b7090d8eb48be5457b2a0d4@ruby-forum.com> Message-ID: <4966678D.4020407@pressure.to> Tim Mcd wrote: > Oh and also, is it possible/would it be 'correct' for me to add some > stuff into the 'main_loop'? I would like to add something like: > > def main_loop > Thread.new do || > inp = connection.recv(1000000) > display.write_text inp > end > end > > would that screw with what is already in the main_loop too much? > It should work OK, but you'll need to add something like Wx::Timer.every(50) { Thread.pass } to your main_loop. This will ensure that on Ruby 1.8 your non-GUI ruby threads get execution time, otherwise they won't progress. Have a look at the threaded.rb and chat client examples in the samples directory as they demonstrate threads and network programming. hth alex From lists at ruby-forum.com Thu Jan 8 17:29:39 2009 From: lists at ruby-forum.com (Tim Mcd) Date: Thu, 8 Jan 2009 23:29:39 +0100 Subject: [wxruby-users] New problem: Newlines. In-Reply-To: <4966678D.4020407@pressure.to> References: <57c69327986f68bab5c1dc504f0d4062@ruby-forum.com> <4738745e9b7090d8eb48be5457b2a0d4@ruby-forum.com> <4966678D.4020407@pressure.to> Message-ID: <653b1af7f4265baa5ec4484636b5e871@ruby-forum.com> Alex Fenton wrote: > Tim Mcd wrote: >> would that screw with what is already in the main_loop too much? >> > > It should work OK, but you'll need to add something like > > Wx::Timer.every(50) { Thread.pass } > > to your main_loop. This will ensure that on Ruby 1.8 your non-GUI ruby > threads get execution time, otherwise they won't progress. > > Have a look at the threaded.rb and chat client examples in the samples > directory as they demonstrate threads and network programming. > > hth > alex Thanks! And the problem in the first post is this: When I run in, there is no linebreaks. I am trying to make it so that there ARE line breaks via the newline character. -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Jan 8 20:18:47 2009 From: lists at ruby-forum.com (Tim Mcd) Date: Fri, 9 Jan 2009 02:18:47 +0100 Subject: [wxruby-users] New problem: Newlines. In-Reply-To: <653b1af7f4265baa5ec4484636b5e871@ruby-forum.com> References: <57c69327986f68bab5c1dc504f0d4062@ruby-forum.com> <4738745e9b7090d8eb48be5457b2a0d4@ruby-forum.com> <4966678D.4020407@pressure.to> <653b1af7f4265baa5ec4484636b5e871@ruby-forum.com> Message-ID: Sorry for even more noobiness, but; did I just find a new problem? Code [ require 'rubygems' require 'socket' require 'wx' include Wx $connection = TCPSocket.new("dark-legacy.com", 9898) class GuiMudClientApp < App THREAD_TIMER_ID = ID_HIGHEST + 1 def on_init #Timer.every(25) { Thread.pass } frame = Frame.new(nil, -1, "GMC: Incoming", Point.new(100, 100), Size.new(500, 550)) test = TextCtrl.new(frame, -1, "-----Mud stuff here-----", Point.new(0, 0), Size.new(500, 500), TE_READONLY) test.append_text "Pfft!" test2 = TextCtrl.new(frame, 10, "Output here!", Point.new(0, 501), Size.new(500, 25), TE_PROCESS_ENTER) frame.show evt_text_enter(10) do |event| cmdentered(event.get_string, test2, test) end end def cmdentered(str, textbox, display) display.write_text "--(#{str})--" $connection.write(str) textbox.clear end def main_loop a = Thread.new do until connection.closed? == true input = $connection.recv(1000000) test.append_text input end end Timer.every(25) { Thread.pass } ### LINE 35 <---- super end end nowai = GuiMudClientApp.new nowai.main_loop ] Error: /Library/Ruby/Gems/1.8/gems/wxruby-1.9.9-universal-darwin-9/lib/wx/classes/timer.rb:18:in `every': uninitialized constant Wxruby2::THE_APP (NameError) from guimc.rb:35:in `main_loop' from guimc.rb:42 Line 35 is the marked line in the above code. What's wrong? -- Posted via http://www.ruby-forum.com/. From mario at ruby-im.net Thu Jan 8 20:19:02 2009 From: mario at ruby-im.net (Mario Steele) Date: Thu, 8 Jan 2009 19:19:02 -0600 Subject: [wxruby-users] New problem: Newlines. In-Reply-To: <653b1af7f4265baa5ec4484636b5e871@ruby-forum.com> References: <57c69327986f68bab5c1dc504f0d4062@ruby-forum.com> <4738745e9b7090d8eb48be5457b2a0d4@ruby-forum.com> <4966678D.4020407@pressure.to> <653b1af7f4265baa5ec4484636b5e871@ruby-forum.com> Message-ID: You need to make sure that you pass the TE_MULTILINE to the creation of the TextCtrl, EG: test2 = TextCtrl.new(frame, 10, "Output here!", Point.new(0, 501),Size.new(500, 25), TE_PROCESS_ENTER|TE_MULTILINE) This will create a Multi-Line Text Control, which can display new lines, if you create a TextCtrl without the TE_MULTILINE, it'll create a Single Line Text Control, even though the sizer will resize it to look like it's a Multi-Line Text control. On Thu, Jan 8, 2009 at 4:29 PM, Tim Mcd wrote: > Alex Fenton wrote: > > Tim Mcd wrote: > >> would that screw with what is already in the main_loop too much? > >> > > > > It should work OK, but you'll need to add something like > > > > Wx::Timer.every(50) { Thread.pass } > > > > to your main_loop. This will ensure that on Ruby 1.8 your non-GUI ruby > > threads get execution time, otherwise they won't progress. > > > > Have a look at the threaded.rb and chat client examples in the samples > > directory as they demonstrate threads and network programming. > > > > hth > > alex > > Thanks! > > And the problem in the first post is this: When I run in, there is no > linebreaks. I am trying to make it so that there ARE line breaks via the > newline character. > -- > 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/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Thu Jan 8 22:49:44 2009 From: lists at ruby-forum.com (Tim Mcd) Date: Fri, 9 Jan 2009 04:49:44 +0100 Subject: [wxruby-users] New problem: Newlines. In-Reply-To: References: <57c69327986f68bab5c1dc504f0d4062@ruby-forum.com> <4738745e9b7090d8eb48be5457b2a0d4@ruby-forum.com> <4966678D.4020407@pressure.to> <653b1af7f4265baa5ec4484636b5e871@ruby-forum.com> Message-ID: <97c895a1e2d15a3402e8aa4abc1c5ead@ruby-forum.com> Mario Steele wrote: > You need to make sure that you pass the TE_MULTILINE to the creation of > the > TextCtrl, EG: > > test2 = TextCtrl.new(frame, 10, "Output here!", Point.new(0, > 501),Size.new(500, 25), TE_PROCESS_ENTER|TE_MULTILINE) > > This will create a Multi-Line Text Control, which can display new lines, > if > you create a TextCtrl without the TE_MULTILINE, it'll create a Single > Line > Text Control, even though the sizer will resize it to look like it's a > Multi-Line Text control. Thats good, thanks for that. Have any idea about the 'THE_APP' error? -- Posted via http://www.ruby-forum.com/. From mario at ruby-im.net Thu Jan 8 23:39:18 2009 From: mario at ruby-im.net (Mario Steele) Date: Thu, 8 Jan 2009 22:39:18 -0600 Subject: [wxruby-users] New problem: Newlines. In-Reply-To: <97c895a1e2d15a3402e8aa4abc1c5ead@ruby-forum.com> References: <57c69327986f68bab5c1dc504f0d4062@ruby-forum.com> <4738745e9b7090d8eb48be5457b2a0d4@ruby-forum.com> <4966678D.4020407@pressure.to> <653b1af7f4265baa5ec4484636b5e871@ruby-forum.com> <97c895a1e2d15a3402e8aa4abc1c5ead@ruby-forum.com> Message-ID: Right now, I'm trying to get a compile of the latest Subversion that will be deemed 2.0 going, so that I can run my tests to see if there are any outstanding bugs that need to be covered. The WxRuby::THE_APP error, is something that is kinda curious. I don't have a Mac system in which to test out on, but from the looks of it, somehow WxRuby::THE_APP (AKA Wx::THE_APP), is not being set, when your code calls the GuiMudClientApp.new, which is suppose to be handled internally by wxRuby when you create the very first App class or App subclass. Meaning, that there is only 1 App that can be in existance during the entire run of wxRuby. There are ways around it, but it's only for thoes who are more experienced with the library, and know of the dangers of it. However, in this case, your problem occurs in main_loop(), which is weird. My suggestion to you, would be to move the code out of main_loop(), and throw it into on_init(). Since you will have $connection setup by that time. Just to test and see if the problem actually does lie in main_loop(), or not.... And actually, I think on_init() isn't actually called till you execute main_loop(), it's part of the process it goes through once everything is initialized, it finalizes by running any on_init() methods you have defined. So try moving the code there. That's the best I can suggest, till I get wxWidgets and wxRuby compiled on Windows, to test your code, to see if it has the same problem. On Thu, Jan 8, 2009 at 9:49 PM, Tim Mcd wrote: > Mario Steele wrote: > > You need to make sure that you pass the TE_MULTILINE to the creation of > > the > > TextCtrl, EG: > > > > test2 = TextCtrl.new(frame, 10, "Output here!", Point.new(0, > > 501),Size.new(500, 25), TE_PROCESS_ENTER|TE_MULTILINE) > > > > This will create a Multi-Line Text Control, which can display new lines, > > if > > you create a TextCtrl without the TE_MULTILINE, it'll create a Single > > Line > > Text Control, even though the sizer will resize it to look like it's a > > Multi-Line Text control. > > Thats good, thanks for that. > > Have any idea about the 'THE_APP' error? > -- > 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/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From alex at pressure.to Fri Jan 9 02:54:57 2009 From: alex at pressure.to (Alex Fenton) Date: Fri, 09 Jan 2009 07:54:57 +0000 Subject: [wxruby-users] New problem: Newlines. In-Reply-To: References: <57c69327986f68bab5c1dc504f0d4062@ruby-forum.com> <4738745e9b7090d8eb48be5457b2a0d4@ruby-forum.com> <4966678D.4020407@pressure.to> <653b1af7f4265baa5ec4484636b5e871@ruby-forum.com> Message-ID: <496702D1.7030301@pressure.to> Tim Mcd wrote: > def on_init > #Timer.every(25) { Thread.pass } > ... > > def main_loop > a = Thread.new do > until connection.closed? == true > input = $connection.recv(1000000) > test.append_text input > end > end .... > nowai = GuiMudClientApp.new Don't override main_loop unless you know what you're doing. And if you do override it, you must call super() within it. This is the source of your error. Basically, all of your start-up code - including your Thread initialisation - should go in the on_init method. This goes for prety much any App. a From fabio.petrucci at gmail.com Fri Jan 9 09:30:55 2009 From: fabio.petrucci at gmail.com (Fabio Petrucci) Date: Fri, 9 Jan 2009 15:30:55 +0100 Subject: [wxruby-users] ListCtrl unexpected behavior Message-ID: Hi, using ListCtrl, I realized that, capturing the selection event by using the macro evt_list_item_selected, I get mistaken event of type ListItem instead of type ListEvent. I noticed that this occurs when i use the keyboard arrow keys to move through the list. It can be shown in the example Bigdemo -> wxListCtrl_virtual causing the error. my environment is wxruby-1.9.9-x86-mswin32-60, ruby 1.8.6 ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32] WinXP sp2 if i rememer well there was no problem with wxruby-1.9.8 regards, bio. -------------- next part -------------- An HTML attachment was scrubbed... URL: From fabio.petrucci at gmail.com Fri Jan 9 11:31:35 2009 From: fabio.petrucci at gmail.com (Fabio Petrucci) Date: Fri, 9 Jan 2009 17:31:35 +0100 Subject: [wxruby-users] ListCtrl unexpected behavior In-Reply-To: References: Message-ID: one more detail: the error occurs only alternating mouse clicks and keyboard arrow keys through the list. On Fri, Jan 9, 2009 at 3:30 PM, Fabio Petrucci wrote: > Hi, > > using ListCtrl, I realized that, capturing the selection event by using the > macro evt_list_item_selected, I get mistaken event of type ListItem instead > of type ListEvent. > I noticed that this occurs when i use the keyboard arrow keys to move > through the list. > > It can be shown in the example Bigdemo -> wxListCtrl_virtual causing the > error. > > my environment is > > wxruby-1.9.9-x86-mswin32-60, ruby 1.8.6 > ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32] > WinXP sp2 > > if i rememer well there was no problem with wxruby-1.9.8 > > regards, > > bio. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Fri Jan 9 15:54:03 2009 From: lists at ruby-forum.com (Tim Mcd) Date: Fri, 9 Jan 2009 21:54:03 +0100 Subject: [wxruby-users] New problem: Newlines. In-Reply-To: <496702D1.7030301@pressure.to> References: <57c69327986f68bab5c1dc504f0d4062@ruby-forum.com> <4738745e9b7090d8eb48be5457b2a0d4@ruby-forum.com> <4966678D.4020407@pressure.to> <653b1af7f4265baa5ec4484636b5e871@ruby-forum.com> <496702D1.7030301@pressure.to> Message-ID: Okay, thanks you two! ^_^ I'll test it in a bit. -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Fri Jan 9 17:40:00 2009 From: alex at pressure.to (Alex Fenton) Date: Fri, 09 Jan 2009 22:40:00 +0000 Subject: [wxruby-users] ListCtrl unexpected behavior In-Reply-To: References: Message-ID: <4967D240.5090305@pressure.to> Hi Fabio Fabio Petrucci wrote: > using ListCtrl, I realized that, capturing the selection event by > using the macro evt_list_item_selected, I get mistaken event of type > ListItem instead of type ListEvent. > I noticed that this occurs when i use the keyboard arrow keys to move > through the list. > > It can be shown in the example Bigdemo -> wxListCtrl_virtual causing > the error. > > my environment is > > wxruby-1.9.9-x86-mswin32-60, ruby 1.8.6 > ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32] > WinXP sp2 Thanks for the report. I think that at the root this is the same bug that others were encountering with Scintilla event handlers, which is now fixed in SVN. I will try and reproduce using the ListCtrl on Windows (the bug depends partly on how the OS allocates memory blocks). Useful to know that it wasn't a problem in 1.9.8 - will check see if any other classes might have this problem. It will be fixed for 2.0 cheers alex From chauk.mean at gmail.com Fri Jan 9 18:31:22 2009 From: chauk.mean at gmail.com (Chauk-Mean P) Date: Sat, 10 Jan 2009 00:31:22 +0100 Subject: [wxruby-users] ListCtrl unexpected behavior In-Reply-To: <4967D240.5090305@pressure.to> References: <4967D240.5090305@pressure.to> Message-ID: Hi, 2009/1/9 Alex Fenton : > Hi Fabio > > Fabio Petrucci wrote: >> >> using ListCtrl, I realized that, capturing the selection event by using >> the macro evt_list_item_selected, I get mistaken event of type ListItem >> instead of type ListEvent. >> I noticed that this occurs when i use the keyboard arrow keys to move >> through the list. >> >> It can be shown in the example Bigdemo -> wxListCtrl_virtual causing the >> error. > > Thanks for the report. I think that at the root this is the same bug that > others were encountering with Scintilla event handlers, which is now fixed > in SVN. FYI, it works fine for me with the latest revision in SVN. Cheers, Chauk-Mean. From alex at pressure.to Fri Jan 9 19:00:22 2009 From: alex at pressure.to (Alex Fenton) Date: Sat, 10 Jan 2009 00:00:22 +0000 Subject: [wxruby-users] ListCtrl unexpected behavior In-Reply-To: References: <4967D240.5090305@pressure.to> Message-ID: <4967E516.4050303@pressure.to> Chauk-Mean P wrote: >> Thanks for the report. I think that at the root this is the same bug that >> others were encountering with Scintilla event handlers, which is now fixed >> in SVN. >> > > FYI, it works fine for me with the latest revision in SVN. Cool, thanks. I took another look at our SWIG wxRuby_WrapWxEventInRuby function and there's something in there which could potentially still cause these errors where an event handler receives an odd type of object instead of the correct Event object. I'll put a patch in to make it watertight, although it may well be that the commonest route for these memory mess-ups is already plugged. cheers alex From rakaur at malkier.net Mon Jan 12 12:14:47 2009 From: rakaur at malkier.net (Eric Will) Date: Mon, 12 Jan 2009 12:14:47 -0500 Subject: [wxruby-users] ruby19-linux gem : AVAILABLE In-Reply-To: <49625FBD.8040808@pressure.to> References: <4947B5ED.3020407@pressure.to> <4947CDD1.1020700@pressure.to> <4948452C.3020100@pressure.to> <376324F6-A003-494B-B08C-71824BE3C3D2@malkier.net> <4949258B.1020506@pressure.to> <49625FBD.8040808@pressure.to> Message-ID: <1ce38ef40901120914u5322311me684d5f5007b5e53@mail.gmail.com> On Mon, Jan 5, 2009 at 2:30 PM, Alex Fenton wrote: > I've created a test gem for Ruby-1.9 on Linux. Because Ruby-1.9 and SWIG > have both moved on since wxRuby 1.9.9 was released, I've have to build it > against HEAD, and called it '1.9.10'. However it's a development snapshot so > usual cautions apply. > > I don't propose to do a 1.9.10 release through Rubyforge, so it's available > for download only via the website: > > http://wxruby.rubyforge.org/prerelease/wxruby-ruby19-1.9.10-x86-linux.gem > > To install, download it first then do 'gem install ' on the local > file. > > Let me know if any installation problems occur. I've installed this, and I still get the same problems as the "official" gem: /var/lib/gems/1.9.0/gems/wxruby-ruby19-1.9.10-x86-linux/lib/wx.rb:12:in `require': /var/lib/gems/1.9.0/gems/wxruby-ruby19-1.9.10-x86-linux/lib/wxruby2.so: undefined symbol: rb_str_new_cstr - /var/lib/gems/1.9.0/gems/wxruby-ruby19-1.9.10-x86-linux/lib/wxruby2.so (LoadError) -- Eric Will // rakaur @ malkier From alex at pressure.to Mon Jan 12 12:35:18 2009 From: alex at pressure.to (Alex Fenton) Date: Mon, 12 Jan 2009 17:35:18 +0000 Subject: [wxruby-users] ruby19-linux gem : AVAILABLE In-Reply-To: <1ce38ef40901120914u5322311me684d5f5007b5e53@mail.gmail.com> References: <4947B5ED.3020407@pressure.to> <4947CDD1.1020700@pressure.to> <4948452C.3020100@pressure.to> <376324F6-A003-494B-B08C-71824BE3C3D2@malkier.net> <4949258B.1020506@pressure.to> <49625FBD.8040808@pressure.to> <1ce38ef40901120914u5322311me684d5f5007b5e53@mail.gmail.com> Message-ID: <496B7F56.70608@pressure.to> Eric Will wrote: > I've installed this, and I still get the same problems as the "official" gem: > > /var/lib/gems/1.9.0/gems/wxruby-ruby19-1.9.10-x86-linux/lib/wx.rb:12:in > `require': /var/lib/gems/1.9.0/gems/wxruby-ruby19-1.9.10-x86-linux/lib/wxruby2.so: > undefined symbol: rb_str_new_cstr - > /var/lib/gems/1.9.0/gems/wxruby-ruby19-1.9.10-x86-linux/lib/wxruby2.so > (LoadError) Are you using an old version of ruby-1.9; what does ruby -v return? rb_str_new_cstr was added to ruby 1.9 in July last year; this gem is built against the release candidate so will refer to this function: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-dev/35615 alex From rakaur at malkier.net Mon Jan 12 13:06:23 2009 From: rakaur at malkier.net (Eric Will) Date: Mon, 12 Jan 2009 13:06:23 -0500 Subject: [wxruby-users] ruby19-linux gem : AVAILABLE In-Reply-To: <496B7F56.70608@pressure.to> References: <4947CDD1.1020700@pressure.to> <4948452C.3020100@pressure.to> <376324F6-A003-494B-B08C-71824BE3C3D2@malkier.net> <4949258B.1020506@pressure.to> <49625FBD.8040808@pressure.to> <1ce38ef40901120914u5322311me684d5f5007b5e53@mail.gmail.com> <496B7F56.70608@pressure.to> Message-ID: <1ce38ef40901121006v32341233gec01690ada1364c1@mail.gmail.com> On Mon, Jan 12, 2009 at 12:35 PM, Alex Fenton wrote: > Are you using an old version of ruby-1.9; what does ruby -v return? 1.9.0. It's, unfortunately, the latest version available in Ubuntu repositories. > alex -- Eric Will // rakaur @ malkier From alex at pressure.to Mon Jan 12 13:59:36 2009 From: alex at pressure.to (Alex Fenton) Date: Mon, 12 Jan 2009 18:59:36 +0000 Subject: [wxruby-users] ruby19-linux gem : AVAILABLE In-Reply-To: <1ce38ef40901121006v32341233gec01690ada1364c1@mail.gmail.com> References: <4947CDD1.1020700@pressure.to> <4948452C.3020100@pressure.to> <376324F6-A003-494B-B08C-71824BE3C3D2@malkier.net> <4949258B.1020506@pressure.to> <49625FBD.8040808@pressure.to> <1ce38ef40901120914u5322311me684d5f5007b5e53@mail.gmail.com> <496B7F56.70608@pressure.to> <1ce38ef40901121006v32341233gec01690ada1364c1@mail.gmail.com> Message-ID: <496B9318.5080305@pressure.to> Eric Will wrote: > > 1.9.0. It's, unfortunately, the latest version available in Ubuntu repositories. OK, it's not going to work. Too much has changed in ruby-1.9 since then. You'll either need to build your own ruby-1.9, or wait for the repo to update. cheers alex From lists at ruby-forum.com Tue Jan 13 02:39:35 2009 From: lists at ruby-forum.com (Lc Yeap) Date: Tue, 13 Jan 2009 08:39:35 +0100 Subject: [wxruby-users] Segmentation Fault : [i386-mswin32] in wxruby Message-ID: Greetings, I have created a GUI to generate a output text file using wxruby. my program codes are about ~1400 lines. ruby : 1.8.6 wxruby : 1.9.7 rails : 2.1.0 FYI, I am using the TextCtrl & combobox in the main GUI to get the output file name and main settings. after clicking the button, it will pop up another frame which let user to select and modified settings with TextCtrl & combobox. By clicking the button on the new GUI, an output file will be generated. But problem occurred if i want to generate multiple files. When i enter the new name in the TextCtrl for creating new file, the GUI will close immediately with this error pop up -- > "Bug:Segmentation Fault" May i know is there any reference for me or suggestion to fix this problem? Your help will be highly appreciated. =) -- Posted via http://www.ruby-forum.com/. From mario at ruby-im.net Tue Jan 13 02:46:07 2009 From: mario at ruby-im.net (Mario Steele) Date: Tue, 13 Jan 2009 01:46:07 -0600 Subject: [wxruby-users] Segmentation Fault : [i386-mswin32] in wxruby In-Reply-To: References: Message-ID: Well, there's two things here. First, your using 1.9.7 of Ruby, please upgrade to 1.9.9, and test again, before moving on to this second part, there have been many bug fixes between 1.9.7 and 1.9.9. Second, and do this only after you tried the first part, if the problem still occurs, please send us a Minimal example, that can reproduce the problem that your having, so that we can test it, and see what exactly is going on. hth, Mario On Tue, Jan 13, 2009 at 1:39 AM, Lc Yeap wrote: > Greetings, > > I have created a GUI to generate a output text file using wxruby. my > program codes are about ~1400 lines. > ruby : 1.8.6 > wxruby : 1.9.7 > rails : 2.1.0 > > FYI, I am using the TextCtrl & combobox in the main GUI to get the > output file name and main settings. after clicking the button, it will > pop up another frame which let user to select and modified settings with > TextCtrl & combobox. By clicking the button on the new GUI, an output > file will be generated. > > But problem occurred if i want to generate multiple files. When i enter > the new name in the TextCtrl for creating new file, the GUI will close > immediately with this error pop up -- > "Bug:Segmentation Fault" > > May i know is there any reference for me or suggestion to fix this > problem? > > Your help will be highly appreciated. =) > -- > 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/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From mario at ruby-im.net Tue Jan 13 02:46:47 2009 From: mario at ruby-im.net (Mario Steele) Date: Tue, 13 Jan 2009 01:46:47 -0600 Subject: [wxruby-users] Segmentation Fault : [i386-mswin32] in wxruby In-Reply-To: References: Message-ID: By 1.9.7 of Ruby, I mean 1.9.7 of wxRuby, not Ruby itself. On Tue, Jan 13, 2009 at 1:46 AM, Mario Steele wrote: > Well, there's two things here. > > First, your using 1.9.7 of Ruby, please upgrade to 1.9.9, and test again, > before moving on to this second part, there have been many bug fixes between > 1.9.7 and 1.9.9. > > Second, and do this only after you tried the first part, if the problem > still occurs, please send us a Minimal example, that can reproduce the > problem that your having, so that we can test it, and see what exactly is > going on. > > hth, > Mario > > > On Tue, Jan 13, 2009 at 1:39 AM, Lc Yeap wrote: > >> Greetings, >> >> I have created a GUI to generate a output text file using wxruby. my >> program codes are about ~1400 lines. >> ruby : 1.8.6 >> wxruby : 1.9.7 >> rails : 2.1.0 >> >> FYI, I am using the TextCtrl & combobox in the main GUI to get the >> output file name and main settings. after clicking the button, it will >> pop up another frame which let user to select and modified settings with >> TextCtrl & combobox. By clicking the button on the new GUI, an output >> file will be generated. >> >> But problem occurred if i want to generate multiple files. When i enter >> the new name in the TextCtrl for creating new file, the GUI will close >> immediately with this error pop up -- > "Bug:Segmentation Fault" >> >> May i know is there any reference for me or suggestion to fix this >> problem? >> >> Your help will be highly appreciated. =) >> -- >> 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/ > -- Mario Steele http://www.trilake.net http://www.ruby-im.net http://rubyforge.org/projects/wxruby/ http://rubyforge.org/projects/wxride/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Tue Jan 13 03:28:46 2009 From: lists at ruby-forum.com (Lc Yeap) Date: Tue, 13 Jan 2009 09:28:46 +0100 Subject: [wxruby-users] Segmentation Fault : [i386-mswin32] in wxruby In-Reply-To: References: Message-ID: <7ddb5bf567bc873a48b8d552d006b641@ruby-forum.com> Mario Steele wrote: > Well, there's two things here. > > First, your using 1.9.7 of Ruby, please upgrade to 1.9.9, and test > again, > before moving on to this second part, there have been many bug fixes > between > 1.9.7 and 1.9.9. > > Second, and do this only after you tried the first part, if the problem > still occurs, please send us a Minimal example, that can reproduce the > problem that your having, so that we can test it, and see what exactly > is > going on. > > hth, > Mario Hi Mario, thanks for the prompt response. I downloaded the "wxruby-1.9.9-x86-mswin32-60.gem" from RubyForge. by typing command 'gem install wxruby', system reported that it has successfully installed wxruby with version 1.9.9. However, when I run my program again, the same error occurred. --> "config_vector_v6.rb:1418: [BUG] Segmentation fault ruby 1.8.6 (2007-09-24) [i386-mswin32]" so I deleted the previous gem "wxruby-1.9.7-i386-mswin32.gem" from the bin folder and reinstalled it again, but still the same error being reported. I tried with command "gem update wxruby" but I get this-->"ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError) No connection could be made because the target machine actively refused it. - connect(2)(Errno::ECONNREFUSED)" Is that I am not using the correct version of wxruby? can you point me how to upgrade my wxruby? If this still fail again after using wxruby 1.9.9, I will attach a sample code of my program. Thanks again. =) -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Tue Jan 13 04:03:20 2009 From: alex at pressure.to (Alex Fenton) Date: Tue, 13 Jan 2009 09:03:20 +0000 Subject: [wxruby-users] Segmentation Fault : [i386-mswin32] in wxruby In-Reply-To: <7ddb5bf567bc873a48b8d552d006b641@ruby-forum.com> References: <7ddb5bf567bc873a48b8d552d006b641@ruby-forum.com> Message-ID: <496C58D8.6030106@pressure.to> Lc Yeap wrote: > However, when I run my program again, the same error occurred. --> > "config_vector_v6.rb:1418: [BUG] Segmentation fault > ruby 1.8.6 (2007-09-24) [i386-mswin32]" > You can check what version of wxRuby is being used by your program by looking at the value of Wx::WXRUBY_VERSION. It's printed out in the "About" box of the minimal sample. > so I deleted the previous gem "wxruby-1.9.7-i386-mswin32.gem" from the > bin folder and reinstalled it again, but still the same error being > reported. > Use gem uninstall, don't delete directly. > I tried with command "gem update wxruby" but I get this-->"ERROR: While > executing gem ... (Gem::RemoteFetcher::FetchError) > No connection could be made because the target machine actively > refused it. > - connect(2)(Errno::ECONNREFUSED)" > Make sure that you have the latest versions of rubygems installed then try installing wxruby-1.9.9 again. gem --update system > Is that I am not using the correct version of wxruby? can you point me > how to upgrade my wxruby? If this still fail again after using wxruby > 1.9.9, I will attach a sample code of my program. OK. It might be worth posting a runnable sample of your code anyway. There may be something in there obvious that's not quite right - although wxRuby tries to raise an exception on incorrect use of the API, this isn't always possible. Or if there is a bug, it may still exist in the latest development version, in which case sample code will help us find it quicker. a From lists at ruby-forum.com Tue Jan 13 06:09:49 2009 From: lists at ruby-forum.com (Lc Yeap) Date: Tue, 13 Jan 2009 12:09:49 +0100 Subject: [wxruby-users] Segmentation Fault : [i386-mswin32] in wxruby In-Reply-To: <496C58D8.6030106@pressure.to> References: <7ddb5bf567bc873a48b8d552d006b641@ruby-forum.com> <496C58D8.6030106@pressure.to> Message-ID: <5a030dbaf3d0e751ff20554800cc4909@ruby-forum.com> Alex Fenton wrote: > Lc Yeap wrote: >> However, when I run my program again, the same error occurred. --> >> "config_vector_v6.rb:1418: [BUG] Segmentation fault >> ruby 1.8.6 (2007-09-24) [i386-mswin32]" >> > > You can check what version of wxRuby is being used by your program by > looking at the value of Wx::WXRUBY_VERSION. It's printed out in the > "About" box of the minimal sample. >> so I deleted the previous gem "wxruby-1.9.7-i386-mswin32.gem" from the >> bin folder and reinstalled it again, but still the same error being >> reported. >> > > Use gem uninstall, don't delete directly. > > >> I tried with command "gem update wxruby" but I get this-->"ERROR: While >> executing gem ... (Gem::RemoteFetcher::FetchError) >> No connection could be made because the target machine actively >> refused it. >> - connect(2)(Errno::ECONNREFUSED)" >> > > Make sure that you have the latest versions of rubygems installed then > try installing wxruby-1.9.9 again. > > gem --update system > > >> Is that I am not using the correct version of wxruby? can you point me >> how to upgrade my wxruby? If this still fail again after using wxruby >> 1.9.9, I will attach a sample code of my program. > > OK. It might be worth posting a runnable sample of your code anyway. > There may be something in there obvious that's not quite right - > although wxRuby tries to raise an exception on incorrect use of the API, > this isn't always possible. Or if there is a bug, it may still exist in > the latest development version, in which case sample code will help us > find it quicker. > > a Hi Alex, thanks for your reply. after follow your instructions, I have been confirmed the version of wxruby that i used is correct, which is 1.9.9. But, still the same error observed. Attached is my sample code. The error pop up when i try to generate the 2nd file. Hope will find out the cause of the error soon as i need this application to be up. Thanks a lot. =) Attachments: http://www.ruby-forum.com/attachment/3155/lcyeap_example.rb -- Posted via http://www.ruby-forum.com/. From kirill.likhodedov at gmail.com Tue Jan 13 06:22:57 2009 From: kirill.likhodedov at gmail.com (Kirill Likhodedov) Date: Tue, 13 Jan 2009 14:22:57 +0300 Subject: [wxruby-users] Segmentation Fault : [i386-mswin32] in wxruby In-Reply-To: <5a030dbaf3d0e751ff20554800cc4909@ruby-forum.com> References: <7ddb5bf567bc873a48b8d552d006b641@ruby-forum.com> <496C58D8.6030106@pressure.to> <5a030dbaf3d0e751ff20554800cc4909@ruby-forum.com> Message-ID: <236e49df0901130322s275f8d2xf6bcc579ef5dba7f@mail.gmail.com> Lc, you definitely need to simplify your example. Try to make it as small as possible. You need the MINIMUM example which reproduces the error. Sad to say that, but nobody will look through that amount of code you've given. 2009/1/13 Lc Yeap > Alex Fenton wrote: > > Lc Yeap wrote: > >> However, when I run my program again, the same error occurred. --> > >> "config_vector_v6.rb:1418: [BUG] Segmentation fault > >> ruby 1.8.6 (2007-09-24) [i386-mswin32]" > >> > > > > You can check what version of wxRuby is being used by your program by > > looking at the value of Wx::WXRUBY_VERSION. It's printed out in the > > "About" box of the minimal sample. > >> so I deleted the previous gem "wxruby-1.9.7-i386-mswin32.gem" from the > >> bin folder and reinstalled it again, but still the same error being > >> reported. > >> > > > > Use gem uninstall, don't delete directly. > > > > > >> I tried with command "gem update wxruby" but I get this-->"ERROR: While > >> executing gem ... (Gem::RemoteFetcher::FetchError) > >> No connection could be made because the target machine actively > >> refused it. > >> - connect(2)(Errno::ECONNREFUSED)" > >> > > > > Make sure that you have the latest versions of rubygems installed then > > try installing wxruby-1.9.9 again. > > > > gem --update system > > > > > >> Is that I am not using the correct version of wxruby? can you point me > >> how to upgrade my wxruby? If this still fail again after using wxruby > >> 1.9.9, I will attach a sample code of my program. > > > > OK. It might be worth posting a runnable sample of your code anyway. > > There may be something in there obvious that's not quite right - > > although wxRuby tries to raise an exception on incorrect use of the API, > > this isn't always possible. Or if there is a bug, it may still exist in > > the latest development version, in which case sample code will help us > > find it quicker. > > > > a > > Hi Alex, > > thanks for your reply. after follow your instructions, I have been > confirmed the version of wxruby that i used is correct, which is 1.9.9. > But, still the same error observed. > > Attached is my sample code. The error pop up when i try to generate the > 2nd file. > > Hope will find out the cause of the error soon as i need this > application to be up. > > Thanks a lot. =) > > > Attachments: > http://www.ruby-forum.com/attachment/3155/lcyeap_example.rb > > -- > 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: From alex at pressure.to Tue Jan 13 06:41:42 2009 From: alex at pressure.to (Alex Fenton) Date: Tue, 13 Jan 2009 11:41:42 +0000 Subject: [wxruby-users] Segmentation Fault : [i386-mswin32] in wxruby In-Reply-To: <5a030dbaf3d0e751ff20554800cc4909@ruby-forum.com> References: <7ddb5bf567bc873a48b8d552d006b641@ruby-forum.com> <496C58D8.6030106@pressure.to> <5a030dbaf3d0e751ff20554800cc4909@ruby-forum.com> Message-ID: <496C7DF6.2040000@pressure.to> Lc Yeap wrote > thanks for your reply. after follow your instructions, I have been > confirmed the version of wxruby that i used is correct, which is 1.9.9. > But, still the same error observed. > > Attached is my sample code. The error pop up when i try to generate the > 2nd file. I can reproduce the error with mswin32 1.9.9, but not with MingW on Windows (either 1.9.9 or the latest development version). If someone has a build of SVN HEAD build of mswin32 handy, perhaps they could give it a go to see if it's resolved. As Kiril's said, it'd be easier and quicker to help further if you could simplify this down a lot, to narrow down the source of the error. For example, I started by removing the text writing routine, then the confirmation dialog. Next step might be to remove all the controls except the 'generate' button. I don't have time to keep tweaking and running and clicking through your whole app right now, but if you provide a stripped-down sample demonstrating the issue, I'm happy to work with that. alex From lists at ruby-forum.com Tue Jan 13 12:10:28 2009 From: lists at ruby-forum.com (Tim Mcd) Date: Tue, 13 Jan 2009 18:10:28 +0100 Subject: [wxruby-users] Mind checking my code? Message-ID: I'm trying to get a project done: Making a GUI for my MUD client. I seem to be having some sort of bug, but I don't understand why. Perhaps someone could take a look at my code? It is at http://pastie.org/359700 --Thanks, -- Zonbi. -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Tue Jan 13 12:17:03 2009 From: lists at ruby-forum.com (Tim Mcd) Date: Tue, 13 Jan 2009 18:17:03 +0100 Subject: [wxruby-users] Mind checking my code? In-Reply-To: References: Message-ID: <5aeb9fc9f3e387e65fb70daeffcb9755@ruby-forum.com> Tim Mcd wrote: > I'm trying to get a project done: Making a GUI for my MUD client. I seem > to be having some sort of bug, but I don't understand why. Perhaps > someone could take a look at my code? > It is at http://pastie.org/359700 > > --Thanks, > -- Zonbi. Gah, wrong version of the code, sorry. I would like to know there would I should insert a thread to handle input from the MUD? It would be like: Thread.new do || inp = $connection.recv(100000) nowai.frame2.text.write_text(inp) end -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Tue Jan 13 12:53:47 2009 From: lists at ruby-forum.com (John Griffiths) Date: Tue, 13 Jan 2009 18:53:47 +0100 Subject: [wxruby-users] displaying a progress dialog Message-ID: Hi, trying to display a progress dialog tied to a Frame using via... dlg = Wx::ProgressDialog.new("title", "task", max, self, Wx::PD_CAN_ABORT | Wx::PD_APP_MODAL) max and self both have valid values but everytime i try to use this i get... progress.rb:233:in `refresh': wrong # of arguments(2 for 0) (ArgumentError) any ideas or an example of one that works? (running this on osx leopard) -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Tue Jan 13 12:55:26 2009 From: lists at ruby-forum.com (John Griffiths) Date: Tue, 13 Jan 2009 18:55:26 +0100 Subject: [wxruby-users] set the background to a bitmap Message-ID: <0c7b9e7007abfda081af5044d8f9cafd@ruby-forum.com> Hi, any ideas whether you can set the background of a dialog to use an image? -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Tue Jan 13 13:10:38 2009 From: alex at pressure.to (Alex Fenton) Date: Tue, 13 Jan 2009 18:10:38 +0000 Subject: [wxruby-users] set the background to a bitmap In-Reply-To: <0c7b9e7007abfda081af5044d8f9cafd@ruby-forum.com> References: <0c7b9e7007abfda081af5044d8f9cafd@ruby-forum.com> Message-ID: <496CD91E.1020904@pressure.to> John Griffiths wrote: > any ideas whether you can set the background of a dialog to use an > image? Use evt_erase_background, which is meant for this: http://wxruby.rubyforge.org/doc/eraseevent.html The example below just fills with colour, but you could replace the call to gradient_fill_linear with one to DC#draw_bitmap or whatever other drawing/painting code yoou wanted. Please, just don't do anything as eyesore as this ... alex __ require 'wx' class BackgroundDialog < Wx::Dialog def initialize(parent) super(parent, :title => "dialog with background") Wx::TextCtrl.new(self, :value => 'foo', :pos => [ 50, 50 ]) evt_erase_background :on_erase_background end def on_erase_background(evt) # Use the event's DC object to draw whatever background you want evt.dc.gradient_fill_linear( client_rect, Wx::RED, Wx::BLACK, Wx::NORTH ) end end Wx::App.run do frame = Wx::Frame.new(nil, :title => 'frame') frame.show BackgroundDialog.new(frame).show end From alex at pressure.to Tue Jan 13 13:23:25 2009 From: alex at pressure.to (Alex Fenton) Date: Tue, 13 Jan 2009 18:23:25 +0000 Subject: [wxruby-users] displaying a progress dialog In-Reply-To: References: Message-ID: <496CDC1D.5030009@pressure.to> John Griffiths wrote: > Hi, trying to display a progress dialog tied to a Frame using via... > > dlg = Wx::ProgressDialog.new("title", "task", max, self, > Wx::PD_CAN_ABORT | Wx::PD_APP_MODAL) > > max and self both have valid values but everytime i try to use this i > get... > > progress.rb:233:in `refresh': wrong # of arguments(2 for 0) > (ArgumentError) Works fine for me with wxRuby 1.9.9 on Windows, and I've been using ProgressDialog on OS X recently and not had any problems. Are you in fact writing your own ProgressDialog subclass, and defining a method called 'refresh' in it? wxRuby calls 'refresh' upon Windows (with two arguments) when they need to be redrawn. This allows for custom handling in Ruby, but it will cause problems if you have a method with the same name that does something different. a From erubin at valcom.com Tue Jan 13 13:15:26 2009 From: erubin at valcom.com (Eric Rubin) Date: Tue, 13 Jan 2009 13:15:26 -0500 Subject: [wxruby-users] WxRuby with Ruby 1.9.1 for Windows? In-Reply-To: <0c7b9e7007abfda081af5044d8f9cafd@ruby-forum.com> Message-ID: I have a WxRuby app running on Windows and I want to try to port it to the new Ruby 1.9.1. I see wxruby-ruby19-1.9.8 gems for Darwin and Linux, but not for Windows. Is wxruby-ruby19-1.9.8 available for Windows yet? If not, when will it be available? And how stable is it? Thanks, Eric Rubin From lists at ruby-forum.com Tue Jan 13 16:17:55 2009 From: lists at ruby-forum.com (John Griffiths) Date: Tue, 13 Jan 2009 22:17:55 +0100 Subject: [wxruby-users] set the background to a bitmap In-Reply-To: <496CD91E.1020904@pressure.to> References: <0c7b9e7007abfda081af5044d8f9cafd@ruby-forum.com> <496CD91E.1020904@pressure.to> Message-ID: Thanks again Alex, will give that a go tomorrow and see how things turn out. Appreciate this -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Tue Jan 13 16:16:38 2009 From: lists at ruby-forum.com (John Griffiths) Date: Tue, 13 Jan 2009 22:16:38 +0100 Subject: [wxruby-users] displaying a progress dialog In-Reply-To: <496CDC1D.5030009@pressure.to> References: <496CDC1D.5030009@pressure.to> Message-ID: you might be on to something there, i'm trying to finish off someone else's project so will have a hunt for anything with the same name. Cheers Alex -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Tue Jan 13 16:11:32 2009 From: alex at pressure.to (Alex Fenton) Date: Tue, 13 Jan 2009 21:11:32 +0000 Subject: [wxruby-users] WxRuby with Ruby 1.9.1 for Windows? In-Reply-To: References: Message-ID: <496D0384.7020606@pressure.to> Eric Rubin wrote: > I have a WxRuby app running on Windows and I want to try to port it to the > new Ruby 1.9.1. I see wxruby-ruby19-1.9.8 gems for Darwin and Linux, but > not for Windows. Is wxruby-ruby19-1.9.8 available for Windows yet? If not, > when will it be available? We'll definitely have a ruby19 gem available for Windows for the upcoming 2.0 release (next week or so). Whether we offer both mingw and mswin32 for Ruby 1.9.1 is not yet finalised, but in practice they're interchangeable. There will certainly be mingw as that's the direction the OCI is going in (for good reasons, IMHO). > And how stable is it? Very. wxRuby has supported ruby 1.9 for a year now, and I switched over mainline dev of my app to it a few months ago. There are also a lot of changes in SVN HEAD which make it considerably more stable generally than the current beta releaes, 1.9.9. alex From tmcdowell at gmail.com Tue Jan 13 17:25:19 2009 From: tmcdowell at gmail.com (Timothy McDowell) Date: Tue, 13 Jan 2009 15:25:19 -0700 Subject: [wxruby-users] displaying a progress dialog In-Reply-To: <496CDC1D.5030009@pressure.to> References: <496CDC1D.5030009@pressure.to> Message-ID: <88e4f940901131425w5b981a2eu3cf539deca6466d3@mail.gmail.com> Excuse me for interrupting this, but how often is 'refresh' on a window called, and what are it's two arguments? On Tue, Jan 13, 2009 at 11:23 AM, Alex Fenton wrote: > John Griffiths wrote: > >> Hi, trying to display a progress dialog tied to a Frame using via... >> >> dlg = Wx::ProgressDialog.new("title", "task", max, self, >> Wx::PD_CAN_ABORT | Wx::PD_APP_MODAL) >> >> max and self both have valid values but everytime i try to use this i >> get... >> >> progress.rb:233:in `refresh': wrong # of arguments(2 for 0) >> (ArgumentError) >> > Works fine for me with wxRuby 1.9.9 on Windows, and I've been using > ProgressDialog on OS X recently and not had any problems. > > Are you in fact writing your own ProgressDialog subclass, and defining a > method called 'refresh' in it? wxRuby calls 'refresh' upon Windows (with two > arguments) when they need to be redrawn. This allows for custom handling in > Ruby, but it will cause problems if you have a method with the same name > that does something different. > > > a > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -- --Brains. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Tue Jan 13 19:44:37 2009 From: lists at ruby-forum.com (Lc Yeap) Date: Wed, 14 Jan 2009 01:44:37 +0100 Subject: [wxruby-users] Segmentation Fault : [i386-mswin32] in wxruby In-Reply-To: <496C7DF6.2040000@pressure.to> References: <7ddb5bf567bc873a48b8d552d006b641@ruby-forum.com> <496C58D8.6030106@pressure.to> <5a030dbaf3d0e751ff20554800cc4909@ruby-forum.com> <496C7DF6.2040000@pressure.to> Message-ID: <20843afc5fcaced2267bccba8cd84a4f@ruby-forum.com> Alex Fenton wrote: > Lc Yeap wrote >> thanks for your reply. after follow your instructions, I have been >> confirmed the version of wxruby that i used is correct, which is 1.9.9. >> But, still the same error observed. >> >> Attached is my sample code. The error pop up when i try to generate the >> 2nd file. > > I can reproduce the error with mswin32 1.9.9, but not with MingW on > Windows (either 1.9.9 or the latest development version). If someone has > a build of SVN HEAD build of mswin32 handy, perhaps they could give it a > go to see if it's resolved. > > As Kiril's said, it'd be easier and quicker to help further if you could > simplify this down a lot, to narrow down the source of the error. For > example, I started by removing the text writing routine, then the > confirmation dialog. Next step might be to remove all the controls > except the 'generate' button. > > I don't have time to keep tweaking and running and clicking through your > whole app right now, but if you provide a stripped-down sample > demonstrating the issue, I'm happy to work with that. > > alex Hi Kiril & Alex, Thanks for the advice and helps. I will try to simplified my code following the guidelines provided. sorry for not being clear at the beginning. Meanwhile, i will continue with my debugging works. Will keep on update if I have any finding. Thanks again. =) -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Wed Jan 14 02:16:13 2009 From: alex at pressure.to (Alex Fenton) Date: Wed, 14 Jan 2009 07:16:13 +0000 Subject: [wxruby-users] displaying a progress dialog In-Reply-To: <88e4f940901131425w5b981a2eu3cf539deca6466d3@mail.gmail.com> References: <496CDC1D.5030009@pressure.to> <88e4f940901131425w5b981a2eu3cf539deca6466d3@mail.gmail.com> Message-ID: <496D913D.5080303@pressure.to> Timothy McDowell wrote: > Excuse me for interrupting this, but how often is 'refresh' on a > window called, and what are it's two arguments? It's called when the window needs to be redrawn: http://wxruby.rubyforge.org/doc/window.html#Window_refresh I'm not 100% sure it's the best way for it to be called from wxRuby into user ruby code. It's something that makes sense the wxWidgets C++ way, but perhaps not the ruby way, where one would expect to stick to using evt_paint and/or evt_erase_background. In Ruby it can create surprising errors, as we've seen. It's something that's easy to change in the wrapping, any way. a From mario at ruby-im.net Wed Jan 14 02:20:39 2009 From: mario at ruby-im.net (Mario Steele) Date: Wed, 14 Jan 2009 01:20:39 -0600 Subject: [wxruby-users] displaying a progress dialog In-Reply-To: <88e4f940901131425w5b981a2eu3cf539deca6466d3@mail.gmail.com> References: <496CDC1D.5030009@pressure.to> <88e4f940901131425w5b981a2eu3cf539deca6466d3@mail.gmail.com> Message-ID: A refresh can't always be truely tested, cause it falls in the domain of the native OS, and under several different conditions in which a refresh will occur. Mainly, a refresh will occur for part of a window, when the OS Detects that another window has covered up the window, and needs to repaint the region. A full refresh will also occur, if you minimize your app, and then restore it, as well as Maximizing and Restoring. Refreshes of controls occur on a control by control basis, meaning that if Control X is updated, but Control Y isn't, Control X will get a refresh, while Control Y won't. So, as you can see, there are many variables in which a refresh can occur, but it's not always the same, and it's never a "timed" matter. It's an On-Demand deal. hth, Mario On Tue, Jan 13, 2009 at 4:25 PM, Timothy McDowell wrote: > Excuse me for interrupting this, but how often is 'refresh' on a window > called, and what are it's two arguments? > > > On Tue, Jan 13, 2009 at 11:23 AM, Alex Fenton wrote: > >> John Griffiths wrote: >> >>> Hi, trying to display a progress dialog tied to a Frame using via... >>> >>> dlg = Wx::ProgressDialog.new("title", "task", max, self, >>> Wx::PD_CAN_ABORT | Wx::PD_APP_MODAL) >>> >>> max and self both have valid values but everytime i try to use this i >>> get... >>> >>> progress.rb:233:in `refresh': wrong # of arguments(2 for 0) >>> (ArgumentError) >>> >> Works fine for me with wxRuby 1.9.9 on Windows, and I've been using >> ProgressDialog on OS X recently and not had any problems. >> >> Are you in fact writing your own ProgressDialog subclass, and defining a >> method called 'refresh' in it? wxRuby calls 'refresh' upon Windows (with two >> arguments) when they need to be redrawn. This allows for custom handling in >> Ruby, but it will cause problems if you have a method with the same name >> that does something different. >> >> >> a >> _______________________________________________ >> wxruby-users mailing list >> wxruby-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/wxruby-users >> > > > > -- > --Brains. > > _______________________________________________ > 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/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Wed Jan 14 07:24:48 2009 From: lists at ruby-forum.com (John Griffiths) Date: Wed, 14 Jan 2009 13:24:48 +0100 Subject: [wxruby-users] wxruby2::DefaultValidator not defined Message-ID: <53dba430d3fed9f886c9989e60e9979d@ruby-forum.com> Hi, trying to display a bitmap button, don't have a validator at the moment so using wxruby's defaultvalidator method, b = Wx::BitmapButton.new(self, 10, 'assets/images_only_btn.jpg', Wx::Point.new(170,210), Wx::Size.new(120,80), 0, Wx::DefaultValidator, 'Import Data') should work but just returns me with.. "uninitialized constant Wxruby2::DefaultValidator (NameError)" any ideas? can't find any examples anywhere, bit stuck -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Wed Jan 14 08:05:23 2009 From: alex at pressure.to (Alex Fenton) Date: Wed, 14 Jan 2009 13:05:23 +0000 Subject: [wxruby-users] wxruby2::DefaultValidator not defined In-Reply-To: <53dba430d3fed9f886c9989e60e9979d@ruby-forum.com> References: <53dba430d3fed9f886c9989e60e9979d@ruby-forum.com> Message-ID: <496DE313.8000401@pressure.to> John Griffiths wrote: > Hi, trying to display a bitmap button, don't have a validator at the > moment so using wxruby's defaultvalidator method, > > b = Wx::BitmapButton.new(self, 10, 'assets/images_only_btn.jpg', > This should be Wx::Bitmap.new('assets/images_only_btn.jpg') > Wx::Point.new(170,210), Wx::Size.new(120,80), 0, Wx::DefaultValidator, > 'Import Data') > > should work but just returns me with.. > > "uninitialized constant Wxruby2::DefaultValidator (NameError)" It's not a method, it's a constant, and its name is Wx::DEFAULT_VALIDATOR. I've corrected the wrong naming of this in the documentation, sorry for the trouble. By the way, this isn't going to do what I'm guessing you want - display a button with an image and some text. The 'name' parameter only provides an internal reference name to any Window; I've never seen it used. There's no default widget to draw a bitmap + text button in wxRuby, because there isn't one in wxWidgets 2.8. The reason given for this is that that button style isn't part of the desktop standard on either Windows or OS X. It happens in Windows because there is little interface consistency, but it would look quite wrong on OS X. If you give an ordinary Wx::Button a 'stock id' eg Wx::ID_OPEN, it will be given the appropriate theme image on Linux/GTK. I think that the wx developers have given in to people frequently asking for this and intend to add a bitmap + text button to wx 3.0 alex From lists at ruby-forum.com Wed Jan 14 08:17:15 2009 From: lists at ruby-forum.com (John Griffiths) Date: Wed, 14 Jan 2009 14:17:15 +0100 Subject: [wxruby-users] wxruby2::DefaultValidator not defined In-Reply-To: <496DE313.8000401@pressure.to> References: <53dba430d3fed9f886c9989e60e9979d@ruby-forum.com> <496DE313.8000401@pressure.to> Message-ID: <4c2ecf532db05f29ca51622bea4c6133@ruby-forum.com> thanks, i sorted the problem below... b_import_bmp_on = Wx::Bitmap.new('assets/images_only_btn_on.gif', BITMAP_TYPE_GIF) b = Wx::BitmapButton.new(self, 10, b_import_bmp_off, Wx::Point.new(60,50), Wx::Size.new(73,21)) b.bitmap_selected = b_import_bmp_on works well, agree the documentation needs a bit of an overhaul, if only for more examples may try adding to it after i get this task done. great work and thanks again Alex, -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Wed Jan 14 17:53:22 2009 From: lists at ruby-forum.com (Tim Mcd) Date: Wed, 14 Jan 2009 23:53:22 +0100 Subject: [wxruby-users] Initializing a Frame seems to fail... Message-ID: <14f405d9592cc94922602fda728185d3@ruby-forum.com> /usr/bin/ruby -w /Users/Tim/wxrmc.rb /Users/Tim/wxrmc.rb:9:in `new': Error initializing # (ArgumentError) : Wrong arguments for overloaded method 'wxFrame.new'. Possible C/C++ prototypes are: wxFrame.new() wxFrame.new(wxWindow *parent, wxWindowID id, wxString const &title, wxPoint const &pos, wxSize const &size, long style, wxString const &name) Correct parameters for Wxruby2::Frame.new are: :id => (Fixnum) :title => (String) :pos => (Wxruby2::Point) :size => (Wxruby2::Size) :style => (Fixnum) :name => (String) from /Users/Tim/wxrmc.rb:9:in `on_init' from /Users/Tim/wxrmc.rb:21:in `main_loop' from /Users/Tim/wxrmc.rb:21 Compilation exited abnormally with code 1 at Wed Jan 14 15:46:45 Thats the error for this line: @frame = Frame.new(nil, -1, "Ruby Mud Client", DEFAULT_POSITION, Point.new(300, 875)) of this code: http://pastie.org/360951 Anyone know what it means by 'Wrong Arguments'? I'm fairly certain that those arguments are correct... -- Posted via http://www.ruby-forum.com/. From mario at ruby-im.net Wed Jan 14 18:12:56 2009 From: mario at ruby-im.net (Mario Steele) Date: Wed, 14 Jan 2009 17:12:56 -0600 Subject: [wxruby-users] Initializing a Frame seems to fail... In-Reply-To: <14f405d9592cc94922602fda728185d3@ruby-forum.com> References: <14f405d9592cc94922602fda728185d3@ruby-forum.com> Message-ID: Here is your problem @frame = Frame.new(nil, -1, "Ruby Mud Client", DEFAULT_POSITION, Point.new(300, 875)) ^^^^^^^^^^^^^^^^^^^ That actually needs to be Size.new(300,875), or you can just pass [300,875], and that will work as well. On Wed, Jan 14, 2009 at 4:53 PM, Tim Mcd wrote: > /usr/bin/ruby -w /Users/Tim/wxrmc.rb > /Users/Tim/wxrmc.rb:9:in `new': Error initializing # > (ArgumentError) > : Wrong arguments for overloaded method 'wxFrame.new'. > Possible C/C++ prototypes are: > wxFrame.new() > wxFrame.new(wxWindow *parent, wxWindowID id, wxString const &title, > wxPoint const &pos, wxSize const &size, long style, wxString const > &name) > > Correct parameters for Wxruby2::Frame.new are: > :id => (Fixnum) > :title => (String) > :pos => (Wxruby2::Point) > :size => (Wxruby2::Size) > :style => (Fixnum) > :name => (String) > from /Users/Tim/wxrmc.rb:9:in `on_init' > from /Users/Tim/wxrmc.rb:21:in `main_loop' > from /Users/Tim/wxrmc.rb:21 > > Compilation exited abnormally with code 1 at Wed Jan 14 15:46:45 > > Thats the error for this line: > @frame = Frame.new(nil, -1, "Ruby Mud Client", DEFAULT_POSITION, > Point.new(300, 875)) > of this code: > > http://pastie.org/360951 > > Anyone know what it means by 'Wrong Arguments'? I'm fairly certain that > those arguments are correct... > -- > 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/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From alex at pressure.to Wed Jan 14 18:14:23 2009 From: alex at pressure.to (Alex Fenton) Date: Wed, 14 Jan 2009 23:14:23 +0000 Subject: [wxruby-users] Initializing a Frame seems to fail... In-Reply-To: <14f405d9592cc94922602fda728185d3@ruby-forum.com> References: <14f405d9592cc94922602fda728185d3@ruby-forum.com> Message-ID: <496E71CF.2090005@pressure.to> Tim Mcd wrote: > Correct parameters for Wxruby2::Frame.new are: > :id => (Fixnum) > :title => (String) > :pos => (Wxruby2::Point) > :size => (Wxruby2::Size) > :style => (Fixnum) > :name => (String) > from /Users/Tim/wxrmc.rb:9:in `on_init' > from /Users/Tim/wxrmc.rb:21:in `main_loop' > from /Users/Tim/wxrmc.rb:21 > > .... > Thats the error for this line: > @frame = Frame.new(nil, -1, "Ruby Mud Client", DEFAULT_POSITION, > Point.new(300, 875)) > Check again: you should be passing a Wx::Size here, not a Wx::Point - you've already passed in the position with DEFAULT_POSITION. It's often easier and less error-prone to use named arguments for these constructors: Wx::Frame.new(nil, :title => 'Ruby Mud Client', :pos => [300, 875] ) The other values will get the defaults eg -1, DEFAULT_POSITION a From lists at ruby-forum.com Wed Jan 14 18:45:06 2009 From: lists at ruby-forum.com (Tim Mcd) Date: Thu, 15 Jan 2009 00:45:06 +0100 Subject: [wxruby-users] Initializing a Frame seems to fail... In-Reply-To: References: <14f405d9592cc94922602fda728185d3@ruby-forum.com> Message-ID: <470521718f47a0bf9d203b3ef28eddf0@ruby-forum.com> Mario Steele wrote: > Here is your problem > > @frame = Frame.new(nil, -1, "Ruby Mud Client", DEFAULT_POSITION, > Point.new(300, 875)) > > ^^^^^^^^^^^^^^^^^^^ > > That actually needs to be Size.new(300,875), or you can just pass > [300,875], > and that will work as well. Hey, thanks you two! I thought that it only put in the Defaults for things you dont specify, and you had to specify in order. -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Wed Jan 14 18:47:46 2009 From: lists at ruby-forum.com (Tim Mcd) Date: Thu, 15 Jan 2009 00:47:46 +0100 Subject: [wxruby-users] Initializing a Frame seems to fail... In-Reply-To: <470521718f47a0bf9d203b3ef28eddf0@ruby-forum.com> References: <14f405d9592cc94922602fda728185d3@ruby-forum.com> <470521718f47a0bf9d203b3ef28eddf0@ruby-forum.com> Message-ID: Tim Mcd wrote: > Mario Steele wrote: >> Here is your problem >> >> @frame = Frame.new(nil, -1, "Ruby Mud Client", DEFAULT_POSITION, >> Point.new(300, 875)) >> >> ^^^^^^^^^^^^^^^^^^^ >> >> That actually needs to be Size.new(300,875), or you can just pass >> [300,875], >> and that will work as well. > > Hey, thanks you two! I thought that it only put in the Defaults for > things you dont specify, and you had to specify in order. Meep! Now it runs really slowly... Like the inputbar and textview don't even initialize... -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Wed Jan 14 18:51:22 2009 From: lists at ruby-forum.com (Tim Mcd) Date: Thu, 15 Jan 2009 00:51:22 +0100 Subject: [wxruby-users] Initializing a Frame seems to fail... In-Reply-To: References: <14f405d9592cc94922602fda728185d3@ruby-forum.com> <470521718f47a0bf9d203b3ef28eddf0@ruby-forum.com> Message-ID: <42cf472ff0627b8927a217b621cc87f0@ruby-forum.com> This is after I had .shows for everything, mind you. -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Jan 15 05:29:18 2009 From: lists at ruby-forum.com (David Muir) Date: Thu, 15 Jan 2009 11:29:18 +0100 Subject: [wxruby-users] wxRuby dialog separate from main Ruby script execution Message-ID: <24442dc1d0434e0053c9570873a13214@ruby-forum.com> Hi, We have quite a large codebase in Ruby which uses Log4r to log errors, warnings etc. I have been trying to create a log window dialog using wxRuby that can be popped up if a piece of code generates an error or warning in one of our scripts. E.g. GUI::LogWindow::show_dialog( ) do # Do something that will log messages. end def LogWindow::show_dialog( log, auto_popup = false, title = 'Log', &block ) log_window_thread = Thread.new do begin LogDialogApp.new( log, auto_popup, title ).main_loop( ) rescue Exception => ex throw unless ( 'exit' == ex.message ) end end yield if ( block_given? ) log_window_thread.join( ) end My current problem is that when the wxRuby's main_loop is invoked no Ruby code gets executed. Is there any way around this? Or is this a limitation of using wxRuby? Any suggestions appreciated. Cheers, David -- Posted via http://www.ruby-forum.com/. From mario at ruby-im.net Thu Jan 15 06:18:30 2009 From: mario at ruby-im.net (Mario Steele) Date: Thu, 15 Jan 2009 05:18:30 -0600 Subject: [wxruby-users] wxRuby dialog separate from main Ruby script execution In-Reply-To: <24442dc1d0434e0053c9570873a13214@ruby-forum.com> References: <24442dc1d0434e0053c9570873a13214@ruby-forum.com> Message-ID: Well, given the example, it's kinda confusing how you are setting this Log Window class up, and how things are truely initializing. First of all, you really should be starting the main_loop at the top level of your code, not inside a Window class method, even if it's a module/singleton method. Second, if your using threads, you need to setup a point for wxRuby to break from it's processing of code internally in the main_loop, to yield back control to Ruby under Ruby 1.8. Ruby 1.9 will work perfectly fine, as the threads are system native threads, not Green threads as in 1.8. Third, if you have a single point of entry into your own application, that starts everything off, it would be best to call that method inside the on_init of your App instance inside a thread, and then do the previous method of yielding control back to ruby from wxRuby. You can yield the control back to Ruby, by doing Wx::Timer.every(55) { Thread.pass }. This will execute a timer every 55 milliseconds, that will call Thread.pass to give the next thread a bit of the CPU Scheduling, before returning back to the wxRuby main_loop. Lastely, if you don't have a single point of entry into your application, then I would suggest making one, and doing as I described above, as this will make things easier to track, should something go wrong. hth, Mario On Thu, Jan 15, 2009 at 4:29 AM, David Muir wrote: > Hi, > > We have quite a large codebase in Ruby which uses Log4r to log errors, > warnings etc. I have been trying to create a log window dialog using > wxRuby that can be popped up if a piece of code generates an error or > warning in one of our scripts. > > E.g. > GUI::LogWindow::show_dialog( ) do > # Do something that will log messages. > end > > def LogWindow::show_dialog( log, auto_popup = false, title = 'Log', > &block ) > log_window_thread = Thread.new do > begin > LogDialogApp.new( log, auto_popup, title ).main_loop( ) > rescue Exception => ex > throw unless ( 'exit' == ex.message ) > end > end > > yield if ( block_given? ) > log_window_thread.join( ) > end > > My current problem is that when the wxRuby's main_loop is invoked no > Ruby code gets executed. Is there any way around this? Or is this a > limitation of using wxRuby? > > Any suggestions appreciated. > Cheers, > David > -- > 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/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From alex at pressure.to Thu Jan 15 06:29:10 2009 From: alex at pressure.to (Alex Fenton) Date: Thu, 15 Jan 2009 11:29:10 +0000 Subject: [wxruby-users] wxRuby dialog separate from main Ruby script execution In-Reply-To: <24442dc1d0434e0053c9570873a13214@ruby-forum.com> References: <24442dc1d0434e0053c9570873a13214@ruby-forum.com> Message-ID: <496F1E06.5080503@pressure.to> David Muir wrote: > My current problem is that when the wxRuby's main_loop is invoked no > Ruby code gets executed. Is there any way around this? Or is this a > limitation of using wxRuby? It's a limitation of Ruby 1.8's green threads with C-based event loops. There is a workaround - add something like this in your App.run block / App#on_init method: Wx::Timer.every(25) { Thread.pass } Alternately, use Ruby 1.9 which I find does not have this problem, because there are real system threads underneath Ruby threads. However you should not update a GUI from the non-main thread. For further, have a look at the etc/threaded.rb sample in the distribution, and previous discussions on this list on wxRuby + threads. hth a From lists at ruby-forum.com Thu Jan 15 07:23:49 2009 From: lists at ruby-forum.com (David Muir) Date: Thu, 15 Jan 2009 13:23:49 +0100 Subject: [wxruby-users] wxRuby dialog separate from main Ruby script execution In-Reply-To: <24442dc1d0434e0053c9570873a13214@ruby-forum.com> References: <24442dc1d0434e0053c9570873a13214@ruby-forum.com> Message-ID: <4bc5d38c6a56af472025cab28480c7a3@ruby-forum.com> Hi, Thanks for the swift responses guys. The reason I don't have a single point of entry, and spawned a thread for the UI, is because I want this as a bolt on to existing scripts. Such that existing scripts can be run with displaying a log when the end-user runs it or not displaying a UI when an automated process is running the script(s). Having said that I'll have a go at refactoring the log window taking your comments on board, and checking other threads, to see if I can work something out. Cheers, Dave -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Thu Jan 15 08:17:06 2009 From: alex at pressure.to (Alex Fenton) Date: Thu, 15 Jan 2009 13:17:06 +0000 Subject: [wxruby-users] wxRuby dialog separate from main Ruby script execution In-Reply-To: <4bc5d38c6a56af472025cab28480c7a3@ruby-forum.com> References: <24442dc1d0434e0053c9570873a13214@ruby-forum.com> <4bc5d38c6a56af472025cab28480c7a3@ruby-forum.com> Message-ID: <496F3752.30301@pressure.to> David Muir wrote: > The reason I don't have a single point of entry, and spawned a thread > for the UI, is because I want this as a bolt on to existing scripts. > > Such that existing scripts can be run with displaying a log when the > end-user runs it or not displaying a UI when an automated process is > running the script(s). I don't know Log4r but you can define custom Loggers etc. Define one that call Wx::log_message, Wx::log_warn etc in response to the Log4r calls in your core file. Your UI shell is going to look something like the structure below: hth alex __ require 'wx' ### Custom outputter /logger here # What to run scripts = [ 'foo.rb' ] Wx::App.run do Wx::log_message('Starting') t = Thread.new do scripts.each do | script | Wx::log_message("Running #{script}") load script end end Wx::Timer.every(25) { Thread.pass } true end From lists at ruby-forum.com Thu Jan 15 08:32:36 2009 From: lists at ruby-forum.com (John Griffiths) Date: Thu, 15 Jan 2009 14:32:36 +0100 Subject: [wxruby-users] displaying a progress dialog In-Reply-To: <496D913D.5080303@pressure.to> References: <496CDC1D.5030009@pressure.to> <88e4f940901131425w5b981a2eu3cf539deca6466d3@mail.gmail.com> <496D913D.5080303@pressure.to> Message-ID: <92a83aba667375dbc0514cd321afc012@ruby-forum.com> sorted, thanks guys... progress = Wx::ProgressDialog.new("Processing Images", "Processing Images...", 100, self, Wx::PD_CAN_ABORT|Wx::PD_APP_MODAL) works fine under windows and i can compile it to an exe with rubyscript2exe. -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Jan 15 08:36:44 2009 From: lists at ruby-forum.com (John Griffiths) Date: Thu, 15 Jan 2009 14:36:44 +0100 Subject: [wxruby-users] WxRuby with Ruby 1.9.1 for Windows? In-Reply-To: <496D0384.7020606@pressure.to> References: <0c7b9e7007abfda081af5044d8f9cafd@ruby-forum.com> <496D0384.7020606@pressure.to> Message-ID: <33fdfad4896b49fff3fd7294c386ff80@ruby-forum.com> Thanks Alex, I got the dialog to use a background image eventually, did this with WxRuby 1.9.9 on Windows XP and it works (doesn't on OSX, but don't need it to). def initialize(title) ...... evt_erase_background :on_erase_background end def on_erase_background(evt) b_splash_bmp = Wx::Bitmap.new('images/background.gif', BITMAP_TYPE_GIF) evt.dc.draw_bitmap(b_splash_bmp, 0, 0, false) end -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Jan 15 08:33:35 2009 From: lists at ruby-forum.com (John Griffiths) Date: Thu, 15 Jan 2009 14:33:35 +0100 Subject: [wxruby-users] displaying a progress dialog In-Reply-To: <92a83aba667375dbc0514cd321afc012@ruby-forum.com> References: <496CDC1D.5030009@pressure.to> <88e4f940901131425w5b981a2eu3cf539deca6466d3@mail.gmail.com> <496D913D.5080303@pressure.to> <92a83aba667375dbc0514cd321afc012@ruby-forum.com> Message-ID: and then update the dialog (for 5%, 10%, etc...) progress.update(count, "Processing: "+row[1].to_s) -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Jan 15 08:44:52 2009 From: lists at ruby-forum.com (John Griffiths) Date: Thu, 15 Jan 2009 14:44:52 +0100 Subject: [wxruby-users] Segmentation Fault : [i386-mswin32] in wxruby In-Reply-To: <20843afc5fcaced2267bccba8cd84a4f@ruby-forum.com> References: <7ddb5bf567bc873a48b8d552d006b641@ruby-forum.com> <496C58D8.6030106@pressure.to> <5a030dbaf3d0e751ff20554800cc4909@ruby-forum.com> <496C7DF6.2040000@pressure.to> <20843afc5fcaced2267bccba8cd84a4f@ruby-forum.com> Message-ID: had this problem on some database calls with Windows XP today too... Ruby 1.8.6 WxRuby 1.9.9 Windows Service Pack 2 What I had to do was fire the Garbage Collector before my mySQL calls GC.start res.each do |row| ... end And then call the rows specifically by number => row[1].to_s I was using row["name"] with res.each changed to res.each_hash, but it just kept flipping out with Segmentation Faults so i switched to the more simpler method above. After which it remained stable. Also got problems with NET::SFTP returning Segmentation Faults for Upload() calls, Ok with Connect() or Dir.foreach calls, but swapped that out with Putty's SCP for quickness. -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Jan 15 08:48:07 2009 From: lists at ruby-forum.com (John Griffiths) Date: Thu, 15 Jan 2009 14:48:07 +0100 Subject: [wxruby-users] ruby19-linux gem : AVAILABLE In-Reply-To: <496B9318.5080305@pressure.to> References: <4947B5ED.3020407@pressure.to> <4947CDD1.1020700@pressure.to> <4948452C.3020100@pressure.to> <376324F6-A003-494B-B08C-71824BE3C3D2@malkier.net> <4949258B.1020506@pressure.to> <49625FBD.8040808@pressure.to> <1ce38ef40901120914u5322311me684d5f5007b5e53@mail.gmail.com> <496B7F56.70608@pressure.to> <1ce38ef40901121006v32341233gec01690ada1364c1@mail.gmail.com> <496B9318.5080305@pressure.to> Message-ID: <6fb384c6bbbb6a679d9a6879d59e7b5b@ruby-forum.com> I needed these to make my WxRuby apps work, put them in your scripts local dir so it can find them MSVCP71.DLL msvcr71.dll should be able to find them from your Windows/System32 dir -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Jan 15 08:50:25 2009 From: lists at ruby-forum.com (John Griffiths) Date: Thu, 15 Jan 2009 14:50:25 +0100 Subject: [wxruby-users] Creating a Progress Bar In-Reply-To: <4962851A.8070407@pressure.to> References: <4962851A.8070407@pressure.to> Message-ID: solved a similar problem here... http://www.ruby-forum.com/topic/175626 Hope it helps, John. -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Jan 15 08:48:50 2009 From: lists at ruby-forum.com (John Griffiths) Date: Thu, 15 Jan 2009 14:48:50 +0100 Subject: [wxruby-users] ruby19-linux gem : AVAILABLE In-Reply-To: <6fb384c6bbbb6a679d9a6879d59e7b5b@ruby-forum.com> References: <4947B5ED.3020407@pressure.to> <4947CDD1.1020700@pressure.to> <4948452C.3020100@pressure.to> <376324F6-A003-494B-B08C-71824BE3C3D2@malkier.net> <4949258B.1020506@pressure.to> <49625FBD.8040808@pressure.to> <1ce38ef40901120914u5322311me684d5f5007b5e53@mail.gmail.com> <496B7F56.70608@pressure.to> <1ce38ef40901121006v32341233gec01690ada1364c1@mail.gmail.com> <496B9318.5080305@pressure.to> <6fb384c6bbbb6a679d9a6879d59e7b5b@ruby-forum.com> Message-ID: John Griffiths wrote: > I needed these to make my WxRuby apps work, put them in your scripts > local dir so it can find them > > MSVCP71.DLL > msvcr71.dll > > should be able to find them from your Windows/System32 dir forget this if you're not doing it on Windows btw -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Fri Jan 16 07:19:39 2009 From: lists at ruby-forum.com (David Muir) Date: Fri, 16 Jan 2009 13:19:39 +0100 Subject: [wxruby-users] =?utf-8?q?wxRuby_dialog_separate_from_main_Ruby_sc?= =?utf-8?q?ript=09execution?= In-Reply-To: <496F3752.30301@pressure.to> References: <24442dc1d0434e0053c9570873a13214@ruby-forum.com> <4bc5d38c6a56af472025cab28480c7a3@ruby-forum.com> <496F3752.30301@pressure.to> Message-ID: <00e6480cb75e1c2432cdcd4ff4e71eae@ruby-forum.com> Hi guys, I had some success yesterday so thought I should complete this thread by showing how I got it working. The LogWindowDialog class is not included because it includes a lot of details that are irrelevant for the topic. In that class I create a Log4r outputter and formatter to pass LogEvent objects straight to the dialog which are then serialised and output into a TextCtrl widget. Seems to work fairly well with the few examples I've tried. If the Ruby script kicks off an external app the UI will be unresponsive. Code below. Hope it helps others. Cheers, Dave # # == Description # Generic log window dialog that integrates with our Pipeline::Log # objects for displaying log messages to users. # # === Example Usage # # To auto-popup the display of the log dialog: # Pipeline::GUI::LogWindow::show_dialog( true ) do # # Do something that will log messages, dialog only displayed on # # errors. # end # # # To force the display of the log dialog: # Pipeline::GUI::LogWindow::show_dialog( ) do # # Do something that will log messages # end # class LogWindow < Wx::App #--------------------------------------------------------------------- # Class Methods #--------------------------------------------------------------------- def initialize( log, auto_popup, title = 'Log', &block ) super( ) @log = log @auto_popup = auto_popup @title = title @proc = Proc.new( ) do yield end end # # Use this method to explicitly display a log dialog box. Only # log messages generated after this call will be displayed. # def LogWindow::show_dialog( auto_popup = false, log = LogSystem::instance().rootlog, title = 'Log' ) begin dlg = LogWindow.new( log, auto_popup, title ) do yield if ( block_given? ) end dlg.main_loop( ) rescue Exception => ex throw ex unless ( 'exit' == ex.message ) end end #--------------------------------------------------------------------- # Instance Methods #--------------------------------------------------------------------- def on_init( ) Wx::Timer::every( 25 ) do Thread::pass( ) end dlg = LogWindowDialog::new( @log, @title, @auto_popup ) dlg.show( ) unless ( @auto_popup ) script_thread = Thread.new do @proc.call( ) exit( ) if ( @auto_popup and ( not dlg.is_shown ) ) end script_thread.join( ) end end # # == Description # Log window dialog. # class LogWindowDialog < Wx::Dialog ... end -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Fri Jan 16 09:15:01 2009 From: lists at ruby-forum.com (James Waudby) Date: Fri, 16 Jan 2009 15:15:01 +0100 Subject: [wxruby-users] help with project viewer Message-ID: <37eedde6b8b6841a48f908bacf91e011@ruby-forum.com> I've just begun using wxRuby and I've been finding my feet with things quite easily, however there's one thing I'm uncertain of at the moment which I'd like to do and that's a project viewer. I know that it would have to be using TreeCtrl. If someone could explain to me how to build a custom Tree with my own folders and files that would be really appreciated. I'm using it as a learning experience so that I can aid in creating a new IDE for the Sphere games engine. So there's already a file structure I just don't know how to recreate in in wxRuby. -- Posted via http://www.ruby-forum.com/. From mario at ruby-im.net Fri Jan 16 12:11:47 2009 From: mario at ruby-im.net (Mario Steele) Date: Fri, 16 Jan 2009 11:11:47 -0600 Subject: [wxruby-users] help with project viewer In-Reply-To: <37eedde6b8b6841a48f908bacf91e011@ruby-forum.com> References: <37eedde6b8b6841a48f908bacf91e011@ruby-forum.com> Message-ID: Hey James, If your interested in a way to setup projects, take a look at my IDE that I've been working on. Currently, I'm in the process of re-implementing everything, but you can get a basics for what I did, in the old Subverison repo, found here: http://wxride.rubyforge.org/svn/branch/alpha/wxRIDE/ The main points that you would want to look at, is lib/project.rb, and lib/ui/PrjTree.rb and lib/ui/ProjectTree.rb. PrjTree.rb is the current one used by the cold, and ProjectTree.rb is the old one. It gives you two ideas on ways to go about this. hth, Mario On Fri, Jan 16, 2009 at 8:15 AM, James Waudby wrote: > I've just begun using wxRuby and I've been finding my feet with things > quite easily, however there's one thing I'm uncertain of at the moment > which I'd like to do and that's a project viewer. > > I know that it would have to be using TreeCtrl. > > If someone could explain to me how to build a custom Tree with my own > folders and files that would be really appreciated. > > I'm using it as a learning experience so that I can aid in creating a > new IDE for the Sphere games engine. So there's already a file structure > I just don't know how to recreate in in wxRuby. > -- > 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/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From alex at pressure.to Sat Jan 17 03:43:48 2009 From: alex at pressure.to (Alex Fenton) Date: Sat, 17 Jan 2009 08:43:48 +0000 Subject: [wxruby-users] help with project viewer In-Reply-To: <37eedde6b8b6841a48f908bacf91e011@ruby-forum.com> References: <37eedde6b8b6841a48f908bacf91e011@ruby-forum.com> Message-ID: <49719A44.8040900@pressure.to> James Waudby wrote: > I've just begun using wxRuby and I've been finding my feet with things > quite easily, however there's one thing I'm uncertain of at the moment > which I'd like to do and that's a project viewer. > > I know that it would have to be using TreeCtrl. > > If someone could explain to me how to build a custom Tree with my own > folders and files that would be really appreciated. Firstly, there's a generic directory / file tree widget built-in with wxRuby., called GenericDirCtrl. This is built using TreeCtrl, so if you know C++ it's a decent source for study. One challenge can be that traversing a large file system in Ruby is slow so the tree is slow to present. To get round this, you only present the currently open items (adding them via append_item). For each item that is a directory, call set_item_has_children to display it with an unopened 'expand' button. Then provide an evt_tree_item_expanding event handler that appends the file/directory children as a directory is opened. You'll probably want to use the item_data field (which attaches any Ruby object to an item in the treectrl) to store fuller information about each file/directory. This could just be the full path, or it could be a hash with extra info (eg SVN status, or stat-like data). Each icon that you might use is stored in a ImageList, and the index of the relevant image (depending on file type, for example) is passed to calls to append_item / add_item. As an aside, it would be nice to have a model-based TreeCtrl - one where a non-GUI class defines how objects are fetched and related, and the GUI class does the presenting work. It's a nice way to write code, I find, for Grid - GridTableBase - and the development version of wxWidgets supports this, I believe. a From alex at pressure.to Sat Jan 17 03:48:11 2009 From: alex at pressure.to (Alex Fenton) Date: Sat, 17 Jan 2009 08:48:11 +0000 Subject: [wxruby-users] wxRuby dialog separate from main Ruby script execution In-Reply-To: <00e6480cb75e1c2432cdcd4ff4e71eae@ruby-forum.com> References: <24442dc1d0434e0053c9570873a13214@ruby-forum.com> <4bc5d38c6a56af472025cab28480c7a3@ruby-forum.com> <496F3752.30301@pressure.to> <00e6480cb75e1c2432cdcd4ff4e71eae@ruby-forum.com> Message-ID: <49719B4B.2020905@pressure.to> David Muir wrote: > I had some success yesterday so thought I should complete this thread by > showing how I got it working. > Thanks for sharing this. > Seems to work fairly well with the few examples I've tried. If the Ruby > script kicks off an external app the UI will be unresponsive. > The trick is to call Wx::app.yield or Wx::safe_yield (the latter in SVN only), while an external task is running, to tell Wx to process events and update the UI alex From lists at ruby-forum.com Sat Jan 17 14:43:29 2009 From: lists at ruby-forum.com (James Waudby) Date: Sat, 17 Jan 2009 20:43:29 +0100 Subject: [wxruby-users] help with project viewer In-Reply-To: References: <37eedde6b8b6841a48f908bacf91e011@ruby-forum.com> Message-ID: Thanks for the replies. I'll take a look at those files you linked to. I'm still trying to find my feet with the system but should hopefully pick it up fairly easily. Obviously, i'll post here again if I get stuck. -- Posted via http://www.ruby-forum.com/. From bureaux.sebastien at neuf.fr Mon Jan 19 13:01:10 2009 From: bureaux.sebastien at neuf.fr (sebastien) Date: Mon, 19 Jan 2009 19:01:10 +0100 Subject: [wxruby-users] wxruby et ubuntu Message-ID: <81F83CBFDA5E423C8C2C4D06E4819196@sebastien> Bonjour. Je voudrais savoir ce qu'il faut installer sur ubuntu pour pouvoir cr?er des applications avec wxruby? Pouvez-vous m'indiquer des liens qui pourraient me renseigner sur l'installation? Est-il possible d'installer sur linux le n?cessaire et entre autre wxruby? Je ne connais pas du tout la programmation sur linux. Je vous remercie. S?bastien http://beusse.liveror.com/ -------------- section suivante -------------- Une pi?ce jointe HTML a ?t? nettoy?e... URL: From chauk.mean at gmail.com Tue Jan 20 03:25:11 2009 From: chauk.mean at gmail.com (Chauk-Mean P) Date: Tue, 20 Jan 2009 09:25:11 +0100 Subject: [wxruby-users] wxruby et ubuntu In-Reply-To: <81F83CBFDA5E423C8C2C4D06E4819196@sebastien> References: <81F83CBFDA5E423C8C2C4D06E4819196@sebastien> Message-ID: Bonjour, 2009/1/19 sebastien : > Bonjour. > Je voudrais savoir ce qu'il faut installer sur ubuntu pour pouvoir cr?er des > applications avec wxruby? 1. Ouvre une ligne de commande 2. Commence par installer ruby : sudo apt-get install ruby 3. Puis installe wxruby : sudo gem install wxruby > Je ne connais pas du tout la programmation sur linux. Tu auras une installation fonctionnelle de wxRuby. Tu peux utiliser l'?diteur gedit pour ?diter le code source Ruby. Chauk-Mean. From alex at pressure.to Tue Jan 20 06:30:10 2009 From: alex at pressure.to (Alex Fenton) Date: Tue, 20 Jan 2009 11:30:10 +0000 Subject: [wxruby-users] wxruby et ubuntu In-Reply-To: References: <81F83CBFDA5E423C8C2C4D06E4819196@sebastien> Message-ID: <4975B5C2.6010702@pressure.to> Chauk-Mean P wrote: > 2009/1/19 sebastien : > >> Bonjour. >> Je voudrais savoir ce qu'il faut installer sur ubuntu pour pouvoir cr?er des >> applications avec wxruby? >> > > 1. Ouvre une ligne de commande > > 2. Commence par installer ruby : > sudo apt-get install ruby > (et en plus) 2.5 sudo apt-get libwxgtk2.8 (depuis wxRuby version 1.9.9) > 3. Puis installe wxruby : > sudo gem install wxruby > alex From lists at ruby-forum.com Tue Jan 20 06:38:49 2009 From: lists at ruby-forum.com (Zhimin Zhan) Date: Tue, 20 Jan 2009 12:38:49 +0100 Subject: [wxruby-users] Menu.delete returned "wrong # of argument" on Mac Message-ID: Hi, I was trying to delete menu items in a submenu, the code worked fine on Windows, but failed on Mac. I modified the sample bigdemo/wxMenu.rbw, def menu_101(event) @log.write_text("Welcome to Mercury") # New here, change submenu to @submenu in initialize() @submenu.get_menu_items.each do |menu_item| @submenu.delete(menu_item) end end Error: wxMenu.rbw:140:in `delete': Wrong arguments for overloaded method 'wxMenu.Delete'. (ArgumentError) Possible C/C++ prototypes are: void wxMenu.Delete(int id) void wxMenu.Delete(wxMenuItem *item) wxRuby 1.9.9 Platform: Mac OS X Thanks, Zhimin -- Posted via http://www.ruby-forum.com/. From bureaux.sebastien at neuf.fr Tue Jan 20 11:59:01 2009 From: bureaux.sebastien at neuf.fr (sebastien) Date: Tue, 20 Jan 2009 17:59:01 +0100 Subject: [wxruby-users] wxruby et ubuntu In-Reply-To: <4975B5C2.6010702@pressure.to> Message-ID: Je vais d?j? commencer par l'installation. J'ai aussi trouv? quelques liens explicatif entre temps. Je vous remercie. S?bastien http://beusse.liveror.com/ -------------- section suivante -------------- Une pi?ce jointe HTML a ?t? nettoy?e... URL: From lists at ruby-forum.com Wed Jan 21 20:06:01 2009 From: lists at ruby-forum.com (Ridge Mcghee) Date: Thu, 22 Jan 2009 02:06:01 +0100 Subject: [wxruby-users] Copy/Paste problems in dragdrop.rb Message-ID: <99d42665179137bf72b4f213cc583cc8@ruby-forum.com> Windows XP Professional + SP3 ruby 1.8.6 wxRuby 1.9.9 The drag and drop sample results in segmentation faults. Instructions to reproduce: 1. Run dragdrop.rb (.../samples/dragdrop/dragdrop.rb) 2. Click on Clipboard tab 3. Click on Copy image button (Immediate segmentation fault on my system) 1. Run dragdrop.rb 2. Click on Clipboard tab 3. Type some text in TextCtrl 4. Click the Copy text button 5. Click the Paste button 3 times (Segmentation fault 7 times in 10) 6. Repeat 4. and 5. (Segmentation fault 10 times in 10 within a few iterations) 1. Run dragdrop.rb 2. Click on Clipboard tab 3. Type some text in TextCtrl 4. Click the Copy text button 5. Resize the window 6. Click the Paste button (Immediate segmentation fault) I believe I installed wxSugar but am not using it (no require 'wxSugar' in dragdrop.rb) Interestingly, .../wx/accessors.rb seems to reference wxSugar. Anyone else able to reproduce? Ridge -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Fri Jan 23 07:00:21 2009 From: alex at pressure.to (Alex Fenton) Date: Fri, 23 Jan 2009 12:00:21 +0000 Subject: [wxruby-users] Copy/Paste problems in dragdrop.rb In-Reply-To: <99d42665179137bf72b4f213cc583cc8@ruby-forum.com> References: <99d42665179137bf72b4f213cc583cc8@ruby-forum.com> Message-ID: <4979B155.6030904@pressure.to> Hi Ridge Ridge Mcghee wrote: > Windows XP Professional + SP3 > ruby 1.8.6 > wxRuby 1.9.9 > > The drag and drop sample results in segmentation faults. > Thanks for the report. I hadn't realised there was this problem in 1.9.9. The development version of wxRuby contains a major rework of the classes used in DnD and Clipboard, which have been very tricky to port because of the way they're designed in wxWidgets. We've still got one problem with Clipboard on Windows, but this is a blocking issue (actually, now the only one) for wxRuby 2.0, so it will be fixed for the next release. cheers alex From alex at pressure.to Fri Jan 23 07:27:25 2009 From: alex at pressure.to (Alex Fenton) Date: Fri, 23 Jan 2009 12:27:25 +0000 Subject: [wxruby-users] Menu.delete returned "wrong # of argument" on Mac In-Reply-To: References: Message-ID: <4979B7AD.7000001@pressure.to> Hi Zhimin Zhimin Zhan wrote: > I was trying to delete menu items in a submenu, the code worked fine on > Windows, but failed on Mac. > > I modified the sample bigdemo/wxMenu.rbw, > > def menu_101(event) > @log.write_text("Welcome to Mercury") > # New here, change submenu to @submenu in initialize() > @submenu.get_menu_items.each do |menu_item| > @submenu.delete(menu_item) > end > end > > Error: > wxMenu.rbw:140:in `delete': Wrong arguments for overloaded method > 'wxMenu.Delete'. (ArgumentError) > Possible C/C++ prototypes are: > void wxMenu.Delete(int id) > void wxMenu.Delete(wxMenuItem *item) > Thanks for the report and sample code. I tried this out with 1.9.9 and I get an error (although a slightly different one). I tried it with SVN HEAD (with ruby 1.8.6 and 1.9.1) and it works correctly, no error is raised. I believe it may have been fixed by a change I applied following this previous thread, so that MenuItems are correctly preserved from GC: http://rubyforge.org/pipermail/wxruby-users/2009-January/004400.html So the problem should already be resolved by the next release. thanks again alex From lists at ruby-forum.com Sat Jan 24 12:14:00 2009 From: lists at ruby-forum.com (Rooby Nooby) Date: Sat, 24 Jan 2009 18:14:00 +0100 Subject: [wxruby-users] Problem running Samples Message-ID: Hi. I'm desperately trying to learn Ruby and wxWidgets, on my 64-bit Linux machine. However when I try to run any of the samples from the command line I get the following error message: ruby: symbol lookup error: /usr/lib/ruby/gems/1.8/gems/wxruby-1.9.8-x86_64-linux/lib/wxruby2.so: undefined symbol: Init_wxMediaCtrl I'd be very grateful for any help. Many thanks in advance! -- Posted via http://www.ruby-forum.com/. From ruby.student at gmail.com Thu Jan 29 13:23:00 2009 From: ruby.student at gmail.com (Ruby Student) Date: Thu, 29 Jan 2009 13:23:00 -0500 Subject: [wxruby-users] Help understanding EVERYTHING Message-ID: <345817580901291023v4fbeb178wd2d67ea34c22dc26@mail.gmail.com> Team, I am trying to learn a GUI for Ruby and I picked wxRuby. The problem is that I am kind of slow learning this and I now feel frustrated after trying for about at least 7 hours. I am trying to design a simple Sudoku 9x9 grid to display numbers, 1 - 9, using buttons. I posted a question on Ruby forum ruby-talk and a gentleman, Alex Fenton, answered my questions. Alex gave me what appear to be great hints. However, as I said earlier, I am kind of slow and learn by example. I tried reading the bigdemo that comes with wxruby and looked on RDOC and google, but can't find any help. Alex suggested to use this forum to get help. I don't want you to provide me with a solution but I need some solid hints, if you have the time and will not mind helping me. I am including a code that I am using to play and learn wxruby. Please take a look at it and see if you can tell me why I can't display all the buttons a defined. Only the first button, 1, is displayed. Once I get those working I will be able to add the rest. The total for a "normal" Sudoku puzzle is 81 for the 9x9 grid. Thank you very much for your help. PS: Is there a wxruby book that I can purchase? -- Ruby Student -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean.m.long at gmail.com Thu Jan 29 15:32:19 2009 From: sean.m.long at gmail.com (Sean Long) Date: Thu, 29 Jan 2009 12:32:19 -0800 Subject: [wxruby-users] Help understanding EVERYTHING In-Reply-To: <345817580901291023v4fbeb178wd2d67ea34c22dc26@mail.gmail.com> References: <345817580901291023v4fbeb178wd2d67ea34c22dc26@mail.gmail.com> Message-ID: Your message does not have any code attached. Might want to repost with the attachment. Sean On Thu, Jan 29, 2009 at 10:23 AM, Ruby Student wrote: > Team, > > I am trying to learn a GUI for Ruby and I picked wxRuby. > The problem is that I am kind of slow learning this and I now feel > frustrated after trying for about at least 7 hours. > I am trying to design a simple Sudoku 9x9 grid to display numbers, 1 - 9, > using buttons. > I posted a question on Ruby forum ruby-talk and a gentleman, Alex Fenton, > answered my questions. > Alex gave me what appear to be great hints. However, as I said earlier, I am > kind of slow and learn by example. > I tried reading the bigdemo that comes with wxruby and looked on RDOC and > google, but can't find any help. > Alex suggested to use this forum to get help. > > I don't want you to provide me with a solution but I need some solid hints, > if you have the time and will not mind helping me. > > I am including a code that I am using to play and learn wxruby. Please take > a look at it and see if you can tell me why I can't display all the buttons > a defined. Only the first button, 1, is displayed. > Once I get those working I will be able to add the rest. The total for a > "normal" Sudoku puzzle is 81 for the 9x9 grid. > > Thank you very much for your help. > > PS: Is there a wxruby book that I can purchase? > -- > Ruby Student > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > From lists at ruby-forum.com Thu Jan 29 16:04:38 2009 From: lists at ruby-forum.com (Alexander Hawley) Date: Thu, 29 Jan 2009 22:04:38 +0100 Subject: [wxruby-users] Control Characters Message-ID: <1908c1638028a3c1adff82cb596cc1e6@ruby-forum.com> I am attempting a text editor using wxRuby. I'm having character issues. Strings are not binary-safe. Some characters are not allowed. - newline / line feed (\n), tab (\t) are displayed - carraige return (\r) is stripped - Other control characters and high-ascii cause control values to become empty. Affected controls include: Wx::TextCtrl, Wx::StaticText, Wx::Clipboard, et al. Most text editors allow editing of recognized characters (in whatever specified format without disrupting unknown characters. Known control/special characters are hidden unless usually printable (CR, LF, HT). When "highlight special characters" is enabled, they are displayed as their abbr or icon: "[CR]","[LF]","[HT]","[NUL]". For example, editors Scite, ConTEXT, et al. The only solution I can come come up with is to implement folding using XML or similar. The real document is sanitized before displayed in the control. When the control is edited, a compare is performed and the real document is modified accordingly. The Wx::Clipboard is even worse. If I copy text from non UTF-8, the original encoding/binary is lost. Ug. Thoughts? Thanks in advance. -AH -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Thu Jan 29 19:41:18 2009 From: alex at pressure.to (Alex Fenton) Date: Fri, 30 Jan 2009 00:41:18 +0000 Subject: [wxruby-users] Control Characters In-Reply-To: <1908c1638028a3c1adff82cb596cc1e6@ruby-forum.com> References: <1908c1638028a3c1adff82cb596cc1e6@ruby-forum.com> Message-ID: <49824CAE.5010405@pressure.to> Hi Alexander Hawley wrote: > I am attempting a text editor using wxRuby. I'm having character issues. > > Strings are not binary-safe. > > Some characters are not allowed. > Can you explain what you mean - when they are being set from Ruby to the control (eg TextCtrl#value=) or retrieving user input from the GUI? Ideally a short test case or example bit of code which shows what's going on. > - newline / line feed (\n), tab (\t) are displayed > - carraige return (\r) is stripped > - Other control characters and high-ascii cause control values to become > empty. > > Affected controls include: Wx::TextCtrl, Wx::StaticText, Wx::Clipboard, > et al. > > Most text editors allow editing of recognized characters (in whatever > specified format without disrupting unknown characters. > How it's expected to work: all strings passed into wxRuby should be UTF-8; all strings returned from wxRuby will be UTF-8. If you have data (eg read from a file/) in another encoding, you need to use Iconv or similar to fix that. > Known control/special characters are hidden unless usually printable > (CR, LF, HT). When "highlight special characters" is enabled, they are > displayed as their abbr or icon: "[CR]","[LF]","[HT]","[NUL]". > > For example, editors Scite, ConTEXT, et al. > If you want a code-oriented text editor, you probably want to use Wx::StyledTextCtrl as the base for your text control. It's the same editing/highlighting component used by Scite. > The only solution I can come come up with is to implement folding using > XML or similar. The real document is sanitized before displayed in the > control. When the control is edited, a compare is performed and the real > document is modified accordingly. > > The Wx::Clipboard is even worse. If I copy text from non UTF-8, the > original encoding/binary is lost. Ug. A short test case would really help here: what DataObject, what platform, what version etc. a From lists at ruby-forum.com Fri Jan 30 10:25:49 2009 From: lists at ruby-forum.com (Alexander Hawley) Date: Fri, 30 Jan 2009 16:25:49 +0100 Subject: [wxruby-users] Control Characters In-Reply-To: <49824CAE.5010405@pressure.to> References: <1908c1638028a3c1adff82cb596cc1e6@ruby-forum.com> <49824CAE.5010405@pressure.to> Message-ID: Thanks for your quick response! > Strings are not binary-safe. > Some characters are not allowed. > Can you explain what you mean - when they are being set from Ruby to the control (eg TextCtrl#value=) or retrieving user input from the GUI? > Ideally a short test case or example bit of code which shows what's going on. This script shows the different behavior for starting Wx::TextCtrl values. ........................................ require "wx" class TheApp < Wx::App def on_init frame = Wx::Frame.new(nil, -1, "TheApp") sizer = Wx::FlexGridSizer.new(2,4) string = "fooboo" # string = "foo\xC2\xA5boo" # string = "foo\xE2\x90\x80boo" # string = "foo\x1Fboo" # string = "foo\x0boo" # string = "foo\x95boo" puts "ruby string:\t#{string.length} #{string.inspect} #{string.unpack('H2' * string.length).join(" ").upcase}" @text = Wx::TextCtrl.new(frame, -1, string, :style => Wx::TE_MULTILINE) sizer.add(@text, 0, Wx::GROW|Wx::ALL, 4) value = @text.get_value puts "starting value:\t#{value.length} #{value.inspect} #{value.unpack('H2' * value.length).join(" ").upcase}" saveButton = Wx::Button.new(frame, -1, 'Save') saveButton.evt_button(saveButton.get_id) { | e | on_do_save } sizer.add(saveButton, 0, Wx::ALL, 4) frame.set_sizer(sizer) sizer.set_size_hints(frame) sizer.fit(frame) frame.show end def on_do_save value = @text.get_value puts "saved value:\t#{value.length} #{value.inspect} #{value.unpack('H2' * value.length).join(" ").upcase}" end end TheApp.new.main_loop ........................................ C:\>ruby script.rb (different strings uncommented) ruby string: 6 "fooboo" 66 6F 6F 62 6F 6F starting value: 6 "fooboo" 66 6F 6F 62 6F 6F saved value: 6 "fooboo" 66 6F 6F 62 6F 6F ruby string: 8 "foo\302\245boo" 66 6F 6F C2 A5 62 6F 6F starting value: 8 "foo\302\245boo" 66 6F 6F C2 A5 62 6F 6F saved value: 8 "foo\302\245boo" 66 6F 6F C2 A5 62 6F 6F ruby string: 9 "foo\342\220\200boo" 66 6F 6F E2 90 80 62 6F 6F starting value: 9 "foo\342\220\200boo" 66 6F 6F E2 90 80 62 6F 6F saved value: 9 "foo\342\220\200boo" 66 6F 6F E2 90 80 62 6F 6F ruby string: 7 "foo\037boo" 66 6F 6F 1F 62 6F 6F starting value: 7 "foo\037boo" 66 6F 6F 1F 62 6F 6F saved value: 7 "foo\037boo" 66 6F 6F 1F 62 6F 6F ruby string: 7 "foo\000boo" 66 6F 6F 00 62 6F 6F starting value: 3 "foo" 66 6F 6F saved value: 3 "foo" 66 6F 6F ruby string: 7 "foo\225boo" 66 6F 6F 95 62 6F 6F starting value: 0 "" saved value: 0 "" ........................................ Some control characters work fine (e.g. \x1F). Other control characters (e.g., \x00) cause the value to be truncated before the character. Still other control characters (e.g., \x95) cause the value to be altogether empty. Is this behavior on purpose? Is there a list of which control characters do what? > If you want a code-oriented text editor, you probably want to use Wx::StyledTextCtrl as the base for your text control. It's the same editing/highlighting component used by Scite. I guess my noob side shown through. Thanks for pointing me to that control. I guess I need to read up before I open my mouth. Let the character testing begin. > Wx::Clipboard > what DataObject, what platform, what version Wx::DF_TEXT Windows API: CF_OEMTEXT, CF_TEXT, CF_UNICODETEXT Windows XP I was just testing someone elses script. This object is complex! I suspect it's a combination of how Windows implements clipboard data formats and the Wx UTF-8 requirement. >From tests of Windows native clipboard API calls, it seems they get themselves confused about text display versus binary value. It seems this is a hot issue for general wxWidgets as well. Thanks. -AH -- Posted via http://www.ruby-forum.com/. From ruby.student at gmail.com Fri Jan 30 10:44:29 2009 From: ruby.student at gmail.com (Ruby Student) Date: Fri, 30 Jan 2009 10:44:29 -0500 Subject: [wxruby-users] Help understanding EVERYTHING In-Reply-To: References: <345817580901291023v4fbeb178wd2d67ea34c22dc26@mail.gmail.com> Message-ID: <345817580901300744y5339ed00r4da54dfa89c0b658@mail.gmail.com> On Thu, Jan 29, 2009 at 3:32 PM, Sean Long wrote: > Your message does not have any code attached. Might want to repost > with the attachment. > > Sean > > On Thu, Jan 29, 2009 at 10:23 AM, Ruby Student > wrote: > > Team, > > > > I am trying to learn a GUI for Ruby and I picked wxRuby. > > The problem is that I am kind of slow learning this and I now feel > > frustrated after trying for about at least 7 hours. > > I am trying to design a simple Sudoku 9x9 grid to display numbers, 1 - 9, > > using buttons. > > I posted a question on Ruby forum ruby-talk and a gentleman, Alex Fenton, > > answered my questions. > > Alex gave me what appear to be great hints. However, as I said earlier, I > am > > kind of slow and learn by example. > > I tried reading the bigdemo that comes with wxruby and looked on RDOC and > > google, but can't find any help. > > Alex suggested to use this forum to get help. > > > > I don't want you to provide me with a solution but I need some solid > hints, > > if you have the time and will not mind helping me. > > > > I am including a code that I am using to play and learn wxruby. Please > take > > a look at it and see if you can tell me why I can't display all the > buttons > > a defined. Only the first button, 1, is displayed. > > Once I get those working I will be able to add the rest. The total for a > > "normal" Sudoku puzzle is 81 for the 9x9 grid. > > > > Thank you very much for your help. > > > > PS: Is there a wxruby book that I can purchase? > > -- > > Ruby Student > > > > _______________________________________________ > > wxruby-users mailing list > > wxruby-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/wxruby-users > > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > Sorry about that. Here it is: begin require 'rubygems' rescue LoadError end require 'wx' include Wx class MyFrame < Frame def initialize() # One can use the following, commented version or the next 2 #Frame.new(nil, -1, "Sudoku Puzzle").show() super(nil, -1, 'Sudoku Puzzle', Point.new(220,100), Size.new(600,480)) @mp = Panel.new(self) # GridSizer.new(Integer rows, Integer cols, Integer vgap, Integer hgap) gs = GridSizer.new(9, 9, 2, 2) # My goal is to define a sudoku grid 9x9 =begin Button.new(Window parent, Integer id, String label = '', Point pos = DEFAULT_POSITION, Size size = DEFAULT_SIZE, Integer style = 0, Validator validator = DEFAULT_VALIDATOR, String name = "button") =end @b1 = Button.new(@mp, 1, :label=> '1') gs.add(@b1) evt_button(@b1.get_id()) { |event| button_click(event)} @b2 = Button.new(@mp, 2, :label=>'2') gs.add(@b2) evt_button(@b2.get_id()) { |event| button_click(event)} @b3 = Button.new(@mp, 3, :label=> '3') gs.add(@b3) evt_button(@b3.get_id()) { |event| button_click(event)} @b4 = Button.new(@mp, 4, :label=>'4') gs.add(@b4) evt_button(@b4.get_id()) { |event| button_click(event)} ###### Etc, Etc ....until placing button located on cell [9][9] show() end # initialize def button_click(event) # code here end end # MyFrame Class class MyApp3 < App def on_init MyFrame.new end # on_init end # MyApp3 ##### MyApp3.new.main_loop -- Thank you Ruby Student -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Fri Jan 30 11:19:02 2009 From: lists at ruby-forum.com (Alexander Hawley) Date: Fri, 30 Jan 2009 17:19:02 +0100 Subject: [wxruby-users] Control Characters In-Reply-To: References: <1908c1638028a3c1adff82cb596cc1e6@ruby-forum.com> <49824CAE.5010405@pressure.to> Message-ID: <228e472b55ea4379204a26f0bc2c01c4@ruby-forum.com> It seems Wx::StyledTextCtrl is no better on the NUL character problem. This is really weird, because Scite can definitely handle NULs. This script shows the different behavior for starting Wx::StyledTextCtrl values. ........................................ require "wx" class TheApp < Wx::App def on_init frame = Wx::Frame.new(nil, -1, "TheApp") sizer = Wx::FlexGridSizer.new(2,4) string = "foo\x00boo" puts "ruby string:\t#{string.length} #{string.inspect} #{string.unpack('H2' * string.length).join(" ").upcase}" # file = 'null.txt' # fileContents = nil # File.open(file, 'rb') { |m_file| # fileContents = m_file.read # } # puts "ruby file contents:\t#{fileContents.length} #{fileContents.inspect} #{fileContents.unpack('H2' * fileContents.length).join(" ").upcase}" @text = Wx::StyledTextCtrl.new(frame) @text.set_text(string) # @text.load_file(file) sizer.add(@text, 0, Wx::ALL, 4) value = @text.get_text puts "starting value:\t#{value.length} #{value.inspect} #{value.unpack('H2' * value.length).join(" ").upcase}" saveButton = Wx::Button.new(frame, -1, 'Save') saveButton.evt_button(saveButton.get_id) { | e | on_do_save } sizer.add(saveButton, 0, Wx::ALL, 4) frame.set_sizer(sizer) sizer.set_size_hints(frame) sizer.fit(frame) frame.show end def on_do_save value = @text.get_text puts "saved value:\t#{value.length} #{value.inspect} #{value.unpack('H2' * value.length).join(" ").upcase}" end end TheApp.new.main_loop ........................................ C:\>ruby script.rb (string versus file uncommented) ruby string: 7 "foo\000boo" 66 6F 6F 00 62 6F 6F starting value: 3 "foo" 66 6F 6F saved value: 3 "foo" 66 6F 6F ruby file contents: 7 "foo\000boo" 66 6F 6F 00 62 6F 6F starting value: 3 "foo" 66 6F 6F saved value: 3 "foo" 66 6F 6F ........................................ NUL characters (e.g., \x00) cause the value to be truncated before the character. Both Wx::StyledTextCtrl#set_text and Wx::StyledTextCtrl#load_file exhibit the same problem. Thanks -AH -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Fri Jan 30 12:21:55 2009 From: alex at pressure.to (Alex Fenton) Date: Fri, 30 Jan 2009 17:21:55 +0000 Subject: [wxruby-users] Control Characters In-Reply-To: References: <1908c1638028a3c1adff82cb596cc1e6@ruby-forum.com> <49824CAE.5010405@pressure.to> Message-ID: <49833733.2000508@pressure.to> Alexander Hawley wrote: > This script shows the different behavior for starting Wx::TextCtrl > values. > Thanks for the sample code. It seems to me there are a couple of different issues here: > # string = "foo\x0boo" > Embedded NUL characters. At the moment the wxRuby Ruby->C++ conversion for String relies on C conventions - ie that the NUL character terminates a string. So although both Ruby and wxWidgets permit Strings with embedded NUL, they get truncated in conversion. This is a bug, and I think this it's fairly easy to fix in the wrapping - but it's also quite far-reaching so we need to check the byte/character counts are right, so it doesn't cause regressions elsewhere. > # string = "foo\x95boo" > This is just isn't a valid UTF-8 string. Presumably it makes sense in some 8-bit encoding (eg ISO-8859-1) so you need to use Iconv or similar to convert it before feeding it to wxRuby. > @text = Wx::TextCtrl.new(frame, -1, string, :style => > Wx::TE_MULTILINE) > The Wx::TextCtrl documentation states (although not very pointedly) that the only control characters permitted are a newline. I think TextCtrl is aimed only at natural language text, so it has to be StyledTextCtrl (Scintilla) here. I saw your email re STC, and have been trying something similar here. I'm not sure, but I think STC (wxWidgets' wrapping of Scintilla) is making assumptions about a NUL character terminating a string; even if I pass it the right stuff from Ruby, it's still truncating it. >> Wx::Clipboard >> what DataObject, what platform, what version >> > > Wx::DF_TEXT > Windows API: CF_OEMTEXT, CF_TEXT, CF_UNICODETEXT > Windows XP > > I was just testing someone elses script. This object is complex! I > suspect it's a combination of how Windows implements clipboard data > formats and the Wx UTF-8 requirement. > > >From tests of Windows native clipboard API calls, it seems they get > themselves confused about text display versus binary value. > > It seems this is a hot issue for general wxWidgets as well. > > Yes, getting the clipboard to work across platforms is a messy business, because each platform uses different native encodings and a different scheme to denote data types. What I find on OS X is that the raw data is UTF16, but for higher-level calls, wxRuby & wxWidgets will do the conversion. Even if I place DF_TEXT on the clipboard, I can only retrieve DF_UNICODETEXT. This isn't resolved in other Ruby GUI libraries as well - of the other two most popular libraries, GNOME2 doesn't support Windows clipboard at all, and Shoes doesn't even try to offer that GUI convention. Thanks for bringing this up. I'll see what we can fix for the next release, but I have a hunch it may not be possible to get it 100% perfect b/c of all the other components involved. Some test cases may really help, if possible, and I may focus on getting things most correct for Ruby 1.9. An example test for Clipboard is here: http://wxruby.rubyforge.org/svn/trunk/wxruby2/tests/test_clipboard.rb alex From sean.m.long at gmail.com Fri Jan 30 16:36:24 2009 From: sean.m.long at gmail.com (Sean Long) Date: Fri, 30 Jan 2009 13:36:24 -0800 Subject: [wxruby-users] Help understanding EVERYTHING In-Reply-To: <345817580901300744y5339ed00r4da54dfa89c0b658@mail.gmail.com> References: <345817580901291023v4fbeb178wd2d67ea34c22dc26@mail.gmail.com> <345817580901300744y5339ed00r4da54dfa89c0b658@mail.gmail.com> Message-ID: Your problem was adding a sizer to the panel and then adding the GridSizer to that sizer. I automated your button generation for kicks. Try this Sean begin require 'rubygems' rescue LoadError end require 'wx' include Wx class MyFrame < Frame def initialize() # One can use the following, commented version or the next 2 #Frame.new(nil, -1, "Sudoku Puzzle").show() super(nil, -1, 'Sudoku Puzzle', Point.new(220,100), Size.new(600,480)) @mp = Panel.new(self) # GridSizer.new(Integer rows, Integer cols, Integer vgap, Integer hgap) gs = GridSizer.new(9, 9, 2, 2) # My goal is to define a sudoku grid 9x9 @buttons = Array.new(9) @buttons.each_index do |i| @buttons[i] = Array.new(9) end id = 0 (0..8).to_a.each do |x| (0..8).to_a.each do |y| b = Button.new(@mp,id,:label=>id.to_s) @buttons[x][y] = b gs.add(b) evt_button(id) {|event| button_click(event)} id += 1 end end main_sizer = Wx::BoxSizer.new(Wx::VERTICAL) main_sizer.add(gs,1,Wx::ALL|Wx::GROW,5) @mp.set_sizer(main_sizer) show() end # initialize def button_click(event) # code here end end # MyFrame Class class MyApp3 < App def on_init MyFrame.new end # on_init end # MyApp3 ##### MyApp3.new.main_loop On Fri, Jan 30, 2009 at 7:44 AM, Ruby Student wrote: > > > On Thu, Jan 29, 2009 at 3:32 PM, Sean Long wrote: >> >> Your message does not have any code attached. Might want to repost >> with the attachment. >> >> Sean >> >> On Thu, Jan 29, 2009 at 10:23 AM, Ruby Student >> wrote: >> > Team, >> > >> > I am trying to learn a GUI for Ruby and I picked wxRuby. >> > The problem is that I am kind of slow learning this and I now feel >> > frustrated after trying for about at least 7 hours. >> > I am trying to design a simple Sudoku 9x9 grid to display numbers, 1 - >> > 9, >> > using buttons. >> > I posted a question on Ruby forum ruby-talk and a gentleman, Alex >> > Fenton, >> > answered my questions. >> > Alex gave me what appear to be great hints. However, as I said earlier, >> > I am >> > kind of slow and learn by example. >> > I tried reading the bigdemo that comes with wxruby and looked on RDOC >> > and >> > google, but can't find any help. >> > Alex suggested to use this forum to get help. >> > >> > I don't want you to provide me with a solution but I need some solid >> > hints, >> > if you have the time and will not mind helping me. >> > >> > I am including a code that I am using to play and learn wxruby. Please >> > take >> > a look at it and see if you can tell me why I can't display all the >> > buttons >> > a defined. Only the first button, 1, is displayed. >> > Once I get those working I will be able to add the rest. The total for a >> > "normal" Sudoku puzzle is 81 for the 9x9 grid. >> > >> > Thank you very much for your help. >> > >> > PS: Is there a wxruby book that I can purchase? >> > -- >> > Ruby Student >> > >> > _______________________________________________ >> > wxruby-users mailing list >> > wxruby-users at rubyforge.org >> > http://rubyforge.org/mailman/listinfo/wxruby-users >> > >> _______________________________________________ >> wxruby-users mailing list >> wxruby-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/wxruby-users > > Sorry about that. Here it is: > > begin > require 'rubygems' > rescue LoadError > end > > require 'wx' > include Wx > > class MyFrame < Frame > def initialize() > # One can use the following, commented version or the next 2 > #Frame.new(nil, -1, "Sudoku Puzzle").show() > super(nil, -1, 'Sudoku Puzzle', Point.new(220,100), Size.new(600,480)) > @mp = Panel.new(self) > > # GridSizer.new(Integer rows, Integer cols, Integer vgap, Integer > hgap) > gs = GridSizer.new(9, 9, 2, 2) # My goal is to define a sudoku grid 9x9 > =begin > Button.new(Window parent, Integer id, String label = '', > Point pos = DEFAULT_POSITION, > Size size = DEFAULT_SIZE, > Integer style = 0, > Validator validator = DEFAULT_VALIDATOR, > String name = "button") > =end > @b1 = Button.new(@mp, 1, :label=> '1') > gs.add(@b1) > evt_button(@b1.get_id()) { |event| button_click(event)} > > @b2 = Button.new(@mp, 2, :label=>'2') > gs.add(@b2) > evt_button(@b2.get_id()) { |event| button_click(event)} > > @b3 = Button.new(@mp, 3, :label=> '3') > gs.add(@b3) > evt_button(@b3.get_id()) { |event| button_click(event)} > > @b4 = Button.new(@mp, 4, :label=>'4') > gs.add(@b4) > evt_button(@b4.get_id()) { |event| button_click(event)} > > ###### Etc, Etc ....until placing button located on cell [9][9] > > show() > end # initialize > > def button_click(event) > # code here > end > > end # MyFrame Class > class MyApp3 < App > def on_init > MyFrame.new > end # on_init > end # MyApp3 > > ##### > > MyApp3.new.main_loop > -- > Thank you > Ruby Student > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > From clinton.forbes at gmail.com Sat Jan 31 08:02:21 2009 From: clinton.forbes at gmail.com (Clinton Forbes) Date: Sun, 1 Feb 2009 00:02:21 +1100 Subject: [wxruby-users] wxRuby and Test::Unit (or Rspec or whatever) Message-ID: <85122839-E147-4E3F-A9EB-86111C297E7E@gmail.com> This is my first post to the mailing list, so "Hello All". I have a question about wxRuby and having automated tests of my GUI. Is anyone doing this? I have plenty of experience testing Rails apps with Test::Unit and Rspec, but I couldn't find any examples for wxRuby. At the moment I start my app by calling MyApp.new.mainloop, but this method blocks until I quit it. Should I start another thread to run my tests, sending messages to my running application? If anyone has a simple example to show me, that would be fantastic. Thanks, Clinton. From lists at ruby-forum.com Sat Jan 31 09:44:40 2009 From: lists at ruby-forum.com (Bryan Ash) Date: Sat, 31 Jan 2009 15:44:40 +0100 Subject: [wxruby-users] wxRuby and Test::Unit (or Rspec or whatever) In-Reply-To: <85122839-E147-4E3F-A9EB-86111C297E7E@gmail.com> References: <85122839-E147-4E3F-A9EB-86111C297E7E@gmail.com> Message-ID: <34e651c8166b83f794d9e58861c6d9aa@ruby-forum.com> Clinton, I've been looking for the same thing. I came across wx-nobbie in rubyforge which looks like Webrat for wx apps but it is quite old and doesn't work with the latest wx. I've started looking at updating wx-nobbie but the tests are failing on find_window_by_name. wx-nobbie does use a separate thread as you suggested. If you're interested, I could put wx-nobbie up on github and we could take it from there. Bryan -- Posted via http://www.ruby-forum.com/. From ruby.student at gmail.com Sat Jan 31 11:55:34 2009 From: ruby.student at gmail.com (Ruby Student) Date: Sat, 31 Jan 2009 11:55:34 -0500 Subject: [wxruby-users] Help understanding EVERYTHING In-Reply-To: References: <345817580901291023v4fbeb178wd2d67ea34c22dc26@mail.gmail.com> <345817580901300744y5339ed00r4da54dfa89c0b658@mail.gmail.com> Message-ID: <345817580901310855q2922d9cdua2c74b0751d80fab@mail.gmail.com> On Fri, Jan 30, 2009 at 4:36 PM, Sean Long wrote: > Your problem was adding a sizer to the panel and then adding the > GridSizer to that sizer. > > I automated your button generation for kicks. > > Try this > > Sean > > begin > require 'rubygems' > rescue LoadError > end > > require 'wx' > include Wx > > class MyFrame < Frame > def initialize() > # One can use the following, commented version or the next 2 > #Frame.new(nil, -1, "Sudoku Puzzle").show() > super(nil, -1, 'Sudoku Puzzle', Point.new(220,100), Size.new(600,480)) > @mp = Panel.new(self) > > # GridSizer.new(Integer rows, Integer cols, Integer vgap, Integer > hgap) > gs = GridSizer.new(9, 9, 2, 2) # My goal is to define a sudoku grid 9x9 > > @buttons = Array.new(9) > @buttons.each_index do |i| > @buttons[i] = Array.new(9) > end > > id = 0 > (0..8).to_a.each do |x| > (0..8).to_a.each do |y| > b = Button.new(@mp,id,:label=>id.to_s) > @buttons[x][y] = b > gs.add(b) > evt_button(id) {|event| button_click(event)} > id += 1 > end > end > > main_sizer = Wx::BoxSizer.new(Wx::VERTICAL) > main_sizer.add(gs,1,Wx::ALL|Wx::GROW,5) > @mp.set_sizer(main_sizer) > > show() > end # initialize > > def button_click(event) > # code here > end > > end # MyFrame Class > > class MyApp3 < App > def on_init > MyFrame.new > end # on_init > end # MyApp3 > > ##### > > MyApp3.new.main_loop > > > > > On Fri, Jan 30, 2009 at 7:44 AM, Ruby Student > wrote: > > > > > > On Thu, Jan 29, 2009 at 3:32 PM, Sean Long > wrote: > >> > >> Your message does not have any code attached. Might want to repost > >> with the attachment. > >> > >> Sean > >> > >> On Thu, Jan 29, 2009 at 10:23 AM, Ruby Student > >> wrote: > >> > Team, > >> > > >> > I am trying to learn a GUI for Ruby and I picked wxRuby. > >> > The problem is that I am kind of slow learning this and I now feel > >> > frustrated after trying for about at least 7 hours. > >> > I am trying to design a simple Sudoku 9x9 grid to display numbers, 1 - > >> > 9, > >> > using buttons. > >> > I posted a question on Ruby forum ruby-talk and a gentleman, Alex > >> > Fenton, > >> > answered my questions. > >> > Alex gave me what appear to be great hints. However, as I said > earlier, > >> > I am > >> > kind of slow and learn by example. > >> > I tried reading the bigdemo that comes with wxruby and looked on RDOC > >> > and > >> > google, but can't find any help. > >> > Alex suggested to use this forum to get help. > >> > > >> > I don't want you to provide me with a solution but I need some solid > >> > hints, > >> > if you have the time and will not mind helping me. > >> > > >> > I am including a code that I am using to play and learn wxruby. Please > >> > take > >> > a look at it and see if you can tell me why I can't display all the > >> > buttons > >> > a defined. Only the first button, 1, is displayed. > >> > Once I get those working I will be able to add the rest. The total for > a > >> > "normal" Sudoku puzzle is 81 for the 9x9 grid. > >> > > >> > Thank you very much for your help. > >> > > >> > PS: Is there a wxruby book that I can purchase? > >> > -- > >> > Ruby Student > >> > > >> > _______________________________________________ > >> > wxruby-users mailing list > >> > wxruby-users at rubyforge.org > >> > http://rubyforge.org/mailman/listinfo/wxruby-users > >> > > >> _______________________________________________ > >> wxruby-users mailing list > >> wxruby-users at rubyforge.org > >> http://rubyforge.org/mailman/listinfo/wxruby-users > > > > Sorry about that. Here it is: > > > > begin > > require 'rubygems' > > rescue LoadError > > end > > > > require 'wx' > > include Wx > > > > class MyFrame < Frame > > def initialize() > > # One can use the following, commented version or the next 2 > > #Frame.new(nil, -1, "Sudoku Puzzle").show() > > super(nil, -1, 'Sudoku Puzzle', Point.new(220,100), > Size.new(600,480)) > > @mp = Panel.new(self) > > > > # GridSizer.new(Integer rows, Integer cols, Integer vgap, Integer > > hgap) > > gs = GridSizer.new(9, 9, 2, 2) # My goal is to define a sudoku grid > 9x9 > > =begin > > Button.new(Window parent, Integer id, String label = '', > > Point pos = DEFAULT_POSITION, > > Size size = DEFAULT_SIZE, > > Integer style = 0, > > Validator validator = DEFAULT_VALIDATOR, > > String name = "button") > > =end > > @b1 = Button.new(@mp, 1, :label=> '1') > > gs.add(@b1) > > evt_button(@b1.get_id()) { |event| button_click(event)} > > > > @b2 = Button.new(@mp, 2, :label=>'2') > > gs.add(@b2) > > evt_button(@b2.get_id()) { |event| button_click(event)} > > > > @b3 = Button.new(@mp, 3, :label=> '3') > > gs.add(@b3) > > evt_button(@b3.get_id()) { |event| button_click(event)} > > > > @b4 = Button.new(@mp, 4, :label=>'4') > > gs.add(@b4) > > evt_button(@b4.get_id()) { |event| button_click(event)} > > > > ###### Etc, Etc ....until placing button located on cell [9][9] > > > > show() > > end # initialize > > > > def button_click(event) > > # code here > > end > > > > end # MyFrame Class > > class MyApp3 < App > > def on_init > > MyFrame.new > > end # on_init > > end # MyApp3 > > > > ##### > > > > MyApp3.new.main_loop > > -- > > Thank you > > Ruby Student > > > > _______________________________________________ > > wxruby-users mailing list > > wxruby-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/wxruby-users > > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > Sean, Thank you for your help. Perhaps one day I'll be able to help someone else. -- Ruby Student -------------- next part -------------- An HTML attachment was scrubbed... URL: From empower at smart.net Sat Jan 31 12:54:11 2009 From: empower at smart.net (Jamal Mazrui) Date: Sat, 31 Jan 2009 12:54:11 -0500 (EST) Subject: [wxruby-users] Ruby 1.9.1, WxRuby, and Windows Message-ID: I'm not on the general ruby-talk list at present, and have some questions that, somewhat surprisingly, I could not find answers to, despite much web searching. Is the official version of Ruby 1.9.1 delayed? I thought it was supposed to be released on January 25. The ruby-lang web site does not give an explanation for the delay or a revised schedule, as far as I can tell. Does WxRuby work with Ruby 1.9.1 preview? I thought I read a message on this list that said this was working. It may well be the case with other operating systems, but I have not been able to get it to work with the binary version of Ruby 1.9.1 preview available from the ruby-lang site. I also have not found any encouraging information about when a full installer for Windows will be released. Since there have been beta/preview versions of Ruby 1.9.1 for quite a while now, this state of affairs surprises me. I realize that these are volunteer projects, but Windows is a popular platform, and the lack of keeping up with the superior Ruby 1.9.1 is a cause of concern to me. (Python, by comparison, always seems to have an up to date Windows installer that is stable). Thanks for any answers folks here can provide! Jamal From mario at ruby-im.net Sat Jan 31 17:39:13 2009 From: mario at ruby-im.net (Mario Steele) Date: Sat, 31 Jan 2009 16:39:13 -0600 Subject: [wxruby-users] Ruby 1.9.1, WxRuby, and Windows In-Reply-To: References: Message-ID: Hello Jamal, On Sat, Jan 31, 2009 at 11:54 AM, Jamal Mazrui wrote: > I'm not on the general ruby-talk list at present, and have some questions > that, somewhat surprisingly, I could not find answers to, despite much web > searching. > > Is the official version of Ruby 1.9.1 delayed? I thought it was > supposed to be released on January 25. The ruby-lang web site does > not give an explanation for the delay or a revised schedule, as far as > I can tell. Unfortunately I don't keep up with the Ruby 1.9 core series myself, so I don't what the state of affairs are over there, and what is the hold up, if anything. We only deal with wxRuby specifically. Does WxRuby work with Ruby 1.9.1 preview? I thought I read a message > on this list that said this was working. It may well be the case > with other operating systems, but I have not been able to get it to > work with the binary version of Ruby 1.9.1 preview available from the > ruby-lang site. I also have not found any encouraging information > about when a full installer for Windows will be released. Since there > have been beta/preview versions of Ruby 1.9.1 for quite a while now, > this state of affairs surprises me. I realize that these are > volunteer projects, but Windows is a popular platform, and the lack of > keeping up with the superior Ruby 1.9.1 is a cause of concern to me. > (Python, by comparison, always seems to have an up to date Windows > installer that is stable). The current SVN Head is perfectly compatable with Ruby 1.9.x, and we are in preparations for a 2.0 release, there are just a couple of bugs holding us up, and may not be fixed, till after we release 2.0, but we're still working on it. As for the Installer for Python, the installer is maintained in-house, where as the Ruby Windows Installer, is maintained by a 3rd party. Specifically by the Ruby One Click Installer team, currently headed by Luis Lavena, who is also working to simplify the process, and move away from the MSVC Compiled version, to MinGW, which is a more freely available compiler, and is the GNU Compiler, which is used on most Linux and FreeBSD Systems. Unfortunately this is the about all the info I can give you, cause this is all that I know. My concentrations is more on the wxRuby project, then on the Ruby Core. > Thanks for any answers folks here can provide! > > Jamal > hth, Mario -- Mario Steele http://www.trilake.net http://www.ruby-im.net http://rubyforge.org/projects/wxruby/ http://rubyforge.org/projects/wxride/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From clinton.forbes at gmail.com Sat Jan 31 20:23:59 2009 From: clinton.forbes at gmail.com (Clinton Forbes) Date: Sun, 1 Feb 2009 12:23:59 +1100 Subject: [wxruby-users] wxruby-users Digest, Vol 65, Issue 13 In-Reply-To: References: Message-ID: Thanks for the info, Bryan. I would be very interested to see your updated version of wx-nobbie. Please reply with the github repo details when you get the chance. I will send you pull-requests for any progress I can make. > Message: 2 > Date: Sat, 31 Jan 2009 15:44:40 +0100 > From: Bryan Ash > Subject: Re: [wxruby-users] wxRuby and Test::Unit (or Rspec or > whatever) > To: wxruby-users at rubyforge.org > Message-ID: <34e651c8166b83f794d9e58861c6d9aa at ruby-forum.com> > Content-Type: text/plain; charset=utf-8 > > Clinton, > > I've been looking for the same thing. I came across wx-nobbie in > rubyforge which looks like Webrat for wx apps but it is quite old and > doesn't work with the latest wx. > > I've started looking at updating wx-nobbie but the tests are failing > on > find_window_by_name. > > wx-nobbie does use a separate thread as you suggested. > > If you're interested, I could put wx-nobbie up on github and we could > take it from there. > > Bryan > > -- > Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Sat Jan 31 21:04:58 2009 From: lists at ruby-forum.com (Ridge Mcghee) Date: Sun, 1 Feb 2009 03:04:58 +0100 Subject: [wxruby-users] Colour bug ? Message-ID: Here is some code to demonstrate that "==" doesn't seem to work completely for colour. The only problem I've noticed is when testing against nil. #--------------------------------------------------- require 'wx' include Wx class Demo def try(arg) if (arg == nil) result = "Nil" elsif (arg.is_a?(Array)) result = "Array" elsif (arg.is_a?(Colour)) result = "Colour" elsif (arg.is_a?(String)) result = "String" else result = "Unclassified" end puts result end end bd = Demo.new n = nil bd.try(n) array = %w(one two) bd.try(array) string = "abc" bd.try(string) colour = Colour.new(0, 0, 0, 255) bd.try(colour) An interesting work-around is to put the Colour test *first*. However, it sure would be nice if Colour worked like the other objects. Ridge -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Sat Jan 31 21:40:01 2009 From: alex at pressure.to (Alex Fenton) Date: Sun, 01 Feb 2009 02:40:01 +0000 Subject: [wxruby-users] wxRuby and Test::Unit (or Rspec or whatever) In-Reply-To: <85122839-E147-4E3F-A9EB-86111C297E7E@gmail.com> References: <85122839-E147-4E3F-A9EB-86111C297E7E@gmail.com> Message-ID: <49850B81.2040104@pressure.to> Hi Clinton Clinton Forbes wrote: > I have a question about wxRuby and having automated tests of my GUI. > Is anyone doing this? I have plenty of experience testing Rails apps > with Test::Unit and Rspec, but I couldn't find any examples for wxRuby. There are some in the wxRuby repository and tarball which use test/unit http://wxruby.rubyforge.org/svn/trunk/wxruby2/tests/test_item_data.rb (Ruby 1.8) http://wxruby.rubyforge.org/svn/trunk/wxruby2/tests/test_clipboard.rb (Ruby 1.9) > At the moment I start my app by calling MyApp.new.mainloop, but this > method blocks until I quit it. Should I start another thread to run > my tests, sending messages to my running application? For simple tests, you don't need to run threads. Just call the test library's method to run whatever tests you want within your app's on_init method, or Wx::App.run { .... } block. The way to do this with Ruby's standard test/unit varies between ruby versions 1.8 and 1.9. I haven't used rspec but i expect there's something similar. If you return false or nil from the application start-up, then the program should exit cleanly. alex From alex at pressure.to Sat Jan 31 21:52:04 2009 From: alex at pressure.to (Alex Fenton) Date: Sun, 01 Feb 2009 02:52:04 +0000 Subject: [wxruby-users] wxRuby and Test::Unit (or Rspec or whatever) In-Reply-To: <34e651c8166b83f794d9e58861c6d9aa@ruby-forum.com> References: <85122839-E147-4E3F-A9EB-86111C297E7E@gmail.com> <34e651c8166b83f794d9e58861c6d9aa@ruby-forum.com> Message-ID: <49850E54.2080305@pressure.to> Bryan Ash wrote: > I've been looking for the same thing. I came across wx-nobbie in > rubyforge which looks like Webrat for wx apps but it is quite old and > doesn't work with the latest wx. > > I've started looking at updating wx-nobbie but the tests are failing on > find_window_by_name. > > wx-nobbie does use a separate thread as you suggested. > > If you're interested, I could put wx-nobbie up on github and we could > take it from there. It'd be good to see nobbie updated. I'd be happy to help get it working with latest wxRuby. alex From alex at pressure.to Sat Jan 31 22:19:15 2009 From: alex at pressure.to (Alex Fenton) Date: Sun, 01 Feb 2009 03:19:15 +0000 Subject: [wxruby-users] Colour bug ? In-Reply-To: References: Message-ID: <498514B3.8010109@pressure.to> Hi Ridge Mcghee wrote: > Here is some code to demonstrate that > "==" doesn't seem to work completely for colour. > > The only problem I've noticed is when testing > against nil. > > #--------------------------------------------------- > require 'wx' > include Wx > > class Demo > def try(arg) > if (arg == nil) > result = "Nil" > elsif (arg.is_a?(Array)) > result = "Array" > elsif (arg.is_a?(Colour)) > result = "Colour" > elsif (arg.is_a?(String)) > result = "String" > else > result = "Unclassified" > end > > puts result > end > end > > bd = Demo.new > > n = nil > bd.try(n) > > array = %w(one two) > bd.try(array) > > string = "abc" > bd.try(string) > > colour = Colour.new(0, 0, 0, 255) > bd.try(colour) > > > An interesting work-around is to put the > Colour test *first*. However, it sure > would be nice if Colour worked like the > other objects. Thanks for the report. wxRuby shouldn't be so stern. It's fixed by SVN:1990 http://rubyforge.org/pipermail/wxruby-svn-commit/2009-January/000846.html a