I'm using a line chart with potentially 10 lines. When the user clicks on a element in the Legend, I want the corresponding line on the Chart to become hilited. In order to do this, I would be changing the line width. But since the Legend Buttons are created dynamically, by Animation Engine, I need to be able to use some code to add an On MouseUp handler to each of the buttons, which to increase the line width.
What's the best way of doing this?
Click Legend to Hilite Line on Chart
Moderators: heatherlaine, kevinmiller, robinmiller, malte
-
- Livecode Opensource Backer
- Posts: 430
- Joined: Sun Feb 13, 2011 8:43 pm
- Location: Seattle, USA
Re: Click Legend to Hilite Line on Chart
Here an example that illustrates one way this can be done.
Code: Select all
on mouseUp
put "click me" into temp
create button temp
set the loc of it to 200,100
set the width of it to 60
set the height of it to 30
set the script of btn "click me" to "on mouseUp" & cr & "beep" & cr & "end mouseUp"
set the label of btn "click me" to "I'm New"
end mouseUp
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Click Legend to Hilite Line on Chart
Hi townsend,
I wasn't sure when you first asked the question if you knew where the legend icon would be... now I know.
Since they are static why don't you just place transparent buttons on top of them?
Setting scripts is a pain because they are limited when running on a stand alone.
If you hide the buttons when they are not needed then they can't be activated.
Simon
I wasn't sure when you first asked the question if you knew where the legend icon would be... now I know.
Since they are static why don't you just place transparent buttons on top of them?
Setting scripts is a pain because they are limited when running on a stand alone.
If you hide the buttons when they are not needed then they can't be activated.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Click Legend to Hilite Line on Chart
You can set a behavior of the button...