You may be thinking that I create these tutorials for myself. You may be right!!!
My RAM memory is very limited. Erel has offered (us) a place to securely store them (he is so kind) for future reference... Anyways...
As I have discovered, everything reacts by the on_click event - meaning - you must code an on_click event Sub in order to act upon your desired action. These are raised in the Page_ParseEvent(Params As Map) which are common to each page, and reacts to (almost) every mouse click (or touch). pretty neat way of handling this although I expect this is common... (what do I know? - just a hack).
Here, I need to populate a combo list (to reduce items to logical selections) BASED on a previous selection.
In this case, I must select a "vehicle type" - selection 1 (returns 1,2,3 as the SetActiveItemId ).
Based on the combo.ActiveItemId of selection 1, I can call a sub to create a list of associated items for the associated combo (which depends on a selection of the first)...
This is called when a "Vehicle Type" is selected (from the combo selection):
This "over-rides" what ever I set when initializing the page with a current list (using - clear) based on vehicle type selection. Yes I know, clear as mud.... You must experiment to figure this out for the most part...
Example image: Shows only Trucks in Inspection Type list. ("SELECT * FROM insptype_mast WHERE Trk_Trl = "&itm)... from above...
One more note: Maps are our best friend.
It took me a year to discover (4 years ago) how to use Maps.
Recently, I discovered that a List (object) can contain Maps (objects)!
It was always there and being used yet I couldn't wrap my head around it.
Thanks
My RAM memory is very limited. Erel has offered (us) a place to securely store them (he is so kind) for future reference... Anyways...
As I have discovered, everything reacts by the on_click event - meaning - you must code an on_click event Sub in order to act upon your desired action. These are raised in the Page_ParseEvent(Params As Map) which are common to each page, and reacts to (almost) every mouse click (or touch). pretty neat way of handling this although I expect this is common... (what do I know? - just a hack).
Here, I need to populate a combo list (to reduce items to logical selections) BASED on a previous selection.
In this case, I must select a "vehicle type" - selection 1 (returns 1,2,3 as the SetActiveItemId ).
Based on the combo.ActiveItemId of selection 1, I can call a sub to create a list of associated items for the associated combo (which depends on a selection of the first)...
This is called when a "Vehicle Type" is selected (from the combo selection):
B4X:
Sub utcombo1_clicked(target As String)
Dim inp As ABMModalSheet = page.ModalSheet("vehicleinp")
Dim utc As ABMCombo = inp.Content.Component("utcombo1")
Dim itc As ABMCombo = inp.Content.Component("itcombo1")
itc.Clear
itc.SetActiveItemId("")
Dim itm As String = utc.GetActiveItemId
Dim sql As SQL = DBM.GetSQL
Dim users As List = DBM.SQLSelect(sql, "SELECT * FROM insptype_mast WHERE Trk_Trl = "&itm&" ORDER by Name" )' & SelectedRowId)
If users.Size > 0 Then
For i = 0 To users.Size -1
Dim user As Map = users.Get(i)
Dim id As String = user.Get("pk")
Dim val As String = user.Get("name")
itc.AddItem( id, val, BuildSimpleItem("S"&id, "mdi-action-star-rate", "{NBSP} - {NBSP} {NBSP}"&val))
Next
End If
DBM.CloseSQL(sql)
Log(" Retreived vehicle items...")
itc.Refresh
End Sub
This "over-rides" what ever I set when initializing the page with a current list (using - clear) based on vehicle type selection. Yes I know, clear as mud.... You must experiment to figure this out for the most part...
Example image: Shows only Trucks in Inspection Type list. ("SELECT * FROM insptype_mast WHERE Trk_Trl = "&itm)... from above...
One more note: Maps are our best friend.
It took me a year to discover (4 years ago) how to use Maps.
Recently, I discovered that a List (object) can contain Maps (objects)!
It was always there and being used yet I couldn't wrap my head around it.
Thanks