|
View:
New views
12 Messages
—
Rating Filter:
Alert me
|
|
|
Best way to brake up a string within FXruby?
Reading this email at work? Make a change with Yahoo!Xtra Jobs _______________________________________________ fxruby-users mailing list fxruby-users@... http://rubyforge.org/mailman/listinfo/fxruby-users |
|
|
|
Re: Best way to brake up a string within FXruby?On Aug 25, 2009, at 3:56 , dave L wrote: > The way i was going to do this was to have it setup like this... > > control.text, control.text... = ALine.split(' ') > > but i got a error referring to split as being private! Are you sure ALine is a String? Dave _______________________________________________ fxruby-users mailing list fxruby-users@... http://rubyforge.org/mailman/listinfo/fxruby-users |
|
|
|
|
|
|
|
|
Right still not able to import String functionality into FXruby! the error i get is this... C:/Ruby1.8/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- string (LoadError) from C:/Ruby1.8/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from mymainwin.rb:5 >Exit code: 1 sample of code is this ... require 'time' require 'string' ' a method to break a line of text into words that are passed onto texfields for editting. def breakWord (theword) @atextfield.text, @btextfield.text, @ctextfield.text, @Dtextfield.text = theword.split(' ') end the data being passed into the above method *IS* text so for example string... "the fox jumped over" would be passed into breakWord and each control will get each word put into. I do have other requires and they work okay. I am using ruby 1.8.x on winXP and know the there isn't any problems with ruby. pointers? Is there a FXruby function that could be used? Dave. PS got the date/time issue sorted |
Right still not able to import String functionality into FXruby!
Lye and Bartosz Dz, Thanks for your replies. Firstly I'd be the first to admit I'm not the best programmer. And this highlights it but I DO try to resolve my issues before posting by googling, searching the Rdocs and reading your (Lye) good book for clues on dealing my issue. I have solved my current problem through using puts in the method to see what i was getting passed into it. so i had this what i had further down in my code and didn't suspect it as being at fault breakWord @CRlist3.currentItem Now i have done this breakWord @CRlist3.getItemText(@CRlist3.currentItem) Lo and behold i got the text associated with the line i had clicked broken down using split(' '). I must have done a search for a way to capture text when the list was clicked and come across the currentItem method (but it doesn't show up on the list for FXlist in the Rdoc's but setcurrentItem does anyway i can only say i miss understood what it was doing and I did not put in any put's statements prior to today to see what I was getting as this would've shown me my problem). I hope this posting may help others who are new to FXruby and aren't the best with FXruby/ruby but want to try using this GUI toolkit. know the volume of traffic isn't high but hope I am not putting people off me. Rgds, Dave. --- On Fri, 28/8/09, Lyle Johnson <lyle@...> wrote: > From: Lyle Johnson <lyle@...> > Subject: Re: [fxruby-users] Best way to brake up a string within FXruby? > To: fxruby-users@... > Received: Friday, 28 August, 2009, 1:26 AM > > On Aug 27, 2009, at 6:12 AM, dave L > wrote: > Right still > not able to import String functionality into > FXruby! > You don't have to import > string functionality into FXRuby, or into any other Ruby > program. It's built in to the Ruby language, > e.g. > "the fox jumped > over".split # => ["the", > "fox", "jumped", > "over"] > When you ask questions like > this, or your previous questions about how to determine the > date or time, it indicates to me that you might want to step > back a bit and get more comfortable with basic Ruby > programming. These questions have nothing at all to do with > FXRuby. > -----Inline Attachment Follows----- > > _______________________________________________ > fxruby-users mailing list > fxruby-users@... > http://rubyforge.org/mailman/listinfo/fxruby-users |
| Free embeddable forum powered by Nabble | Forum Help |