[Web][SithasoDaisy2]: Mashy Teaches TailwindCSS using b4x (with eBook)

Mashiane

Expert
Licensed User
Longtime User
 

Mashiane

Expert
Licensed User
Longtime User

Mashiane

Expert
Licensed User
Longtime User
Cascading Selects on the Property Bag

B4X:
Private Sub BuildPage
dettagliorigo.AddPropertySelect("pizza", "pizza", "", "", True, "left", mapPIZZA) 'how to get the change?
dettagliorigo.AddPropertySelect("size", "Size", "", "Size", True, "", CreateMap()) ' NO size ELEMENT INTO MAP (combo element)
End Sub

When the pizza changes, feed the size select with different items.

One can do this on the show method and with a change event.

On the change event, one uses the _ChangePropertyBag event. This returns a map of all the property bag properties.

The methods to update / read a property bag value starts with SetProperty??? or GetProperty???

SetPropertySelectMap - will update a select based on key value pairs
SetPropertySelectMap1 - will update a select based on key value pairs with an options to add --Nothing Selected-- blank option.
SetPropertyItemsListSort - will update a select based on a list that will be sorted. The list will be made a map with the values of the list as key value pairs
SetPropertyItemsOptions / SetPropertySelectOptions - will update a select based on delimited string. The delimited string should be like a|b|c|d|e
SetPropertyItemsList - will update a select based on a list. The list will be made a map with values of the list as key value pairs


Clearing a property bag select.

SetPropertySelectClear(?)

Adding an item to a property bag select

SetPropertySelectAddItem(?, ?, ?)

Set a property bag value

SetPropertyValue(?, ?)

Get a property bag value

a = GetPropertyValue(?)

Solution

B4X:
dim spizza as string = pb.GetPropertyValue("pizza")
select case spizza
case "a"
    dim sizem as map = createmap("s":"Small", "m":"Medium")
    pb.SetPropertySelectMap("size", sizem)
case "b"
...
case "c"
...
end Select
'change the size to be medium
pb.SetPropertyValue("size", "m")
 

Mashiane

Expert
Licensed User
Longtime User
Cookies are required to use this site. You must accept them to continue using the site. Learn more…