My Button Bar
Posted: Fri Aug 10, 2018 3:15 pm
I'm working on my first widget which is a block full of "buttons".
The intent here is that this will be for a survey application so these will be the answer options.
Still quite new to LCB, so I'm unsure if the way I'm planning to do others makes sense...
Drawing a bunch of round rectangles and the text is the easy part, but there are 2 things I would like to figure out how to do:
1. when a user presses a "rectangle" I need to determine which one is pressed and have that readable in some way... possibly just saving it as a property or returning it through mouseUp
2. when a "rectangle" is pressed, i need to inverse the colors to indicate that it is "selected" (or maybe change to a different color)
so my current strategy is...
-as the rects are drawn I will keep their locations in a List
-on mouseUp, I will get the location of the click and compare it across the List to see if it falls into one of the rects
-if I find one, then I will record the number of it in a property
-I will redraw the widget, each time comparing the element number to the save number and altering the colors accordingly.
before I wander too far into this, am I missing something simpler for determining what rect was clicked?
The intent here is that this will be for a survey application so these will be the answer options.
Still quite new to LCB, so I'm unsure if the way I'm planning to do others makes sense...
Drawing a bunch of round rectangles and the text is the easy part, but there are 2 things I would like to figure out how to do:
1. when a user presses a "rectangle" I need to determine which one is pressed and have that readable in some way... possibly just saving it as a property or returning it through mouseUp
2. when a "rectangle" is pressed, i need to inverse the colors to indicate that it is "selected" (or maybe change to a different color)
so my current strategy is...
-as the rects are drawn I will keep their locations in a List
-on mouseUp, I will get the location of the click and compare it across the List to see if it falls into one of the rects
-if I find one, then I will record the number of it in a property
-I will redraw the widget, each time comparing the element number to the save number and altering the colors accordingly.
before I wander too far into this, am I missing something simpler for determining what rect was clicked?