...
Dim m As Map
Dim s As String
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("Layout1")
MainForm.Show
' make some other screens
anotherForm.Initialize("",100,100)
yetAnother.Initialize("",100,100)
' init the map
m.Initialize
'get object name of mainform
Log("The one I want <" & MainForm & ">")
s = MainForm ' naughty but nice
End Sub
Sub Button1_Click
(Me).As(JavaObject).RunMethod("doIt",Array(Me,m))
' read map for the form object and then change title.
m.Get(s).As(Form).Title = "Hello"
End Sub
#if java
import java.util.*;
import java.lang.reflect.*;
public static Map<String,Object> doIt(Class c,Map m) throws Exception{
var f = c.getDeclaredFields();
for (var fld : f){
var wanted = fld.toString();
if (wanted.contains(".Form")){
m.put(fld.get(c).toString(),fld.get(c));
}
}
return m;
}
#End If