OnChartEvent

Back to topics list To post a new topic, please log in or register
avatar
Moderator
3408
GumRai 2015.04.01 04:08
 

I have a situation where I want my code to do something when eg. a trendline is clicked.

I also want to be able to move the line without the code being executed.

My problem is that when I double click to select the line to move it, the first of the 2 clicks activates the  CHARTEVENT_OBJECT_CLICK and executes the code.

I can't make a condition that checks whether the object is selected, because the object is not selected until the 2nd click.

I can't think of a work around.

Any ideas?

Thanks 

avatar
Moderator
3408
GumRai 2015.04.01 04:11 #
 
I know that I can do it by pressing a key before and using CHARTEVENT_OBJECT_KEYDOWN to create a flag, but I was just wondering about a different way
avatar
1172
sxTed 2015.04.01 08:39 #
 
GumRai:
I know that I can do it by pressing a key before and using CHARTEVENT_OBJECT_KEYDOWN to create a flag, but I was just wondering about a different way

Create an additional Button which when clicked performs the required action. 

 

avatar
735
honest_knave 2015.04.01 09:54 #
 

A variant of sxTed's idea: create a small innocuous button that acts as a toggle. When clicked, the CHARTEVENT_OBJECT_CLICK code doesn't fire. Once you're done, toggle your small button back again. 

avatar
735
honest_knave 2015.04.01 10:01 #
 

Or, turn on single-click object selection and make your other code work on a double-click (will need code to measure the time interval in order to establish whether it was as double-click).

 

avatar
Moderator
3408
GumRai 2015.04.01 11:15 #
 
sxTed:

Create an additional Button which when clicked performs the required action. 

 

honest_knave:

A variant of sxTed's idea: create a small innocuous button that acts as a toggle. When clicked, the CHARTEVENT_OBJECT_CLICK code doesn't fire. Once you're done, toggle your small button back again. 

Yes, I think that is the way to go.

Thanks 

Back to topics list  

To add comments, please log in or register