B4J Question B4XPages and (b4xdialogs) ShowTemplate issue.

jndaniels1

Member
Licensed User
Longtime User
Hi to all.

Im working with B4XPages in B4J using b4xdialogs - Specifically the signaturetemplate. (B4J and B4A is my targets)

it will crash at the line ShowTemplate statement.
B4X:
Dim rs As ResumableSub  = Dialog.ShowTemplate(SignaturTemplate, Chr(0xF00C), "", Chr(0xF00D))

logs return this in debug

Error occurred on line: 130 (B4XDialog)
java.lang.RuntimeException: Object should first be initialized (B4XView).

(the code is only 58 lines long btw)

this in release mode

b4xdialog$ResumableSub_ShowTemplate.resume (java line: 1129)

I copied the code from the example "XUI Views" from the forum.
I can get it to work in non B4XPages - I really prefer to not worry about Activities management in B4A

Ideas?

Thanks everybody !
JD
 

LucaMs

Expert
Licensed User
Longtime User
B4X:
Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI

    Private Dialog As B4XDialog
    Private SignaturTemplate As B4XSignatureTemplate
End Sub

B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("mainpage")

    SignaturTemplate.Initialize
    Dialog.Initialize(Root)
End Sub

B4X:
Private Sub Button1_Click
    Dim rs As ResumableSub  = Dialog.ShowTemplate(SignaturTemplate, Chr(0xF00C), "", Chr(0xF00D))
    Wait For (rs) Complete(Result As Int)
    Log("Result " & Result)
End Sub
 
Upvote 0

jndaniels1

Member
Licensed User
Longtime User
Thanks LucaMs !
Solved! So Close too !

I had the initializes under the initialize sub -- Although, I can swear I tried it in created sub. I feel dumb now.

Again, Thanks !!!!!!

JD
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
From a logical point of view, I agree with you, the initializations should be written in the Initialize.

However, you have to pass a B4XView (Root) to the dialog, so it must be in the Create (after all, this is also executed only once, like the Initialize).
 
Upvote 0
Top