Announcement

Collapse
No announcement yet.

Adding a variable to an item of rich text

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Adding a variable to an item of rich text

    Hello

    Apologies for this very basic question...

    I want to display an item of text on each page of my presentation with a mixture of fixed text and a variable. Something like...

    "This product is © 1990-2022" where 2022 is the current year and therefore changes automatically.

    I can see that I am able to make a script to display this on a user click as follows...

    current_year = system.GetDate (6)
    Dialog.Message("The product is © 1990-",current_year)

    but am missing a trick when it comes to displaying this message at all times on each page.

    Any assistance would be appreciated.

  • #2
    If the text is being shown in a Label object, you can set the copyright notice with something like
    Code:
    Label.SetText("MyLabel", "This product is © 1990-" .. System.GetDate(DATE_FMT_YEAR));
    If the copyright notice needs to be part of a Rich Text document, then you would need to update the content of the document itself, replacing a placeholder text with the actual current year.

    Ulrich

    Comment


    • #3
      Thank you Ulrich

      If I create a Label object there's nowhere to enter the script, except as a result of a user click. Placing the script where the object text is, simply displays the script as text.

      Comment


      • #4
        check this

        msg.apz

        Comment


        • #5
          You would need to place the script in the On Preload or On Show event scripts, so the Label object receives the new caption as soon as the object is displayed, without the need of user interaction.
          If you do not see the page events, make sure that the option "Show Events" is checked:

          Click image for larger version

Name:	SCRN-2022-02-17-01.png
Views:	174
Size:	29.6 KB
ID:	308223

          Place the script I suggested into the desired event and test.

          Ulrich

          Comment


          • #6
            using rich text


            msg_rew.apz

            Comment


            • #7
              Thank you both. Perfect. All set up.

              Comment


              • #8

                Comment


                • #9
                  @Nigel Lorriman
                  sorry if I allow myself .... slightly more professional


                  Click image for larger version

Name:	skin1.png
Views:	173
Size:	90.5 KB
ID:	308230

                  Click image for larger version

Name:	skin2.png
Views:	160
Size:	248.8 KB
ID:	308231

                  Comment

                  Working...
                  X
                  😀
                  🥰
                  🤢
                  😎
                  😡
                  👍
                  👎