A task with buttons ! - page 4

 
Dmitry Fedoseev:
Yes? But somewhere you callObjectGetInteger() to find out if the button is clicked?
Of course, if the button named "Hare" is clicked, then the hare should be drawn, and if the button named "Wolf" is clicked, the hare should be removed and the wolf should be drawn, except that if we don't unclick the button named "Hare", the hare will be drawn and removed...
 
Vladimir Pastushak:
Of course, if the button with the name "Hare" is pressed, then draw the hare, and if the button with the name "Wolf" is pressed, then the hare must be removed and the wolf must be drawn, except that if we do not release the button with the name "Hare", we will have to draw and remove the hare...
Who will draw it? You are not using ChartEvent().
 
Dmitry Fedoseev:
Who will draw it? You are not using ChartEvent().

OBJ_BUTTON will draw buttons...


OBJ_BUTTON

The "Button" object

 
Vladimir Pastushak:

OBJ_BUTTON will draw buttons...


OBJ_BUTTON

The "Button" object

And who will draw the bunny?
 
Dmitry Fedoseev:
Who's going to draw the bunny?
You've got to be kidding )))) It doesn't matter what happens if the button is pressed, what matters is how the other buttons are pressed ...
 
Vladimir Pastushak:
You've got to be kidding )))) It doesn't matter what happens if the button is pressed, what matters is how the other buttons are pressed...
Press throughObjectSetInteger()
 
Dmitry Fedoseev:
Squeeze throughObjectSetInteger()
It doesn't work ...
 
Vladimir Pastushak:
It won't work ...
Why won't it work?
 
Dmitry Fedoseev:
Press viaObjectSetInteger().

The code for the "hare" button comes first in the code, the code for the "wolf" button comes second.

If the "hare" button is pressed, we press the "wolf" button.

Further on by logic

If the "hare" button is pressed, we click the "wolf" button,

The code is executed from the beginning and the first thing executed is the "wolf" button, i.e. no matter how or how many times we click, if the "hare" button is pressed, the "wolf" button will always be pressed...

 
Vladimir Pastushak:

The code for the "hare" button comes first in the code, the code for the "wolf" button comes second.

If the "hare" button is pressed, then we press the "wolf" button.

Further by logic

If the "hare" button is pressed, we press the "wolf" button with the mouse,

The code is executed from the beginning and the first thing that happens is that the wolf button is pressed, which means that no matter how many times we click, if the hare button is pressed, the wolf button will always be pressed...

Where is all this done? In the ontic by tick function, or in the ontimer, or where? Where do you callObjectGetInteger() to know that the button is pressed?


Remember the previous state of buttons, then you will know which one is just pressed, and which one was pressed a long time ago.