Page 1 of 1

[Solved] Macro - One button changes the other button

PostPosted: Thu Dec 28, 2017 11:51 pm
by josecarvalho
Hello everybody!
I'm, trying to make a quiz game in calc, and would thank all the help I can get.
To put it simply:

I have a dialog box with two action buttons (A and B)

the label's value of A and B, is retrieved each from cells C and D respectivelly

when I press one button, and if the answer is true, the values of cells C and D are regenerated randomly (using calculateAll)

I would like that, as soon as the value of cells C and D are regenerated, the labels of buttons A and B would also change imediatelly to the new C and D values


I managed to make that happen with a macro in button A, but button B does not change its label... :knock: Wow can I solve it ?

Re: macro - One button changes the other button

PostPosted: Fri Dec 29, 2017 1:07 pm
by Villeroy

Re: macro - One button changes the other button

PostPosted: Fri Dec 29, 2017 5:19 pm
by josecarvalho
Many thanks. I'll see if that helps !

Re: Macro - One button changes the other button

PostPosted: Tue Jan 09, 2018 11:35 pm
by josecarvalho
I'm back ... the file Villeroy directed me to was helpful to some extent. I could make one button change the other, but I could not make it work with more buttons, as I wished, because the code is not clear for me, as a beginner, in the way it refers to each button. :?

In the attached file there's an example of what I want to do. It's a little quiz engine. In this example, I can make it work almost the way I wanted to.

If you open the file, you see the question in green, and then you have the cells with the 5 possible answers, each with the respective button at its right.

If you choose a wrong answer, the button label changes to "X"; If you choose the right answer, it generates another question. - That works !

The problem is, if you click on any wrong answer, the "X" will stay in the button, even after you click on the right answer.

What I wanted to happen is : after you choose the right answer, the "X" on the "wrong" buttons would disappear. That should be simple, right ? - not for me ! :crazy:

Will thank any help ! :D

Test 1.ods
here's the file
(15.49 KiB) Downloaded 36 times

Re: Macro - One button changes the other button

PostPosted: Mon Jan 22, 2018 1:49 pm
by josecarvalho
Here I am again.
Thanks, Villeroy, for the link you sent, it was helpful.
The code might not be pleasant to watch, but after long hours of hard work and study, somehow I made it work the way I wanted.
See you next time !