Bug? CallSub doesn't accept JavaObject parameters?

jmon

Well-Known Member
Licensed User
Longtime User
Hi,

As the title says, I think all the CallSub... methods don't accept JavaObject Parameters. Is is normal?
This code:
B4X:
Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private Pane1 As Pane
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.SetFormStyle("UNIFIED")
    MainForm.RootPane.LoadLayout("Main") 'Load the layout file.
    MainForm.Show
  
    Log($"Line 1 worked: ${getPaneInfo(Pane1)}"$)
    Log($"Line 2 works: ${writeStuff($"YES IT WORKS"$)}"$)
    Log($"Line 3 doesn't work: ${CallSub2(Me, "writeStuff", $"NO IT DOESN'T WORK"$)}"$)
    Log($"Line 4 doesn't work: ${CallSub2(Me, "getPaneInfo", Pane1)}"$)
  
End Sub

Sub writeStuff(s As JavaObject) As String
    Log(s)
    Return s
End Sub

Sub getPaneInfo(p As JavaObject) As Double
    Return p.RunMethod("getPrefWidth", Null)
End Sub

returns this error:

Thanks
Jmon.
 

Attachments

  • BugCallSubDelayed.zip
    1.8 KB · Views: 343
Cookies are required to use this site. You must accept them to continue using the site. Learn more…