In script variable, make new line or tab?
Moderator: Martin
-
- Posts: 186
- Joined: 12 Feb 2014 01:45
In script variable, make new line or tab?
Is it possible to make a new line or tab in a variable that you want to show in a widget?
Best regards,
AngelAtwOrk
AngelAtwOrk
Re: In script variable, make new line or tab?
You can use \n for a newline or \t for a tab:
variable = "line1\nline2";
variable = "line1\nline2";
-
- Posts: 186
- Joined: 12 Feb 2014 01:45
Re: In script variable, make new line or tab?
Thank you, but I cannot make it work. I am doing something wrong. Before writing I had tried with "//n" or /n or "/n" or //n. Outside our even inside a variable.
Could you please, please show me how to insert a tab or a new line anywhere in the following script as an example
Script:
global_senasteRestid = "{global_rBilstart,dateformat, d/M HH:mm}" + "- "+"{global_rBilstopp, dateformat, HH:mm }"+" "+" {v_googledur, dateformat,timezone, UTC, HH:mm} "+" "+"{v_googledist} "+" m"{global_origin, locationformat, multiline}/t{global_dest, locationformat, multiline } "
Could you please, please show me how to insert a tab or a new line anywhere in the following script as an example
Script:
global_senasteRestid = "{global_rBilstart,dateformat, d/M HH:mm}" + "- "+"{global_rBilstopp, dateformat, HH:mm }"+" "+" {v_googledur, dateformat,timezone, UTC, HH:mm} "+" "+"{v_googledist} "+" m"{global_origin, locationformat, multiline}/t{global_dest, locationformat, multiline } "
Best regards,
AngelAtwOrk
AngelAtwOrk
Re: In script variable, make new line or tab?
Did you try to use a backslash instead of a slash like this \n but not /n?
The option Multiline of the text element also has to be checked otherwise the line break will look like a regular space character.
The option Multiline of the text element also has to be checked otherwise the line break will look like a regular space character.
-
- Posts: 186
- Joined: 12 Feb 2014 01:45
Re: In script variable, make new line or tab?
OMG, I must have been very tired,when i tried to figure this out
. I looked at my old scripts and in the help section, but did not see that i again and again turned the backslash to a slash whilst trying.
The tab function does not work with multiline, is that correct?

The tab function does not work with multiline, is that correct?
Best regards,
AngelAtwOrk
AngelAtwOrk
Re: In script variable, make new line or tab?
Tab works better when multiline is enabled since another text layout algorithm is used. When multiline is turned off, a tab character looks more or less like a regular space character.
-
- Posts: 186
- Joined: 12 Feb 2014 01:45
Re: In script variable, make new line or tab?
In what context ? How do I enable multiline in widget display,notification, input dialog(get element) or write to file?
Best regards,
AngelAtwOrk
AngelAtwOrk
-
- Posts: 186
- Joined: 12 Feb 2014 01:45
Re: In script variable, make new line or tab?
Cannot make \t (tab) work, at least not in a message dialog. \n (new line) works fine. tab does not even insert a space (when I try, best to add
).

Best regards,
AngelAtwOrk
AngelAtwOrk
Re: In script variable, make new line or tab?
I assumed that you are talking solely about text elements on a custom widget. There's a check box Multiline directly under the text field in a custom widget to switch on the multiline mode.
It highly depends if a regular action supports multiple lines or not. Action Write to File for example should allow to press enter on most keyboards to write multiple lines to a file at a time.
Tab works for me in a message dialog, but it's also displayed as a single space for me.
I tested it using following message in an action Message Dialog: a{"\t"}b
Is there no space between the two characters on your device?
It highly depends if a regular action supports multiple lines or not. Action Write to File for example should allow to press enter on most keyboards to write multiple lines to a file at a time.
Tab works for me in a message dialog, but it's also displayed as a single space for me.
I tested it using following message in an action Message Dialog: a{"\t"}b
Is there no space between the two characters on your device?
-
- Posts: 186
- Joined: 12 Feb 2014 01:45
Re: In script variable, make new line or tab?
ok, i think i tried \t where it cannot be used
. In combination with location,locationformat,multiline. If. used there it will not insert a space.

Best regards,
AngelAtwOrk
AngelAtwOrk