Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Dim otherform As Form
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.Show
asJO(Me).RunMethod("doWindow",Array(asJO(MainForm).GetFieldJO("stage")))
End Sub
Sub myevent_newwindow
otherform.Initialize("",200,200)
otherform.show
End Sub
Sub asJO(o As JavaObject) As JavaObject
Return o
End Sub
#if java
import javafx.scene.input.KeyCode;
import javafx.stage.Stage;
import javafx.scene.input.KeyEvent;
import javafx.event.EventHandler;
import anywheresoftware.b4a.keywords.Common;
public static void doWindow(Stage stage){
stage.addEventHandler(KeyEvent.KEY_PRESSED,new EventHandler<KeyEvent>(){
@Override public void handle(KeyEvent keyEvent){
if (keyEvent.isAltDown() && (keyEvent.getCode() !=KeyCode.ALT)){
if (keyEvent.getCode() == KeyCode.W){ // ALT W for new window
System.out.println("Alt + " + keyEvent.getCode());
keyEvent.consume();
ba.raiseEventFromUI(this, "myevent_newwindow", null);
}
}
}
}
);
}
#end if