Home Programming

Discussion

Left ArrowBack to discussions page
fihcncfihcnc Posts: 8 Apprentice
Like the title says, how can i line-break a popup or input-prompt? For most languages I know, adding \n to the text would break the line.
Lets say i want to print the following:
This is an example
of what im trying to do
Neither of the following lines work
popup("This is an example \n of what im trying to do", "Title", False, False)
popup("This is an example" + \n + "of what im trying to do", "Title", False, False)
Tagged:

Comments

  • bcastetsbcastets Vacuum Beta tester Posts: 595 Expert
    I cannot find information in UR script manual about this.
    As a work around you could add some spaces until you reach the maximum width of the window ?
    It is a big heavy but it should works.
  • fihcncfihcnc Posts: 8 Apprentice
    edited February 2020
    bcastets said:
    I cannot find information in UR script manual about this.
    As a work around you could add some spaces until you reach the maximum width of the window ?
    It is a big heavy but it should works.
    Multiple spaces in script command is ignored, even when within quotation-marks. So both:
    " + " " + " " + " newline", "Title", False, False)popup("Test                 newline", "Title", False, False)
    popup("Test 
    Outputs:
    Test newline
    (The  " " + " " + " " + " "... was in an attempt to force it to print multiple spaces
  • fihcncfihcnc Posts: 8 Apprentice
    bcastets said:
    I cannot find information in UR script manual about this.
    As a work around you could add some spaces until you reach the maximum width of the window ?
    It is a big heavy but it should works.
    Doesn't work. Multiple spaces only gets printed as a single space.
    Trying to force it by using "StringPart1 " + " " + " " + " " + " String part 2" doesn't work either
  • bcastetsbcastets Vacuum Beta tester Posts: 595 Expert
    I tried :
    "line1"<br>"line2"
    It works.
    I looks like popup handle html code.
  • fihcncfihcnc Posts: 8 Apprentice
    For future readers:
    Apperantly displayed text in UR can be formatted using HTML in general.
    <h1>Your headline here</h1> (Results in a headline)
    <b>Your bold text here</b> (Bold text)
    <p>Your paragraph here</p> (Using multiple paragraphs in succession negates the need for <br>)
    Text can also be styled using style="color: [color]; padding-top: 30px;" and such<br>


  • bcastetsbcastets Vacuum Beta tester Posts: 595 Expert
    Thank you for sharing this. We can now have popup with some style !
  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,261 Handy
    @fihcnc THANK YOU!!  That is awesome. I don’t know why I never thought of it knowing the GUI is modified html but it never even entered my mind. 
Sign In or Register to comment.
Left ArrowBack to discussions page