Requiring Input

MDEnt

Member
Licensed User
Longtime User
Wondering if anyone has any sample code that would show how to require a user to enter text - meaning they cannot proceed if they do not enter something.

I am using the Dialogues library to capture text - below is a snippet where text is to be entered. Problem is, if they just hit the OK button and don't actually enter anything - it proceeds anyhow.

B4X:
Dim Id As InputDialog
Id.InputType = Id.INPUT_TYPE_TEXT
Id.Input = ""
Id.Hint = "a color"
ret = Id.Show("Some filler text", "Please enter your favorite color.", "OK", "","", LoadBitmap(File.DirAssets, "icon.jpg"))

Thanks.
 

admac231

Active Member
Licensed User
Longtime User
If you put the Id.Show method inside a Do While loop you can check to see if something has been entered:

B4X:
Do While Id.Input = ""
ret = Id.Show("Some filler text", "Please enter your favorite color.", "OK", "","", LoadBitmap(File.DirAssets, "icon.jpg"))
Loop
 
Upvote 0
Top