PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Check Box - just checked value
Check Box - just checked value
Iniciado por guest, 18,jul. 2017 04:25 - 5 respuestas
Publicado el 18,julio 2017 - 04:25
Hi Folks

I have a check box with 10 options. How do I tell which option user just modified?

If user checks one item, how can I programatically know which one was checked (modified). I want to be able to uncheck an other option that must be unchecked if this value is checked.

e.g.: if user checks [5] then I want to uncheck [4] [6] and [7] and if user checks [6] then I must uncheck [4] [5] and [7].

there no place to set them to false before the click. ( only init and click methods )
I could store all the values and match them, but seems unnecessary.

Thanks
Publicado el 18,julio 2017 - 04:44
Hello Mark

I have not used a multi-option checkbox, but the normal process is Windev is to use the index number to identify the elements.
CheckBox[1] should hold the value for the first option, Checkbox[2] the second and so-on

IF Checkbox[5] = true
Checkbox[4] = false
End

Regards
Al
Publicado el 18,julio 2017 - 05:34
Hi Al
I do that, but it doesn't help to identify which the user has just clicked on.
I could create 10 seperate checkboxes, but that again seems unnecessary., and goes against the "10xfaster" mantra.
Publicado el 18,julio 2017 - 07:16
Hello Mark

I just tried in a test and it worked ok

Code in the Initializing event will preset the data
CheckBox1[3] = True

Code in the "Whenever modifying" event of the check box will work as check box values are changed
IF CheckBox1[2] = True THEN
CheckBox1[4] = True
END


Regards
Al
Publicado el 18,julio 2017 - 08:16
Hi, if you really want to know *which checkbox* has been clicked then I'd compare values at entry of the Checkbox control and values at exit from the control.

Info("Entry: "+CheckBox1[1]+CheckBox1[2])
Publicado el 18,julio 2017 - 08:31
Hi Guenter

Those methods weren't showing before?!? ( only had init and modifying... )
Yes you are right. I can work with that now that I you have pointed out the Entry into...
Much appreciated.