web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Simple question, I guess
Power Apps
Answered

Simple question, I guess

(1) ShareShare
ReportReport
Posted on by 106

Hi

 

I have a simple question, but as i'm new to powerapps, it's not simple to me 🙂

I have 3 buttons, named Red, Green and Blue. When you click on one of these 3 buttons, then a circle should change color and get the color that the button is named. I can only get it to work, so that the circle gets the color when the button is pressed, but when the button is released, then the circle goes back to it's default color, i want it to keep the color until a new button is pressed.

Thanks.

Categories:
  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @Rene_Newbee 

    For each button OnSelect property

     

    Set(myColorVar,Self.Text)

     

     

    For the Circle Fill property

     

    ColorValue(myColorVar)

     

     

     

    See if it helps @Rene_Newbee 

     

    The result should be like this:

     redGreen.gif

    For more info on the functions used, check these guides:

     

  • MVP-Phipps Profile Picture
    3,521 Super User 2024 Season 1 on at

    Use a variable on button click: Set(variableName, colour)

     

    Then the circle colour will be your variable.

     

    Please Accept as Solution if it solves your question. Or just give it a Thumbs Up if it is helpful because this can help others.

    LinkedIn: https://www.linkedin.com/in/charlie-phipps-%F0%9F%91%A8%E2%80%8D%F0%9F%92%BB-91338715b/
    YouTube: https://www.youtube.com/channel/UChmFBGU1YKIU91sNMQ7buGg
    Twitter: https://twitter.com/phipps0218

  • Sanshubh Profile Picture
    512 on at

    Set variable on all three button's onclick event like this 

     

    Red Button : - Set(circlecolor,Red)

    Green Button : - Set(circlecolor,green)

    Blue Button: - Set(circlecolor,Blue)

     

    and set color property of circle as circlecolor.

  • Verified answer
    poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @SanshubhLubal 

     

    I think it is good, however, to avoid hard code I recommend same formula for each button OnSelect and to use it based on the name of the button they already gave that has the name of the color they want, so for the OnSelect of each button, the same formula can be used as follows:

     

    Set(myColorVar,Self.Text)

     

     

    However, this assumes that @Rene_Newbee has the literal name of the Button in the Text property (not the name in the Tree view). Otherwise, they should actually either do what you said @SanshubhLubal  and hard code it actually, or, they should instead use something like the Tooltip property to put the name of the color, and then use that.

     

    Also, it will not be possible to use the variable by itself in the Fill property of the Circle, the ColorValue function must be used, so like this for the Fill property of the Circle:

     

     

    ColorValue(myColorVar)

     

     

    See if it helps @Rene_Newbee 

  • Sanshubh Profile Picture
    512 on at

    I was reading the question and you two gave replies so our answers are kind of same.

  • poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @SanshubhLubal You are right. Also, if they meant the Tree view, and they don't want the button's Text property to literally be the name of the Color e.g. "Red", then they either have to put the color in the Tooltip property or some other property and use Self.Tooltip, or, they should actually hard code the colors for each button as inline strings exactly like you said believe it or not. Depending on their preference, you may be right that they should hard code it anyway for the name of the colors.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 352 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 323

#3
Mohsin Ali Profile Picture

Mohsin Ali 226

Last 30 days Overall leaderboard