Maximum Length displayed string in a uiLabel

Home Forums General Programming Maximum Length displayed string in a uiLabel

Tagged: 

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #117853
    damien
    Participant
      • Topics: 15
      • Replies: 62
      • Total: 77

      Hi,
      I want to get some info about the feature “Label displays last change modulator” in a uiLabel modulator.
      value displayed as :

      %N = %s

      Is there a way to easily limit the number of character displayed in a uiLabel with a regex expression or an other method like (0,maxlength) in java?

      let’s say I want to display only 14 letters and chop off the rest, but the real string is 20 letters long.

      /^[a-z]{0,14}$/

      or in java

      String aString =”123456789ABCDE…”;
      String displayedString = aString.substring(0, 14);

      thanks a lot!

      #117862
      goodweather
      Participant
        • Topics: 45
        • Replies: 550
        • Total: 595
        • ★★★

        Hi Damien,
        first of all, I have never tried “Label displays last change modulator” because I want my modulator’s labels to be fixed.
        To achieve those things, I’m using a separate uiLabel component that I control from the modulator I’m changing.
        Use Lua methods (similar to your java code) and attach a method to your main modulator (When modulator value changes).

        Example:

        sName = utils.askForTextInputWindow ("Rename program", "The program name will be truncated at 14 characters.", "", "Program name:", false, "OK", "Cancel")
        txtLCDprogram:getComponent():setPropertyString ("uiLabelText", string.sub(tostring(sName,1,14))

        where my txtLCDProgram is a variable declared as
        txtLCDprogram = panel:getModulatorByName("LCDprogram")

        #117876
        damien
        Participant
          • Topics: 15
          • Replies: 62
          • Total: 77

          Thanks Goodweather. I’ll display the truncated string via a LUA script as recommanded. cheers

        Viewing 3 posts - 1 through 3 (of 3 total)
        • The forum ‘Programming’ is closed to new topics and replies.
        There is currently 0 users and 81 guests online
        No users are currently active
        Forum Statistics
        Threads: 2,495, Posts: 17,374, Members: 77,605
        Most users ever online was 12 on January 22, 2019 3:47 pm
        Ctrlr