Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Dim b,b1 As Button
Dim myNewForm As Form
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
' initialize the new form
myNewForm.Initialize("mynewform",200,200)
myNewForm.Title = "My New Form"
myNewForm.SetFormStyle("UNDECORATED") ' UTILITY will give close button so u can trap that
' add outline to mynewform so u can see it
CSSUtils.SetBorder(myNewForm.RootPane,3.0,fx.Colors.red,2.0)
' put button on mainform
b.Initialize("newform")
b.Text = "show other form"
' put button on other form
b1.Initialize("newform")
b1.Text = "show other form"
MainForm.RootPane.AddNode(b,10,10,100,20)
myNewForm.RootPane.AddNode(b1,10,10,100,20)
' show mainform
MainForm.Show
End Sub
Sub newform_Click
If MainForm.Showing Then
' show new form
myNewForm.Show
' close mainform
MainForm.Close
Else
' show mainform
MainForm.Show
' close new form
myNewForm.close
End If
End Sub
' how to trap the close event
Sub myNewForm_CloseRequest (EventData As Event)
Log("Naughty you cannot use the X to close")
EventData.Consume
End Sub