Announcement

Collapse
No announcement yet.

Strings right aligned

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

  • Strings right aligned

    Hi there,

    Im using a ULCD-32PTU connected to an Arduino board. I have troubles with the alignment of text. Especially with right alignment of text. I want that the text(for example: "23.5") is right aligned, so that i can do a static text with " °F" after it, it should also work to display 0.1 °F, the right end of the text should always be at the same position.

    The thing is that in the IDE the text is right aligned, on the real display it is left aligned. I guess there is a simple solution, but i cant find it :-)


    best regards,

    Andreas

  • #2
    I have the same behavior with GEN4-ULCD-70DCT-CLB. Any ideas?

    Comment


    • #3
      Hi Andreas and Apfelstaedt,

      Welcome to the forum!

      To be able to change the string alignment, kindly refer to this thread:
      https://forum.4dsystems.com.au/forum...7948#post47948
      The problem discussed in this thread is: whenever the user writes to the string, it settles to be left-aligned although it was defined to be right-aligned in the 4D Workshop. I suggest that you look at the comments #3 and #6.

      If you have questions regarding with this thread, feel free to ask.

      Best regards,
      Danica
      Danica

      Comment


      • #4
        Tank you for the quick answer,

        i expected a bit a more straigt forward answer, like copy this code lines and u are fine...or just sorry it is strange, but it just dosent work...
        but lets fist look at the thread u linked:

        #3: Genie Magic, i cant find them on my IDE, i guess its only in Pro Version...
        #6: "There is a new version of the Genie Arduino library that should should be uploaded sometime today that will handle the above." the thread was from 2015, i have downloaded the library 2018, so i guess it should be inside? if not, where else?

        at the moment i print a left aligned string with everytime the same amount of chars, but this works only with fonts where the chars have all the same with, its a bit annoying...

        The aim of using this display is to get our setup up qick and not to waste hours to display a txt...i really didnt expect this...


        best regards,

        Andreas

        Comment


        • #5
          Hi Andreas,

          Apologies if the answer was not as straightforward as you expected.

          As discussed in the thread I posted in my last reply, text alignment set during design time is applicable to predefined strings only. Dynamic strings, on the other hand, are always left-justified, and it is up to the host to format the string being sent – e.g. by prepending the string with spaces (which I think you already tried).

          Just for reference, the above is documented in the application note
          ViSi-Genie Labels, Text, and Strings
          https://www.4dsystems.com.au/appnote/4D-AN-00013/

          In the first paragraph on page 21 it says:
          "Thus, the right -, centre -, or left - alignment of a predefined string when being formatted in the strings editor in Workshop does not apply to dynamic strings. Furthermore, a dynamic string does not automatically fit into the area defined by the strings container object. It will only be printed starting at the x and y coordinates of the strings container object. Formatting of predefined strings is set during design time, while formatting of dynamic strings is up to the host. "

          This is also documented in section 4.2.5.2 of the ViSi-Genie Reference Manual:
          "In order to display a dynamically created string the user can send the Write String ASCII command message. The default maximum string length is 75, this can be changed in the Workshop4 options for Genie. For Unicode string objects Unicode strings can be sent, using the Write String Unicode command message. CRs and LFs can be included and the user is responsible for the ‘formatting'".

          Another suggestion is the use of Genie Magic. Genie Magic allows you to insert custom code (a routine for aligning text for example) to a ViSi-Genie project. This feature is available in Workshop4 Pro only.

          I have attached a Workshop4 Pro project to demonstrate my point. To open the project, kindly start your Worskhop4 PRO trial period first by going to the File menu. Kindly choose “Options”, select the License tab, and then click on the Start Pro Trial button.
          rString.zip
          Also, a video demonstrating how to run the project is attached and another video link for the displayed output.
          GTX.mp4
          Display.mp4
          As for the Genie-Arduino Library, it is already updated with the Write String function which I assume you are already using in your code.

          Best regards,
          Danica
          Danica

          Comment


          • #6
            thank you very much, especially for demo project and the videos!


            best regards,

            Andreas

            Comment


            • #7
              Hi Andreas,

              We are pleased to have provided you with a solution. If you encounter any more problems, don't hesitate to visit the forum.

              Good luck!

              Best regards,
              Danica
              Danica

              Comment

              Working...
              X