If and then statement

HDSInformatics

Member
Licensed User
Longtime User
Hi,

First of all I have these globals
B4X:
Dim scvList As ScrollView
Dim Table As Panel
Dim scvFiche as panel
Dim SelectedItems As Map
Dim NumberOfColumns,RowHeight, RowHeight_1 As Int
Type RowCol (Row As Int, Col As Int)
Dim LineColor  As Int
Dim ColumnWidth(3) As Int
Dim ColumnWidth_1(3) As Int
Dim ColLineWidth, RowLineWidth As Int
Dim SelectedRow As Int
Dim SelectedRowColor As Int      : SelectedRowColor = Colors.blue
Dim pnlBtnWerknemers As Panel

When I click on a button called btnContinue I want to make the Table (panel) unvisible and go to a next page with the scvFiche as visible.
This is not so hard of course.
Now my question is I need to make an If and Then statement that says.

If (table is selected) then
table.visible = false
scvfiche.visible = true
else
msgbox("You need to select one or more employees to continue","Error")
end if

something like that. The table is selected is wrong of course but what should I use make this happen?
I thought about using colors because if a row is selected it turns lightgray if not it's white. But this doesn't work of course..

Any ideas?
I can post my project if requested

Michael
 

klaus

Expert
Licensed User
Longtime User
You have the variable SelectedRow, what value does it have if no row is selected ?
You have a map SelectedItems does this map contain the selected rows ?

I'm sure you could use one of these for If (table is selected) Then.

Best regards.
 
Upvote 0

HDSInformatics

Member
Licensed User
Longtime User
You know what, i'll post my code. Would you mind having a look yourself?
First of all, i'm dutch so some thing will be in dutch. But you'll understand don't worry.
Also, if I add fields in my sqlite database, it doesn't edit it to my tablet... If you understand what I mean..

tip:
'Werknemers' translated = 'Employees'

Few bugs and errors, hope you can fix it!

Michael

You have the variable SelectedRow, what value does it have if no row is selected ?
You have a map SelectedItems does this map contain the selected rows ?

I'm sure you could use one of these for If (table is selected) Then.

Best regards.
 

Attachments

  • ListviewWerknemers.zip
    284.4 KB · Views: 148
Upvote 0

klaus

Expert
Licensed User
Longtime User
As you don't use SelectedRow you must use SelectedItems.
With If SelectedItems.Size > 0 Then you can check if there is a selected item.
Look at the end on the Click_Cell routine.
To show or hide the table you shouldn't use Table.Visible because Table is the internal panel of the scrollview but use scvList.Visible.
I replaced Table by scvList.Panel making it a bit less confusing.

Attached a modified version.

Best regards.
 

Attachments

  • ListviewWerknemers_1.zip
    8.5 KB · Views: 138
Upvote 0
Top