### Create Modal Form by Code

To create and show a Form dynamically, create a Form, add the Controls to it and show.
Example "Day You Know" Message
DidYouKnow - Label
'Show Tip of the Day message. Dialog is closed by system close top right of the form.
'Parameter TipOfTheDay as String
'Example:
'showDidYouKnow("Did You Know Example" & CRLF & CRLF & "Enjoy" & CRLF & CRLF & "Rob")
`Public Sub showDidYouKnow(strTOTD As String)
Dim frm As Form
' Init with W and H
frm.Initialize("frm", 400, 200)
frm.SetFormStyle("UTILITY")
frm.Title = "Tip Of The Day"
' The DyN header
Dim lblDyNT As Label
lblDyNT.Initialize("lbldynT")
lblDyNT.Style = "-fx-font-size: 24px;-fx-font-family: ""Segoe UI Semibold""; -fx-text-fill: grey; -fx-opacity: 1;-fx-font-weight: bold;"
lblDyNT.Text = "Did You Know ..."
frm.RootPane.AddNode(lblDyNT, 10, 10, -1,-1)
'
' The DyN message
Dim lblDyNM As Label
lblDyNM.Initialize("lbldynM")
lblDyNM.Style = "-fx-font-size: 20px;-fx-font-family: ""Segoe UI Light""; -fx-text-fill: blue; -fx-opacity: 1;"
lblDyNM.WrapText = True
lblDyNM.Text = strTOTD
frm.RootPane.AddNode(lblDyNM, 10, 70, 300, -1)
'
frm.show
End Sub`
DidYouKnow - TextArea
'As previous, but using a TextArea instead of a Label
'Example:
'showDidYouKnow2("Did You Know Example" & CRLF & CRLF & "Enjoy" & CRLF & CRLF & "Rob")
`Public Sub showDidYouKnow2(strTOTD As String)
Dim frm As Form
' Init with W and H
frm.Initialize("frm", 400, 300)
frm.SetFormStyle("UTILITY")
frm.Title = "Tip Of The Day"
' The DyN header
Dim lbl As Label
lbl.Initialize("lbl")
lbl.Style = "-fx-font-size: 24px;-fx-font-family: ""Segoe UI Semibold""; -fx-text-fill: grey; -fx-opacity: 1;-fx-font-weight: bold;"
lbl.Text = "Did You Know ..."
frm.RootPane.AddNode(lbl, 10, 10, -1,-1)
'
' The DyN message
Dim msg As TextArea
msg.Initialize("msg")
msg.Style = "-fx-font-size: 20px;-fx-font-family: ""Segoe UI Light""; -fx-text-fill: blue; -fx-opacity: 1;"
msg.WrapText = True
msg.Text = strTOTD
'L T W H
frm.RootPane.AddNode(msg, 10, 70, 370, 200)
'
frm.show
End Sub`

Changed: , Category: Forms, File: T6C195M1414.htm, ID: 1414