Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 1 Jahr
Letzter Beitrag:
vor 1 Jahr
Beteiligte Autoren:
Mark Crichton, Al, GuenterP

Check Box - just checked value

Startbeitrag von Mark Crichton am 18.07.2017 02: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.



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


von Al - am 18.07.2017 02:44
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.

von Mark Crichton - am 18.07.2017 03:34
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


von Al - am 18.07.2017 05: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])

von GuenterP - am 18.07.2017 06:16
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.

von Mark Crichton - am 18.07.2017 06:31
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.