Newline - again

Help creating logic scripts for Air Manager Instruments

Moderators: russ, Ralph

Post Reply
Message
Author
RoundEngine
Posts: 122
Joined: Thu Sep 12, 2019 8:27 pm

Newline - again

#1 Post by RoundEngine »

I did see some old posts on this but no resolution.

I have a text box and use txt_set to set text in it. I am running a test and first started with "Test\nLine2" but that didn't work as I get TESTxLINE2 where X is some strange character.

Next I decided to use string.format and create a string s but that doesn't work either.

How do I get a newline to put in a text box or is that not possible. I am on AM 4.1.5 Desktop.

Thank you.

SimPassion
Posts: 5336
Joined: Thu Jul 27, 2017 12:22 am

Re: Newline - again

#2 Post by SimPassion »

Just create a txt_add for each line

RoundEngine
Posts: 122
Joined: Thu Sep 12, 2019 8:27 pm

Re: Newline - again

#3 Post by RoundEngine »

Okay. So it's smart enough to add a line for each txt_add. Definitely never would have thought of that!

I'd like to suggest the API Wiki be updated to include this information.

Thank you.

Edit. Reread this and realize what you said. I can do that but that's a pain if you have a bunch of multiline stuff.

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Newline - again

#4 Post by jph »

make any simple function to do what you want.

Code: Select all

function text_box_blah (text,line)
  -- do some stuff for spacing or whatever
  line = line * 15
  -- do some stuff for printing or formatting
  txt_add(text, "font:arimo_regular.ttf; size:14; color: black; halign:left;", 0, line, 200, 200)
end
-- send text and the line number
text_box_blah("hello",0)          -- line 0
text_box_blah("world",1)          -- line 1
text_box_blah("blah blah blah",2) -- line 2
there are many different ways and you can make it as simple or as complex as you like.
Joe. CISSP, MSc.

RoundEngine
Posts: 122
Joined: Thu Sep 12, 2019 8:27 pm

Re: Newline - again

#5 Post by RoundEngine »

Thanks. I'll look at it.

Post Reply