• Stuart Jones
    June 24, 2016 at 10:06 am #2231

    Hello,

    The other day, I saw a demonstration of associating a list with a horizontal layout, including a single control in the layout and then having that control be duplicated – for the length of the list – inside the layout. I have tried this with a list of strings and it works just fine. Now, I want to be able to manipulate the Nth item in my list of strings (change the color, for example). But I cannot figure out how to address the Nth item so that’s where I need help.

    My Horizontal Layout has a Control ID of StepsLayout and is bound to a list of strings. My Output Text control has a Control ID of StepsText and is bound to the current item of the list. Can you tell me what I’d need to do to address the Nth string?

    Thanks

    Stuart Jones.

    EQuintanilla
    June 24, 2016 at 10:52 am #2232

    Hey Stuart,

    If you know exactly which Output Text you want to access,  when you’re at the coach level you can use page.ui.get(“StepsText[x]”), where x is the index of the nth control.

    Another way can be with using an Integer control. So as an example, you would indicate in the Integer control which StepsText you want to access, and invoke some method on click of a Button control. So in the OnClick event of the button you could use:

    page.ui.get(“StepsText[” + ${IntegerControlId}.getValue() + “]”).setColorStyle(“S”);

    This takes the value from the Integer control and uses it to indicate the index of the Output Text.

    As a note, you should be aware that the index for the Output Text starts at 0.

    -Erick Q

    Stuart Jones
    June 24, 2016 at 11:18 am #2234

    Hello Erick,

    I think that I must have tried every combination/placement of  “.N” and “[N]” except for that one!! I tried it out and it works just fine. Thanks for your help.

    Stuart…

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Start typing and press Enter to search