Android Question B4XInputTemplate text cant be changed by user when called in sub

Hello everyone!

I use B4X and call this sub (located in B4XMainPage) from various modules:

dialog Sub:
Public Sub DBRF(ScanHere As B4XView, CallRoot As B4XView)
    Public ThirdDialog As B4XDialog
    ThirdDialog.Initialize(CallRoot)
    ThirdDialog.BorderCornersRadius = 44
    ThirdDialog.Title = "Debug Options"
    

    Dim input3 As B4XInputTemplate
    input3.Initialize
    input3.lblTitle.Text = "Πληκτρολογίστε Barcode εδώ."
    
            
    Wait For (ThirdDialog.ShowTemplate(input3, "RF", "Barcode", "")) complete (result As Int)
    Log(input3.Text)

    If result = xui.DialogResponse_Positive Then
        MsgboxAsync(ScanHere.Text, "Κείμενο στο Πεδίο Scan:")
        ScanHere.Text = ""
        ScanHere.RequestFocus()
    Else If result = xui.DialogResponse_Negative Then
        ScanHere.Text = input3.Text
        Log($"Scan Here text: ${input3.Text}"$)
    End If
End Sub

I pass an EditText (ScanHere)as B4XView and the Root (CallRoot) of each module I use it from.
In the Else If statement, it should pass the input.Text to the EditText View, but it doesnt do that.
Is it because it is called from another module?
It seems like the input.Text isn't affected by the user's typed input (when i Log the input it prints an empty string).
Any ideas?
 
Solution
I figured it out!
Since the option "Barcode" was in the position of No ( Wait For (ThirdDialog.ShowTemplate(input3, "RF", "Barcode", "")) complete (result As Int)), the program executed the code without reading the input.

When i changed the order and placed the "Barcode" option to the position of Yes (xui.DialogResponse_Positive), it accepted the user's input and placed it in the Field.
Thanks for the reply!

Post the logs.
As I said it logs nothing. Log of line 21:
Scan Here text:

You are probably doing something wrong when passing the view to DBRF.
This is how i pass the view:

B4X:
Private Sub Title_LongClick
    
    MainPage.DBRF(ScanHereMove, Root)
End Sub

ScanHereMove --> EditText View as B4XView
Root --> the module's Root

The other function of the sub (line 16-19) work perfectly. It sets the ScanHere.Text to "" and sets the focus there as well.
 
Upvote 0
I figured it out!
Since the option "Barcode" was in the position of No ( Wait For (ThirdDialog.ShowTemplate(input3, "RF", "Barcode", "")) complete (result As Int)), the program executed the code without reading the input.

When i changed the order and placed the "Barcode" option to the position of Yes (xui.DialogResponse_Positive), it accepted the user's input and placed it in the Field.
 
Upvote 0
Solution
Top