Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Text List + Fixed text in one field

  • macros8 - 2023-06-14

    Hi everybody,

    as we have Codesys as one of the supported HMI sw, I´m trying to get as much knowledge as I can. Since I´m experienced with other HMI sw, I´ve been searching for differences and possibilities I can get with Codesys Visu.

    Here is my first question here:)
    Is there any chance to combine Fixed text with Text list in one Text Field?
    My goal is to make button with state On/Off (textlist) but also define tech. object.
    Device1: On/Off
    Device2: On/Off

    I have tried this setting (attached) but it does not work and only Text list string can be seen.

    Note: I know I could create string somewhere in a function on PLC side but it seems quite complicated solution. I rather have everything inside HMI tools to keep project clear and easy to read.

    Thanks a lot.
    (More questions come soon:))

  • ben1 - 2023-07-03

    Couldn't you just put a label above the text list?

    • macros8 - 2023-07-03

      Hi ben1,
      yes, I can. But you have to take care about alignment then to keep label e.g. always in center etc.

      It would be just much more comfortable so I´m asking if I haven´t missed anything because I know it from different HMI sw.

  • ben1 - 2023-07-04

    Understood, you could always make a frame. I'm not sure what this type of thing would be referred to in HMI SW but it is basically like making your own button, with placeholders for the tags.

    So you create the frame (which is just a visualization) and then insert it in each place you want it and populate the tags.

    • macros8 - 2023-07-04

      Hi ben1,
      actually that´s what I do. I want to create universal button with integrated functionality.

      But the problem I observed is, that if you change size of that framework, text size is also adjusted so the alignment is not fixed.
      And to be honest, I´m not sure whether I can put Text_list as an input var to Frame, anyway - do you know?

      If would be great having chance to concat fixed Text with Text_list. It also could be useful for some status of the device/machine etc.


  • ben1 - 2023-07-05

    You can imbed the placeholder into the text list.

    Create a text list with placeholders for the DEVICE.

    In a text field set this up as your text list, use your appropriate index and then just type the name of the device (or whatever that happens to be) in the Text Variable field.

    And then you can copy-paste it as many times as you want and just change the device name. Resize the image and play with the font settings however you please.

    Is that the solution you are looking for?

  • ben1 - 2023-07-05

    Not sure why those images didn't come through, I'll attach them to this post.

    • macros8 - 2023-07-12

      Hi Ben1,

      sorry I did not reply sooner but I haven´t received notification.
      This is actually super cool! I have to tried immediately;)

      Thanks a lot for super hint!

      And meanwhile I observed one more issue related to Text list.
      If I want to use object with text list as Input, I cannot find a way how to represent variable as Text list entries in input dialog.
      Usually it works in a same way as Enum data type in PLC code but in visu here I see only e.g. TRUE/FALSE or numbers.

      Is there a way how to get functionality same like ENUM in PLC?

      Thanks a lot.


      Last edit: macros8 2023-07-12
    • macros8 - 2023-07-24

      Hi Ben1,

      I have figured out that input can be done by Combo box and Text list reference. It works fine for integer value.
      But don´t you know any trick, how to control Boolean variable?

      I have an ON/OFF input represents by Boolean. But as soon as I map boolean to Combobox integer, it´s not working. I have tried conversion INT_TO_BOOL and opposite but it does not help.
      I believe you know some tricky way;)

      Thanks a lot.

  • ben1 - 2023-07-25

    Hi macros,

    I don't understand the purpose of this.
    A Boolean only has 2 options, why would you not use a button?

    A combo box seems like a huge complication to a simple solution.

    There may be some convoluted way to do it but the integer in the combo box variable is Read/Write, so converting either way as you tried would not work.


    • macros8 - 2023-07-26

      Hi ben,

      generally you right, of course. Just imagine to have some standardized control for technology and some of them would have only two options for selection (but you would have the modes represented by integer in PLC side then, anyway).

      Mostly, I´m curious to get complete overview what is possible and what not because we´ll support some customers soon.


Log in to post a comment.