Skip to main content
May 25, 2024
Solved

Interface Buttons

  • May 25, 2024
  • 5 replies
  • 0 views

I want to create 4 buttons in interface which initially have no colors but when we click on them it turns to blue color( need the code using for loop)

    Best answer by konduruc733182

    What is your requirement? Where are these buttons going to be used? 

    Below is a sample how you could manipulate the style of the button or or you can use the similar logic at the color parameter.

    a!localVariables(
      local!values:{1,2,3,4},
      local!selection:0,
      a!buttonArrayLayout(
        buttons: a!forEach(
          items: local!values,
          expression: a!buttonWidget(
            label: concat("button"," ",fv!item),
            value: fv!item,
            saveInto: local!selection,
            style: if(
              local!selection=fv!item,
              "SOLID",
              "OUTLINE"
            )
          )
        )
      )
    )

    your value that is being saved would evaluate the color. here I have written in a!forEach() for understanding. But if you share us the details on where and what an accurate solution can be provided.

    5 replies

    stefanhelzle0001
    Brainy
    May 25, 2024

    What did you try so far? Buttons have a color attribute which can be made to change on conditions. Some local variable could hold state.

    But, do you want to share your use case?

    May 25, 2024

    Can you share your use case? for that button is used in

    konduruc733182
    May 26, 2024

    What is your requirement? Where are these buttons going to be used? 

    Below is a sample how you could manipulate the style of the button or or you can use the similar logic at the color parameter.

    a!localVariables(
      local!values:{1,2,3,4},
      local!selection:0,
      a!buttonArrayLayout(
        buttons: a!forEach(
          items: local!values,
          expression: a!buttonWidget(
            label: concat("button"," ",fv!item),
            value: fv!item,
            saveInto: local!selection,
            style: if(
              local!selection=fv!item,
              "SOLID",
              "OUTLINE"
            )
          )
        )
      )
    )

    your value that is being saved would evaluate the color. here I have written in a!forEach() for understanding. But if you share us the details on where and what an accurate solution can be provided.

    May 26, 2024

    Thank you for the code.
    Actually I was doing some mistake in logic but now it worked.

    May 27, 2024

     I want this answer also Thanks .