[Gambas-user] Check Boxes (a bug?)

John Dovey dovey.john at gmail.com
Sat Jun 12 01:00:46 CEST 2021


One more question:
In the subroutine:
Public Sub AflagsGroup_Click()

    Dim myAflagsString As New String[]

    myAflags[Last.Tag] = Last.Value ' We set the value only on the flag
that changed and do not mess with the others.
    For Each myFlag As String In myAflags
        If myFlag Then myAflagsString.Add(myAflags.Key)
    Next
    LblAflags.Text = myAflagsString.Join(",")

End

My understanding is it runs through all the myAflags and adds all the
occurrences that are checked. If that's the case, then I don't understand
why it's not "removing" previously checked (and now unchecked) items?

Thanks for all your assistance!!
JD


On Fri, 11 Jun 2021 at 14:34, T Lee Davidson <t.lee.davidson at gmail.com>
wrote:

> On 6/11/21 1:20 PM, John Dovey wrote:
> > Thank you, That's helpful.
> > Now to make it work...
> >
> > Just one quick comment. I pasted your code with the
> "CheckBoxGroup_Click()" subroutine, but I named the group 'AflagsGroup". It
> > took me a few minutes to figure out why it wasn't working. There was no
> error that there was no such event :-)
>
> Ah, my bad. Please change the declaration for myAflagsString to:
> Dim myAflagsString As New String[]
>
> Scalars and strings are automatically instantiated while arrays and
> collections are not (unless a definition is provided with
> the declaration using the "=" operator).
>
>
> And also, in the Form_Open event, uncomment lines 123-126 and change them
> to:
>      ChkAflag_CM.Value = myAflags["CM"]
>      ChkAflag_MO.Value = myAflags["MO"]
>      ChkAflag_LO.Value = myAflags["LO"]
>      ChkAflag_ICM.Value = myAflags["ICM"]
>
> This will set the status of each checkbox appropriately.
>
>
> --
> Lee
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210611/7cb1e230/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: proj.tar.gz
Type: application/x-gzip
Size: 7693 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210611/7cb1e230/attachment.bin>


More information about the User mailing list