Android Question Table class: "Invalid number of columns"

mjcoon

Well-Known Member
Licensed User
I kept getting such messages, logged or pop-up.

Found code:
Sub SetHeaderTypeFaces():
    If HeaderTypeFaces.Length <> mNumberOfColumns Then
        ToastMessageShow("Invalid number of columns", False)
        Log("SetHeaderTypeFaces: Invalid number of columns")
        Return
    End If
    
    If HeaderTypeFaces.Length = 1 Then
        cHeaderTypeFace = HeaderTypeFaces(0)
        HeaderMultiTypeFace = False
    Else
    ...
Surely better to check for single typeface first, thus:
SetHeaderTypeFaces():
    If HeaderTypeFaces.Length = 1 Then
        cHeaderTypeFace = HeaderTypeFaces(0)
        HeaderMultiTypeFace = False
    Else
        If HeaderTypeFaces.Length <> mNumberOfColumns Then
            ToastMessageShow("Invalid number of columns", False)
            Log("SetHeaderTypeFaces: Invalid number of columns")
            Return
        End If
        cHeaderTypeFaces = HeaderTypeFaces
        HeaderMultiTypeFace = True
    End If

There does not seem to be the same problem with cell typefaces because there are both singular and plural subs.

I'm not actually using distinct typefaces, so I would not consider my usage to be a comprehensive test.

Mike.
 

Lucas Siqueira

Active Member
Licensed User
Longtime User
I kept getting such messages, logged or pop-up.

Found code:
Sub SetHeaderTypeFaces():
    If HeaderTypeFaces.Length <> mNumberOfColumns Then
        ToastMessageShow("Invalid number of columns", False)
        Log("SetHeaderTypeFaces: Invalid number of columns")
        Return
    End If
   
    If HeaderTypeFaces.Length = 1 Then
        cHeaderTypeFace = HeaderTypeFaces(0)
        HeaderMultiTypeFace = False
    Else
    ...
Surely better to check for single typeface first, thus:
SetHeaderTypeFaces():
    If HeaderTypeFaces.Length = 1 Then
        cHeaderTypeFace = HeaderTypeFaces(0)
        HeaderMultiTypeFace = False
    Else
        If HeaderTypeFaces.Length <> mNumberOfColumns Then
            ToastMessageShow("Invalid number of columns", False)
            Log("SetHeaderTypeFaces: Invalid number of columns")
            Return
        End If
        cHeaderTypeFaces = HeaderTypeFaces
        HeaderMultiTypeFace = True
    End If

There does not seem to be the same problem with cell typefaces because there are both singular and plural subs.

I'm not actually using distinct typefaces, so I would not consider my usage to be a comprehensive test.

Mike.

did not understand what the problem?
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Thank you for reporting it.
Amended the code and added the single HeaderTypeFace property, like for the colors.
The first post in the Flexible Table thread has been updated.
 
Last edited:
Upvote 0
Top