A task with buttons ! - page 3

 
Vladimir Pastushak:

No way, it's not that simple, the button whose code is above will always push those buttons whose code is below...

That is, if we press the button whose code is above and then press the button whose code is below, the state of the first button will always press the last ...

It's a lot simpler, really. I don't see any problem or difficulty at all.

What are the buttons above?

 
Vladimir Pastushak:
When using OnChartEvent() the button's pressed can be determined by the button's name and then proceed as you suggested above, push buttons with other names, but this won't work in the tester...
What do you mean by name? How about this? It's not a push, it's an event. And the state is defined throughObjectGetInteger().
 
Dmitry Fedoseev:
How do you manage to callObjectGetInteger() to know if the button is pressed?

Like this

bool tmp=false;

ObjectGetInteger(0, "name",OBJPROP_STATE,0,tmp);
 
Dmitry Fedoseev:
What's that by the name? How about this? It's not a click, it's an event. And the status is determined byObjectGetInteger().
Are you kidding or are you serious?
 
You have your own loop there. So you need an array of button states. We are constantly going through all of this, and if the button state does not match the state from the array, this is our event. Now we do what we want, we have both buttons and array.
 
Vladimir Pastushak:
Are you kidding me or are you serious?
No. I'm actually terrified.
 
Dmitry Fedoseev:
You have your own cycle there. So you need an array of button states. We are constantly going through all of this, and if the button state does not match the state from the array, this is our event. Now we do what we want, we have both buttons and the array.
There are no loops, we just have 10 buttons drawn. No loops, no arrays, no structures... All in procedural style...
 
Dmitry Fedoseev:
No. I'm actually horrified.
Of what?
 
Vladimir Pastushak:
There are no loops, just 10 buttons drawn... No loops, no arrays, no structures... It's all procedural...
Yes? But somewhere you callObjectGetInteger() to find out if the button is pressed?
 
Dmitry Fedoseev:
How is that by name? What about it? It's not a click, it's an event. And the state is defined viaObjectGetInteger().

Mouse click event on graphical object

CHARTEVENT_OBJECT_CLICK

X coordinate

Y coordinate

Name of the graphical object where the event occurred

Reason: