[wxruby-users] New problem: Newlines.

Alex Fenton alex at pressure.to
Thu Jan 8 15:29:20 EST 2009


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


More information about the wxruby-users mailing list