iOS Question Preferences Dialog Preset an initial value

SFE

Member
Licensed User
I have started using the Preferences dialog which is really nice but I need to preset some initial values to something that was entered previously.

So how would I have a value entered in the field when the dialog opens? For example a number field might contain the value "100" when the dialog opens? I have used PrefItems to change the title of the fields but I am unsure how to enter a value in the field.

Thanks
 

SFE

Member
Licensed User
Thanks for your reply Erel. Also thank you for the B4XPreferencesDialog it allows you the flexibility to do whatever you are trying to achieve.

Since the forum is used as a learning tool I will summarize what Erel just pointed out.

The results from the dialog will be stored in a map using the key to store the value in. Once you initialize the map you can then preset a value that will be displayed when the dialog is displayed. Obviously the user can then change that data and that new value will be stored in the map. Your map (Data in this case) will be referenced in the ShowDialog. You can find your key name in Form Builder or in the JSON file.

B4X:
Dim Data As Map=CreateMap()
Data.Put("MyKey","123456")
Wait For (MyDialog.ShowDialog(Data,"OK","CANCEL")) COMPLETE (Result As Int)
 
Upvote 0
Top