B4J 8.1, ABMaterial 4.51
Background - I have a modal screen with with a few controls and an ABMContainer which contains an ABMTable.
The table is populated such that each row has a text field and an ABMCheckbox.
So far so good, the table gets populated with relevant rows from a mySQL query and the checkbox state gets set and displays correctly.
When I come to save any potential changes to the table (checkbox.state has changed) I get a reference to the container and from there I get the ABMTable component. I loop through each entry on the table, get the text part which works fine and then get the checkbox component by name.
Hovering my cursor over the checkbox object I can see that (in my test case) it's set to true however when I try to set a boolean variable to the state it fails with a null pointer exception.
The code looks like this...
Here's the contents of the checkbox before I read it from the table. As you can see the state is showing as false.
A single F8 press later and the state changes to True (as expected I purposely made sure the checkbox is ticked) so I assume I have correctly referenced the relevant checkbox on the table (no errors so far).
As soon as I execute the next line ( mTicked=cbCheck.State) I get a NullPointerException as shown.
Any ideas on what I am doing wrong here? As always, thanks for reading.
Background - I have a modal screen with with a few controls and an ABMContainer which contains an ABMTable.
The table is populated such that each row has a text field and an ABMCheckbox.
So far so good, the table gets populated with relevant rows from a mySQL query and the checkbox state gets set and displays correctly.
When I come to save any potential changes to the table (checkbox.state has changed) I get a reference to the container and from there I get the ABMTable component. I loop through each entry on the table, get the text part which works fine and then get the checkbox component by name.
Hovering my cursor over the checkbox object I can see that (in my test case) it's set to true however when I try to set a boolean variable to the state it fails with a null pointer exception.
The code looks like this...
B4X:
Dim mName As String
Dim mTicked As Boolean
Dim mNameID As Int
Dim Matched As Int
Dim cbCheck As ABMCheckbox
'Now were going to scroll through each row in the table, find out what sort of membership it's referencing and whether it's ticked or not
tblMembershipList.PrepareTableForRetrieval 'ABM Needed
For x=0 To numTypes-1
mName = tblMembershipList.GetString (x,0) '<<<<< This works fine'
cbCheck=tblMembershipList.GetComponent(x,"cbSelect") '<<< This *appears to work fine (see pictures below)
mTicked=cbCheck.State '<<<<This fails
...
...
Here's the contents of the checkbox before I read it from the table. As you can see the state is showing as false.
A single F8 press later and the state changes to True (as expected I purposely made sure the checkbox is ticked) so I assume I have correctly referenced the relevant checkbox on the table (no errors so far).
As soon as I execute the next line ( mTicked=cbCheck.State) I get a NullPointerException as shown.
Any ideas on what I am doing wrong here? As always, thanks for reading.