React to a button clicked inside another chart

To add comments, please log in or register
Jose Luis Lominchar
747
Jose Luis Lominchar  

Hi,

I want to ask you if it is possible to react to a button clicked from a chart that is opened from the main chart which the EA is executed on.

I load the EA in the main chart. In this main chart, under some circumstances another chart is opened.

Inside this new chart, the EA creates a button. And the click actions of this button are what I want to intercept in the original EA. Is this possible to achieve?

(When the new chart is created, the EA knows its ID. Also knows the NAME of the new button).

thanks!

 

Seng Joo Thio
1216
Seng Joo Thio  
Jose Luis Lominchar:

I want to ask you if it is possible to react to a button clicked from a chart that is opened from the main chart which the EA is executed on.

I load the EA in the main chart. In this main chart, under some circumstances another chart is opened.

Inside this new chart, the EA creates a button. And the click actions of this button are what I want to intercept in the original EA. Is this possible to achieve?

(When the new chart is created, the EA knows its ID. Also knows the NAME of the new button).

I doubt so. One possible way is to use ChartApplyTemplate() and assign one with a special indicator on the second chart, which will then capture button click and somehow communicate this action back to the original EA.

Marco vd Heijden
Moderator
12735
Marco vd Heijden  

Yes you can specify the chartID when you call for the OBJPROP_STATE of the button.

It is the first Parameter of the function ObjectGetInteger(chartID,...

Jose Luis Lominchar
747
Jose Luis Lominchar  
Thanks, I will try those tips.
Jose Luis Lominchar
747
Jose Luis Lominchar  

In graph 0 I have the EA. In others graphs I don’t have EAs, just buttons. But in the EA I know the others numGraphs and someBtnNames..

As Marco vd Heijden suggested I achieve it with the following inside onTick method of my EA:


bool btnPressed = ObjectGetInteger(numGraph, someBtnName, OBJPROP_STATE);
To add comments, please log in or register