Android Question Truncated input message - B4XDialog from XUI Views

pkb4a

New Member
Hi all,

Good morning/afternoon/evening, and I hope that you are all doing well.

Is it possible to use a very long message string with a B4XInputTemplate dialog box? Here's a code snippet to illustrate my question. The dialog is visible and functions properly, but unfortunately the message is truncated to "Choose a number. This message is too".

B4X:
    Dim CurMessage As String
    Dim input As B4XInputTemplate
    input.Initialize
    input.lblTitle.Text = "Choose a number.  This message is too long and will be truncated.  I would like to put more information in this box above the input prompt."
    input.ConfigureForNumbers(False, False)
    Wait For (dialog.ShowTemplate(input, "Done", "","")) Complete (Result As Int)
    If Result = xui.DialogResponse_Positive Then
        CurMessage = "The number entered was: " & input.Text
        Wait For (xui.MsgboxAsync(CurMessage, "Testing")) Msgbox_Result (Result As Int)
    End If

If it's not possible to do this, then any alternative suggestions would be very much appreciated. My goal is simply to display a block of text just above the field where the user enters their input.

Thank you very much, in advance!

-PK
 

Mahares

Expert
Licensed User
Longtime User
Is it possible to use a very long message string
I noticed it is your first post in the forum since you are a newcomer. If you are still having trouble doing what Erel suggested for you to do, do not hesitate to ask for further help. We can help. If you already solved it, then good for you.
 
Upvote 0

pkb4a

New Member
Thanks. I think he's kindly pointed me in the right direction, but I'll post again if I am unable to resolve. Thanks again!
 
Upvote 0

pkb4a

New Member
I spent quite a bit of time experimenting and reading docs but ultimately was unsuccessful in modifying the template or creating a custom dialogue to do this. This was simply due to my own my lack of B4A experience, combined with lack of specifics in the previous guidance.

Fortunately, I solved it in another way and thought I'd leave a final post here for anyone else (b4a-inexperienced) who might need to do the same thing in the future. I suspect it's an outdated approach, or at least not current best practice, but it worked perfectly for my particular use case. Some things that are obvious to the 'cool kids' need a little detail for the newbies, so here is a snippet of what I finally did to get a longer message to display.

B4X:
    Dim CurMessage As String
    Dim BodyMessage As String
    Dim TitleMessage As String
    Dim input2 As InputDialog
    
    BodyMessage = "This message is long but will not be truncated.  I needed to put more information in the box above the input prompt."
    TitleMessage = "Choose a number"
    input2.InputType = input2.INPUT_TYPE_NUMBERS
    Dim sf As Object = input2.ShowAsync(BodyMessage, TitleMessage, "OK", "Cancel","",Null,False)
    Wait For (sf) Dialog_Result(iResult As Int)
    If iResult = DialogResponse.Positive Then
        CurMessage = "The number entered was: " & input2.Input
        Wait For (xui.MsgboxAsync(CurMessage, "Result")) Msgbox_Result (Result As Int)
    End If

Thanks again to those who responded, and I hope you all have a great week. Happy coding!
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Fortunately, I solved it in another way and thought I'd leave a final post here for anyone else
I am glad you solved your issue and that is what counts. However, the correct approach would have been B4XDialog with a custom dialog. See an example addressing it in this below thread:
Maybe the next time if you want to venture into a newer and more modern and flexible approach.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…