Events on InputDialog?

Kevin

Well-Known Member
Licensed User
Longtime User
I use an InputDialog to have the user enter some text (an IP address to be exact).

Because of the problems mentioned in some threads around here related to numeric input with multiple decimals not really working correctly (and even the IME library not working correctly on some phones in landscape) I use a custom on-the-fly filter to remove illegal characters using an InputText's "_TextChanged" event (for a different section in my app).

What I was wondering is if there is anyway to raise a TextChanged event when using an InputDialog? The other section uses a panel and layout to show the InputText but I am trying to simplify and streamline things for this particular section and go with a simple InputDialog.

B4X:
Dim strIP As InputDialog
strIP.Hint = "Ex:  192.168.1.1"
If strIP.Show ("Enter IP","Advanced Scan","OK","Cancel","",Null) = DialogResponse.cancel Then Return
.... Do other stuff

I tried the following but it did nothing (even dimming strIP as a global). So I assume it can't be done with an InputDialog or I am just doing it wrong:

B4X:
Sub strIP_TextChanged (Old As String, New As String)
... Do stuff
End Sub


Any ideas on a solution? As it is now, I use a sub that Erel posted that uses a combination of code and RegEx to confirm that it is a valid IP address but of course this is after the text has been entered so it is a bit silly that they can type ANYTHING in the box. :eek:
 
Top