From lists at ruby-forum.com Wed Jun 2 18:44:52 2010 From: lists at ruby-forum.com (Zhimin Zhan) Date: Thu, 3 Jun 2010 00:44:52 +0200 Subject: [wxruby-users] Segmentation fault on paste a long text into Scintilla Message-ID: <94d75d2eb58c936c025f41ff84c69248@ruby-forum.com> Hi there, In bundled samples\scintilla.rb, paste a long one-line text (see below) caused segmentation fault scintilla.rb:166: [BUG] Segmentation fault ruby 1.8.7 (2010-01-10 patchlevel 249) [i386-mingw32] However, It was Ok if not including last 100 or so characters (worked on 13100 characters). Cheers, Zhimin -- text copied
 
 
Rich Text
The Rich Text Area is supported on all major browsers, and will fall back gracefully to the level of functionality supported on each.
f.each do |line| > line.delete > end > contents_to_save = @sci.get_text#tu > f.puts contents_to_save > f.close > > works for me > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users Sergey Chernov real.sergeych at gmail.com From lists at ruby-forum.com Mon Jun 7 01:42:34 2010 From: lists at ruby-forum.com (Sergio Ruiz) Date: Mon, 7 Jun 2010 07:42:34 +0200 Subject: [wxruby-users] distributing and application Message-ID: i am currently looking into GUI libraries for cross platform ruby development. the question i have is.. if i use wxRuby to develop my application, how do i distribute it? is there a way that i can package it up for SIMPLE consumption by osx/lin/win users? my development platform is osx.. thanks! -- Posted via http://www.ruby-forum.com/. From max-braeu at gmx.de Mon Jun 7 02:43:59 2010 From: max-braeu at gmx.de (=?ISO-8859-1?Q?Maximilian_Br=E4utigam?=) Date: Mon, 07 Jun 2010 08:43:59 +0200 Subject: [wxruby-users] distributing and application In-Reply-To: References: Message-ID: <4C0C952F.9010900@gmx.de> Am 07.06.2010 07:42, schrieb Sergio Ruiz: > i am currently looking into GUI libraries for cross platform ruby > development. the question i have is.. if i use wxRuby to develop my > application, how do i distribute it? is there a way that i can package > it up for SIMPLE consumption by osx/lin/win users? > > my development platform is osx.. > > thanks! hi sergio, for windows user i'm producing a simple exe file using rubyscript2exe. This exe file contains all dependencies, interpreter, wx stuff etc. http://www.erikveen.dds.nl/rubyscript2exe/ I can remember, that i modified the script due to a bug i forgot, but i attached the file that i'm using. for linux in conjunction with the package managers it is (to my mind) not too intelligent to produce an exe file, because such an exe file needs to be extracted and that takes some (unnecessary) seconds. a bit more userfriendly in my opinion is the installation of ruby-gnome2, not on linux, but on windows. refer to: http://ruby-gnome2.sourceforge.jp/hiki.cgi?Install+Guide+for+Windows kind regards, der max -------------- next part -------------- A non-text attachment was scrubbed... Name: rubyscript2exe.rb.gz Type: application/x-gzip Size: 2825 bytes Desc: not available URL: From lists at ruby-forum.com Tue Jun 8 10:35:47 2010 From: lists at ruby-forum.com (=?utf-8?Q?Marvin_G=c3=bclker?=) Date: Tue, 8 Jun 2010 16:35:47 +0200 Subject: [wxruby-users] distributing and application In-Reply-To: <4C0C952F.9010900@gmx.de> References: <4C0C952F.9010900@gmx.de> Message-ID: <3776376e95c2cb36402324686c112898@ruby-forum.com> Maximilian Br?utigam wrote: > for windows user i'm producing a simple exe file using rubyscript2exe. > This exe file contains all dependencies, interpreter, wx stuff etc. rubyscript2exe.rb is out of date (it cannot not be used with recent versions of RubyGems, at least the unmodified version). Have a look at OCRA instead: http://rubygems.org/gems/ocra As well as rubyscript2exe did it compiles your application together with a Ruby Interpreter and all used gems into a single executable which additionally remains quite small (thanks to lzma compression). In case of Linux users you don't need to worry too much. It's not a big deal to just do something like "sudo apt-get install ruby-full" or the like (depending on used distrubution and Ruby version) followed by a "sudo gem install wxruby". For Mac users I don't know. I never had a Mac. Marvin -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Tue Jun 8 12:08:13 2010 From: lists at ruby-forum.com (Sergio Ruiz) Date: Tue, 8 Jun 2010 18:08:13 +0200 Subject: [wxruby-users] distributing and application In-Reply-To: <3776376e95c2cb36402324686c112898@ruby-forum.com> References: <4C0C952F.9010900@gmx.de> <3776376e95c2cb36402324686c112898@ruby-forum.com> Message-ID: hmm... i am starting to think i might just want to write this app with something else.. my main goals are simplicity for the end user.. on three platforms.. thanks for all the input! -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Jun 10 12:28:07 2010 From: lists at ruby-forum.com (Tony Meier) Date: Thu, 10 Jun 2010 18:28:07 +0200 Subject: [wxruby-users] Destroying a Wx::GridTableBase with an active editor In-Reply-To: <4BE96B05.8010600@pressure.to> References: <6ac6e2bf94dabf371b21b9d020045926@ruby-forum.com> <4BE96B05.8010600@pressure.to> Message-ID: <9fbb8c6236bde7027c0bc06fcbd2f700@ruby-forum.com> Hey Alex, just to let you know how things turned out. Briefly speaking, disabling editing and the cell_edit_controls does the trick. Here's the long version: > The base class Wx::GridCellEditor has a method #end_edit which IIRC > dismisses the current editor - does this help? You may need to track > where there is a current editor with the various event hooks in Wx::GRid > - eg evt_grid_editor_shown / evt_grid_editor_created I tried that but it seems that the editor isn't affected by that. What I did is, I was tracking the active editor in @arow & @acol using the grid_editor_shown/hidden events. That worked fine. However .. editor = @grid.get_cell_editor (@arow, at acol) editor.end_edit (@arow, at acol, at grid) .. didn't seem to anything. I'm still puzzled on how this all works together under the hood. Eventually, I was able to resolve the problem (exchanging table with an active editor) by using the following def on_tree_selection_changed event @grid.begin_batch @grid.clear_selection @grid.enable_editing(false) @grid.enable_cell_edit_control(false) table = @grid.get_table table.detach if (table and table.respond_to? "detach") table = MyGridTableBase.new @params @grid.set_table table @grid.enable_cell_edit_control(true) @grid.enable_editing(true) @grid.end_batch event.skip end Cheers, Tony -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Jun 10 12:31:58 2010 From: lists at ruby-forum.com (Tony Meier) Date: Thu, 10 Jun 2010 18:31:58 +0200 Subject: [wxruby-users] distributing and application In-Reply-To: References: <4C0C952F.9010900@gmx.de> <3776376e95c2cb36402324686c112898@ruby-forum.com> Message-ID: Hi Sergio, > my main goals are simplicity for the end user.. on three platforms.. I'd be very interested in what you came up with. I've been pondering about that for a while and neither rubyscript2exe nor ocra seemed to work the way I expected them to. Maybe I didn't spend enough effort but it all looked kind of flaky to me. So ... if you don't end up writing Java code - let us know what your solution was :) Cheers, Tony -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Jun 10 13:01:09 2010 From: lists at ruby-forum.com (Sergio Ruiz) Date: Thu, 10 Jun 2010 19:01:09 +0200 Subject: [wxruby-users] distributing and application In-Reply-To: References: <4C0C952F.9010900@gmx.de> <3776376e95c2cb36402324686c112898@ruby-forum.com> Message-ID: <3775376f58c938f84126cce8b13b6543@ruby-forum.com> > So ... if you don't end up writing Java code - let us know what your > solution was :) > i have decided i will probably go with Qt or cocoa... -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Jun 10 18:59:57 2010 From: lists at ruby-forum.com (Josh Kjenner) Date: Fri, 11 Jun 2010 00:59:57 +0200 Subject: [wxruby-users] Wx::Dialog: run code when OK button selected Message-ID: <33d16892fb64a67ac3cf3e6182ba9c80@ruby-forum.com> Howdy; I'm using wxRuby to build menus for a Sketchup plug-in I'm working on. (Specifically, I'm actually using wxSU, http://wxsu.sourceforge.net/, which is basically wxRuby packaged up as a Sketchup plug-in). I'm trying to create a custom dialog to gather information from the user via text boxes (implemented with Wx::TextCtrl) and pull-down menus (implemented with Wx::Choice). My problem is that I can't figure out how to get the information entered via these means out of the Wx::Dialog object they live in when the "OK" button is clicked. Here is the relevant code: ## this is the WX code for an improved location dialog class LocationDialog < Wx::Dialog def initialize ## set dialog characteristics title = "Location dialog" size = Wx::Size.new(250, 305) position = Wx::DEFAULT_POSITION style = Wx::SYSTEM_MENU name = "location dialog" ## create dialog super(WxSU.app.sketchup_frame, -1, title, position, size, style, name) ## fields and buttons ## city citySTPos = Wx::Point.new(10,10) citySTSize = Wx::Size.new(110,20) cityST = Wx::StaticText.new(self, -1, 'city', citySTPos, citySTSize, Wx::ALIGN_RIGHT) cityTCPos = Wx::Point.new(130,10) cityTCSize = Wx::Size.new(100,20) @cityTC = Wx::TextCtrl.new(self, -1, '', cityTCPos, cityTCSize, Wx::TE_LEFT) ## timezone offset tzSTPos = Wx::Point.new(10,130) tzSTSize = Wx::Size.new(110,20) tzST = Wx::StaticText.new(self, -1, 'timezone offset', tzSTPos, tzSTSize, Wx::ALIGN_RIGHT) tzCPos = Wx::Point.new(130,130) tzCSize = Wx::Size.new(70,20) tzChoices = (-12..12).to_a.collect{ |e| e.to_s } tzC = Wx::Choice.new(self, -1, tzCPos, tzCSize, tzChoices) ## a bunch more fields here that I've omitted for brevity ## okay button okBPos = Wx::Point.new(130,255) okBSize = Wx::Size.new(100,20) okButton = Wx::Button.new(self, Wx::ID_OK, 'okay', okBPos, okBSize, Wx::BU_BOTTOM) self.set_affirmative_id(okButton.get_id()) ## identifies button as dialog "OK" button #evt_button(okButton.get_id()) {|e| on_okButton(e)} # attempt 1 #evt_button(okButton.get_id()) {|e| puts "test" } # attempt 2 ## cancel button canBPos = Wx::Point.new(20,255) canBSize = Wx::Size.new(100,20) canButton = Wx::Button.new(self, Wx::ID_CANCEL, 'cancel', canBPos, canBSize, Wx::BU_BOTTOM) self.set_escape_id(canButton.get_id()) ## identifies button as dialog "cancel" button end ## initilize end ## LocationDialog I tried using the button event handling block to point the button to another method ("attempt 1" commented out above), but when I do it this way, I can't get the LocationDialog.show_modal method to return anything but a Fixnum 0 when "OK" is clicked (it should be returning either a Fixnum 5100, or a Wx::ID_OK), which is problematic because I need this return value for logic elsewhere in my code. I also tried simply putting the code I need right in the block ("attempt 2", commented out above). When I do this the code in the block executes as I would hope, but nothing else I need to happen happens -- ie, the dialog doesn't close, and the LocationDialog.show_modal doesn't return the correct value. So: I'm wondering how I can accomplish this. Any suggestions would be very much appreciated. Josh -- Posted via http://www.ruby-forum.com/. From mario at ruby-im.net Fri Jun 11 16:56:00 2010 From: mario at ruby-im.net (Mario Steele) Date: Fri, 11 Jun 2010 16:56:00 -0400 Subject: [wxruby-users] Wx::Dialog: run code when OK button selected In-Reply-To: <33d16892fb64a67ac3cf3e6182ba9c80@ruby-forum.com> References: <33d16892fb64a67ac3cf3e6182ba9c80@ruby-forum.com> Message-ID: Hello Josh, Welcome to the wxRuby community, and thank you for using wxRuby with wxSU. While wxSU isn't a package we officially support, it's not much different then a Normal wxRuby application. And your specific problem, does fall into the reign of wxRuby itself. A common mis-conception about Dialogs, is that return values are anything of meaning, aside from the default values of Wx::ID_OK, Wx::ID_CANCEL. Wx::Dialog#show_modal will always return these values, to determine if the dialog was Cancelled, or okayed by the user. You should check for these values to ensure that your dialog was accepted by the user, before attempting to get any values from the dialog. Now, with the establishment of how Wx::Dialog#show_modal returns values, to get your specific values out of the dialog, you have one of two ways in which to gather the data from your custom Dialog. Both methods are similar, in the way to extract the data, but one specific method is designed to be internal to your custom Dialog class, and the other is an external way. The Internal way to get your data, is to create a method to retrieve the values you need from your dialog, and return them as an array. As such: class LocationDialog < Wx::Dialog # After your initialization function add this: def get_values() values = [] values << @cityTC.get_value values << @tzC.get_index return values end end The other method, is similar to the above method, but instead of having the function built into your Dialog class, you make your control instances as attributes on your Dialog Class itself, to get the values out of them. Like So: class LocationDialog < Wx::Dialog attr_reader :cityTC, :tzC # Do your initialization stuff here end Now, in your main app, where you do the Dialog#show_modal, you can use either method to get the data. The first Method: def on_get_info() dlg = LocationDialog.new if dlg.show_modal == Wx::ID_OK data = dlg.get_values() # Parse your data here end dlg.destroy end The Second Method: def on_get_info() dlg = LocationDialog.new if dlg.show_modal == Wx::ID_OK city = dlg.cityTC.get_value tz = dlg.tzC.get_index # Parse your data here end dlg.destroy() end My personal preference would be the first method, as all your data is gathered at once. But you can use any method you wish. This is the best way to gather the data from a custom dialog that you have built. If you have any further questions, please feel free to ask on this list, as we are always happy to help out new comers. hth, Mario On Thu, Jun 10, 2010 at 6:59 PM, Josh Kjenner wrote: > Howdy; > > I'm using wxRuby to build menus for a Sketchup plug-in I'm working on. > (Specifically, I'm actually using wxSU, http://wxsu.sourceforge.net/, > which is basically wxRuby packaged up as a Sketchup plug-in). > > I'm trying to create a custom dialog to gather information from the user > via text boxes (implemented with Wx::TextCtrl) and pull-down menus > (implemented with Wx::Choice). My problem is that I can't figure out how > to get the information entered via these means out of the Wx::Dialog > object they live in when the "OK" button is clicked. Here is the > relevant code: > > ## this is the WX code for an improved location dialog > class LocationDialog < Wx::Dialog > > def initialize > > ## set dialog characteristics > title = "Location dialog" > size = Wx::Size.new(250, 305) > position = Wx::DEFAULT_POSITION > style = Wx::SYSTEM_MENU > name = "location dialog" > > ## create dialog > super(WxSU.app.sketchup_frame, -1, title, position, size, style, > name) > > ## fields and buttons > ## city > citySTPos = Wx::Point.new(10,10) > citySTSize = Wx::Size.new(110,20) > cityST = Wx::StaticText.new(self, -1, 'city', citySTPos, > citySTSize, Wx::ALIGN_RIGHT) > > cityTCPos = Wx::Point.new(130,10) > cityTCSize = Wx::Size.new(100,20) > @cityTC = Wx::TextCtrl.new(self, -1, '', cityTCPos, cityTCSize, > Wx::TE_LEFT) > > ## timezone offset > tzSTPos = Wx::Point.new(10,130) > tzSTSize = Wx::Size.new(110,20) > tzST = Wx::StaticText.new(self, -1, 'timezone offset', tzSTPos, > tzSTSize, Wx::ALIGN_RIGHT) > > tzCPos = Wx::Point.new(130,130) > tzCSize = Wx::Size.new(70,20) > tzChoices = (-12..12).to_a.collect{ |e| e.to_s } > tzC = Wx::Choice.new(self, -1, tzCPos, tzCSize, tzChoices) > > ## a bunch more fields here that I've omitted for brevity > > ## okay button > okBPos = Wx::Point.new(130,255) > okBSize = Wx::Size.new(100,20) > okButton = Wx::Button.new(self, Wx::ID_OK, 'okay', okBPos, > okBSize, Wx::BU_BOTTOM) > self.set_affirmative_id(okButton.get_id()) ## identifies button > as dialog "OK" button > #evt_button(okButton.get_id()) {|e| on_okButton(e)} # attempt 1 > #evt_button(okButton.get_id()) {|e| puts "test" } # attempt 2 > > > ## cancel button > canBPos = Wx::Point.new(20,255) > canBSize = Wx::Size.new(100,20) > canButton = Wx::Button.new(self, Wx::ID_CANCEL, 'cancel', > canBPos, canBSize, Wx::BU_BOTTOM) > self.set_escape_id(canButton.get_id()) ## identifies button as > dialog "cancel" button > > end ## initilize > > end ## LocationDialog > > I tried using the button event handling block to point the button to > another method ("attempt 1" commented out above), but when I do it this > way, I can't get the LocationDialog.show_modal method to return anything > but a Fixnum 0 when "OK" is clicked (it should be returning either a > Fixnum 5100, or a Wx::ID_OK), which is problematic because I need this > return value for logic elsewhere in my code. > > I also tried simply putting the code I need right in the block ("attempt > 2", commented out above). When I do this the code in the block executes > as I would hope, but nothing else I need to happen happens -- ie, the > dialog doesn't close, and the LocationDialog.show_modal doesn't return > the correct value. > > So: I'm wondering how I can accomplish this. Any suggestions would be > very much appreciated. > > Josh > -- > 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 Lieutenant 3 - Geo 99 XO - STO IFT Fleet Chief Engineer - Second Life http://www.iftcommand.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Mon Jun 14 16:44:06 2010 From: lists at ruby-forum.com (Josh Kjenner) Date: Mon, 14 Jun 2010 22:44:06 +0200 Subject: [wxruby-users] Wx::Dialog: run code when OK button selected In-Reply-To: References: <33d16892fb64a67ac3cf3e6182ba9c80@ruby-forum.com> Message-ID: <940bb560eb2babed4f626f7da5e715f4@ruby-forum.com> Hi Mario; Thanks a lot for your response. I was able to solve my problem by using "The First Method" you describe above. It's funny, I definitely had the thought to create a method that would store the data collected from the dialog's fields, but I couldn't figure out a way to call it between the OK button being clicked and the dialog being destroyed. I'm a little embarrassed I didn't think of using if/then -- thanks a lot for taking the time to point it out to me! Josh -- Posted via http://www.ruby-forum.com/. From mario at ruby-im.net Mon Jun 14 18:05:10 2010 From: mario at ruby-im.net (Mario Steele) Date: Mon, 14 Jun 2010 18:05:10 -0400 Subject: [wxruby-users] Wx::Dialog: run code when OK button selected In-Reply-To: <940bb560eb2babed4f626f7da5e715f4@ruby-forum.com> References: <33d16892fb64a67ac3cf3e6182ba9c80@ruby-forum.com> <940bb560eb2babed4f626f7da5e715f4@ruby-forum.com> Message-ID: Not a problem Josh, Don't feel to bad about it, everyone starts out not knowing a thing, and they learn. Sometimes from Documentation, sometimes from others. Whenever you have a question, don't hesitate to ask, that's why we are here to help out the future developers that come along, wanting to use wxRuby in whatever shape or form, for something that they want to develop. Have fun, Mario On Mon, Jun 14, 2010 at 4:44 PM, Josh Kjenner wrote: > Hi Mario; > > Thanks a lot for your response. I was able to solve my problem by using > "The First Method" you describe above. It's funny, I definitely had the > thought to create a method that would store the data collected from the > dialog's fields, but I couldn't figure out a way to call it between the > OK button being clicked and the dialog being destroyed. I'm a little > embarrassed I didn't think of using if/then -- thanks a lot for taking > the time to point it out to me! > > Josh > -- > 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 Lieutenant 3 - Geo 99 XO - STO IFT Fleet Chief Engineer - Second Life http://www.iftcommand.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From real.sergeych at gmail.com Mon Jun 21 01:57:45 2010 From: real.sergeych at gmail.com (=?UTF-8?B?0KHQtdGA0LPQtdC5INCn0LXRgNC90L7Qsg==?=) Date: Mon, 21 Jun 2010 09:57:45 +0400 Subject: [wxruby-users] distributing and application In-Reply-To: <3775376f58c938f84126cce8b13b6543@ruby-forum.com> References: <4C0C952F.9010900@gmx.de> <3776376e95c2cb36402324686c112898@ruby-forum.com> <3775376f58c938f84126cce8b13b6543@ruby-forum.com> Message-ID: cocoa is great but there will be "3 platforms" - am I wrong? 2010/6/10 Sergio Ruiz > > > So ... if you don't end up writing Java code - let us know what your > > solution was :) > > > > i have decided i will probably go with Qt or cocoa... > -- > 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 mario at ruby-im.net Mon Jun 21 07:16:59 2010 From: mario at ruby-im.net (Mario Steele) Date: Mon, 21 Jun 2010 07:16:59 -0400 Subject: [wxruby-users] New Debian/Ubuntu repository! Message-ID: Greetings all, I am happy to announce the opening of my own personal repository to store packages in for Debian/Ubuntu. Chiefly amongst these, is the new deb package for wxRuby! This will solve the issues that people have been having attempting to install wxruby from the gem on Ubuntu 9.10 and later. To setup this apt-repository on your Debian / Ubuntu system, simply run the following commands: wget -q http://repo.trilake.net/apt/repo.gpg -O- | sudo apt-key add - sudo wget http://repo.trilake.net/apt/sources.list.d/lucid.list -O /etc/apt/sources.list.d/trilake.list Once you do the above, simply execute: sudo apt-get update sudo apt-get install wxruby To install the wxRuby 2.0.1 deb package on your system. Currently, only a 32bit version is available, but I will be updating my repository with a 64bit version once I have the package built on my server. Any questions, comments, suggestions, what have you, please feel free to email me. L8ers, Mario -- Mario Steele Lieutenant 3 - Geo 99 XO - STO IFT Fleet Chief Engineer - Second Life http://www.iftcommand.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From alex at pressure.to Mon Jun 21 07:26:05 2010 From: alex at pressure.to (Alex Fenton) Date: Mon, 21 Jun 2010 12:26:05 +0100 Subject: [wxruby-users] New Debian/Ubuntu repository! In-Reply-To: References: Message-ID: <4C1F4C4D.8070708@pressure.to> Mario Steele wrote: > I am happy to announce the opening of my own personal repository to > store packages in for Debian/Ubuntu. Chiefly amongst these, is the > new deb package for wxRuby! This will solve the issues that people > have been having attempting to install wxruby from the gem on Ubuntu > 9.10 and later. Mario - this is great news, thanks for working on this. I'm looking forward to trying this out when I get home. alex From lists at ruby-forum.com Mon Jun 21 10:53:27 2010 From: lists at ruby-forum.com (Sergio Ruiz) Date: Mon, 21 Jun 2010 16:53:27 +0200 Subject: [wxruby-users] distributing and application In-Reply-To: References: <4C0C952F.9010900@gmx.de> <3776376e95c2cb36402324686c112898@ruby-forum.com> <3775376f58c938f84126cce8b13b6543@ruby-forum.com> Message-ID: <1da4ee85b7209ab2db80122b4d6d07cd@ruby-forum.com> Sergey Chernov wrote: > cocoa is great but there will be "3 platforms" - am I wrong? > not sure what you mean.. -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Tue Jun 22 03:27:41 2010 From: lists at ruby-forum.com (John Davidson) Date: Tue, 22 Jun 2010 09:27:41 +0200 Subject: [wxruby-users] Stuck noobie: XRC/xrcise woes Message-ID: Hi, I'm teaching myself to use wxRuby and DialogBlocks to create a front end for a Ruby program I wrote. And I'm hopelessly stuck! In DialogBlocks (or indeed wxFormBuilder, which gives me the same problem) I can create a widget, give that widget a new id and class name (in the example I created below, text_box1 and CaseChangeTextCtrl1, respectively), and then add a module which utilises that widget in my program, no problem. But the moment I try to add a second widget with a second id and a second class, (in the example below, text_box2 and CaseChangeTextCtrl2 ) I get an "uninitialized constant" error for that widget when I run my program. I don't understand it at all. The two widgets are the same, except they have different class names and different id names. Is there some limit (a limit of 1) to the number of classes you can create in an XRC file or xrcise-generated rb file? Do you have to get DialogBlocks to create separate files for each new class apart from the first class, or something? I am sure I am missing something simple. But I have spent hours on this, and can't figure it out. Please! Help! Me! warm regards John Below is everything in the chain: 1) the xrc file created by dialogblocks; 2) the rb file generated from that xrc file by xrcise (this is the file that produces the error); 3) the user-written code (in this case, an exercise taken from the web) that calls that xrcise-generated rb file; and 4) the error message. 1) ###### the xrc file ##### ; 400,300 From Scratch 1 wxVERTICAL wxGROW|wxALL 5 wxALIGN_CENTER_HORIZONTAL|wxALL 5 wxALIGN_CENTER_HORIZONTAL|wxALL 5 wxGROW|wxALL 5 2) ######## the ruby file generated by xrcise ###### # This class was automatically generated from XRC source. It is not # recommended that this file is edited directly; instead, inherit from # this class and extend its behaviour there. # # Source file: exercise.xrc # Generated at: Tue Jun 22 16:49:12 +1000 2010 class TextFrameBase < Wx::Frame attr_reader :text_box1, :upper_bt, :lower_bt, :text_box2 def initialize(parent = nil) super() xml = Wx::XmlResource.get xml.flags = 2 # Wx::XRC_NO_SUBCLASSING xml.init_all_handlers xml.load("exercise.xrc") xml.load_frame_subclass(self, parent, "ID_WXFRAME") finder = lambda do | x | int_id = Wx::xrcid(x) begin Wx::Window.find_window_by_id(int_id, self) || int_id # Temporary hack to work around regression in 1.9.2; remove # begin/rescue clause in later versions rescue RuntimeError int_id end end @text_box1 = finder.call("text_box1") @text_box1.extend(CaseChangeTextCtrl1) @upper_bt = finder.call("upper_bt") @lower_bt = finder.call("lower_bt") @text_box2 = finder.call("text_box2") @text_box2.extend(CaseChangeTextCtrl2) #<<<<< THIS IS THE BAD LINE THAT CAUSES THE ERROR if self.class.method_defined? "on_init" self.on_init() end end end 3) ######## Exercise.rb ######## require 'rubygems' require 'wx' # load in the generated code require 'my_frame' # Mix-in for a Wx::TextCtrl module CaseChangeTextCtrl1 # convert all the text in the control to upper case def upcase! self.value = self.value.upcase end # convert all the text in the control to lower case def downcase! self.value = self.value.downcase end end # Inherit from the generated base class and set up event handlers class CaseChangeFrame < TextFrameBase def initialize super evt_button(upper_bt) { text_box1.upcase! } evt_button(lower_bt) { text_box1.downcase! } end end # Run the class Wx::App.run do CaseChangeFrame.new.show end 4) ##### ERROR MESSAGE: ##### R:\GUI\Practice\Exercise>ruby Exercise.rb ./my_frame.rb:37:in `initialize': uninitialized constant TextFrameBase::CaseChangeTextCtrl2(NameError) from Exercise.rb:21:in `initialize' from Exercise.rb:29:in `new' from Exercise.rb:29:in `on_init' from C:/Ruby187/lib/ruby/gems/1.8/gems/wxruby-2.0.1-x86-mingw32/lib/wx/classes/app.rb:16:in `main_loop' from C:/Ruby187/lib/ruby/gems/1.8/gems/wxruby-2.0.1-x86-mingw32/lib/wx/classes/app.rb:16:in `run' from Exercise.rb:28 -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Tue Jun 22 03:44:20 2010 From: lists at ruby-forum.com (John Davidson) Date: Tue, 22 Jun 2010 09:44:20 +0200 Subject: [wxruby-users] Stuck noobie: XRC/xrcise woes In-Reply-To: References: Message-ID: Dont worry. Figured it out. I was writing empty modules for the new classes, thinking that would suffice as I went along, but I need to put some placeholder functions into them. cheers John -- Posted via http://www.ruby-forum.com/. From mario at ruby-im.net Tue Jun 22 05:27:18 2010 From: mario at ruby-im.net (Mario Steele) Date: Tue, 22 Jun 2010 05:27:18 -0400 Subject: [wxruby-users] New Debian/Ubuntu repository! In-Reply-To: <4C1F4C4D.8070708@pressure.to> References: <4C1F4C4D.8070708@pressure.to> Message-ID: On Mon, Jun 21, 2010 at 7:26 AM, Alex Fenton wrote: > Mario Steele wrote: > >> I am happy to announce the opening of my own personal repository to store >> packages in for Debian/Ubuntu. Chiefly amongst these, is the new deb >> package for wxRuby! This will solve the issues that people have been having >> attempting to install wxruby from the gem on Ubuntu 9.10 and later. >> > > > Mario - this is great news, thanks for working on this. I'm looking forward > to trying this out when I get home. Thank you Alex, due to the nature in which we build wxRuby, it was a pain in the wazoo to get setup properly to where I could create a deb file for it. lol A new update to the repository, I have added a wxsugar package to my repository, so you can now get wxruby and wxsugar from the same repository. This repository will help with people needing an easy and familiar way to install the wxRuby package on systems that they are developing on, as well as setting up a way for easy distribution on Debain based Linux systems. If you have an application that you want to package as a deb, or want to include in my repository, please feel free to email me off-list, and I will help out in any way I can. Mario -- Mario Steele Lieutenant 3 - Geo 99 XO - STO IFT Fleet Chief Engineer - Second Life http://www.iftcommand.com -------------- next part -------------- An HTML attachment was scrubbed... URL: