I have an activity, a master-detail type of layout.
The user wants a popup dialog as the activity starts where they type in the requested order number, and thereafter the list shows only lines for that order.
So far so good.
But now they are using a scanner, and we have set it up so that the scanned string terminates with a # to indicate 'carriage return' , how do I make the input box close as soon as a # is typed in.
This works fine with normal text boxes, when the string ends # we set focus to the next field. So the question is, is there a text_Change type of event inside the input box we can use, and then how do we make the dialog close itself ?
How are you implementing this dialogue?
If it's a lib, try to check if there's a close alike parameter for it.
If it's a panel, use the visible property
The best solution would be to "automatize" the dialogue behaviour by creating it yourself...
It is a custom dialog, so I can make editTexts and things like that, I can say txtValue_Changed and if it ends with a # then all I need to do is say 'close me' but I don't know how.
I create a custom dialog, add a panel (pnl) containing my editText, if the editText.endsWith("#") I want to end the dialog as if the user had pressed OK.
B4X:
'This is in my myInputBox class
sub show_dialog
Dim cd As CustomDialog
'pnl has my editText
cd.AddView(pnl, 0, 0%y, calcWidth,80%y)
cd.Show(m_Caption, "OK", "Cancel", "" , Null)
end sub
sub editText_Change()
if editText.endsWith("#") then
'CLOSE ME somehow:-)
endif
end sub
I'm afraid that you cannot close the CustomDialog by code.
The solution is what you already suggest, with this you have full control and can do whatever you want.
Thanks Klaus and Cableguy.
As this selection takes place before I populate my lists (it is the filter), I actually made an activity with my selection field, call this when my main activity starts, and then when my filter is entered with the scanner I save the result and finish the select activity, the main activity resumes .....