Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
AllenJ  
#1 Posted : Friday, February 3, 2017 5:42:10 PM(UTC)
AllenJ

Rank: Member

Groups: Registered
Joined: 6/5/2015(UTC)
Posts: 11

Thanks: 2 times
I have code to save the data of an igrid control to a data file.
The igrid uses check boxes in some of the cells.
When I reload the form data, the check boxes always restore as checked, not unchecked.
How can I get it to set the correct state of check boxes as checked or unchecked?

The data format (CelList in code below):

<IGrid1>5|12|1|True||Continuous|Live|0.280|0.000|||||&lt;empty&gt;|2|False|False|Point|Live|0.000|43.800|||29||&lt;empty&gt;|3|True|False|Point|Live|0|43.800|||49||&lt;empty&gt;|4|True|False|Point|Live|3.6|&lt;empty&gt;|||22.67||&lt;empty&gt;|5|True|True|Point|Live|3.6|&lt;empty&gt;|||45.33||&lt;empty&gt;|</IGrid1>

What is saved:

[img=https://drive.google.com/file/d/0B6g56LjIUheNQmZrRVFsQmV1OVk/view?usp=sharing]Saved[/img]

What is restored:

[img=https://drive.google.com/file/d/0B6g56LjIUheNcVNEQUJpdkhlVVU/view?usp=sharing]Restored[/img]

The code to restore the data:

Code:

 Dim oGrid As TenTec.Windows.iGridLib.iGrid = CType(oChild, TenTec.Windows.iGridLib.iGrid)
                If oGrid.ReadOnly = False Then
                    Dim DL As String = "|", CelList() As String = Split(controlValue, DL), ci As Integer = 2
                    If CelList.Length > 3 Then
                        oGrid.Rows.Count = CInt(CelList(0))
                        oGrid.Cols.Count = CInt(CelList(1))
                        For r As Integer = 0 To oGrid.Rows.Count - 1
                            For c As Integer = 0 To oGrid.Cols.Count - 1
                                If CelList(ci) <> "<empty>" Then
                                    oGrid.Cells(r, c).Value = CelList(ci)
                                    'If CelList(ci) = "True" Then
                                    '    oGrid.Cells(r, c).Value = TenTec.Windows.iGridLib.iGBool.True
                                    'ElseIf CelList(ci) = "False" Then
                                    '    oGrid.Cells(r, c).Value = TenTec.Windows.iGridLib.iGBool.False
                                    'Else
                                    '    oGrid.Cells(r, c).Value = CelList(ci)
                                    'End If
                                End If
                                ci += 1
                            Next
                        Next
                    End If
                End If


Note I commented out code that didn't seem to work.
Igor/10Tec  
#2 Posted : Monday, February 6, 2017 9:26:58 AM(UTC)
Igor/10Tec

Rank: Administration

Groups: Administrators, Forum Moderator
Joined: 1/17/2011(UTC)
Posts: 829

Thanks: 11 times
Was thanked: 107 time(s) in 107 post(s)
We need a sample to reproduce the problem. Can you prepare and mail it to our support address?
AllenJ  
#3 Posted : Monday, February 6, 2017 2:59:46 PM(UTC)
AllenJ

Rank: Member

Groups: Registered
Joined: 6/5/2015(UTC)
Posts: 11

Thanks: 2 times
WindowsApplication1.zip (453kb) downloaded 23 time(s).

I emailed, but it claimed the attachment had a virus.

When the check box columns (Active & Brace) are set to Text Style, the values True and False appear correctly, but when set to Check style they all appear checked.
The Last.zzz file contains the data for the Igrid.

Edited by user Monday, February 6, 2017 3:14:21 PM(UTC)  | Reason: Added a check box to toggle between check and text styles.

Igor/10Tec  
#4 Posted : Monday, February 6, 2017 3:18:53 PM(UTC)
Igor/10Tec

Rank: Administration

Groups: Administrators, Forum Moderator
Joined: 1/17/2011(UTC)
Posts: 829

Thanks: 11 times
Was thanked: 107 time(s) in 107 post(s)
Thank you for the sample. It helped to understand what is wrong.

The 3-state specific iGBool type is used to specify values for some properties that may inherit values from their parents - for instance, iGCellStyle.ReadOnly. However, the iGBool values are not used to control the state of the cell check box. You need to use the traditional Boolean True/False for that.

The corresponding part of your code should look like this:

Code:
If CelList(ci) = "True" Then
    oGrid.Cells(r, c).Value = True
ElseIf CelList(ci) = "False" Then
    oGrid.Cells(r, c).Value = False
Else
    oGrid.Cells(r, c).Value = CelList(ci)
End If



P.S. Don't email archives with executable contents, i.e. the Bin & Obj folders in the case of VS solutions (they can be recreated during compilation). Most likely, they were considered a virus by the anti-spam system.

Edited by user Monday, February 6, 2017 3:19:39 PM(UTC)  | Reason: Not specified

thanks 1 user thanked Igor/10Tec for this useful post.
AllenJ on 2/6/2017(UTC)
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.