' * This is the fern fractal script's user interface.
' * It's actually a dialog box definition that serves
' * as a "template" for later creating a variable of
' * of this type and them using the enable function
' * 'Dialog' to display it and return values. The
' * dialog definition is done in a manner very similar
' * to creating user defined variables with the type
' * function in basic or the struct function in C.
' * By utilizing several of the UI objects available
' * you can actually create quite a useful interface
' * for setting script values and options as well as
' * guiding the user through script setup with a
' * "wizard" like interface.
' *
Sub DoFernUI ()
Begin Dialog FernUI 60, 60, 240, 184, "Fern Fractal Generator"
Text 30, 30, 180, 180, "This sample TurboCAD script interacts with the user with a 'wizard' style interface and generates a fractal 'fern' with the specified number of points."
Text 30, 110, 140, 20, "How many Points would you like?"
TextBox 150, 109, 40, 14, .numPointText
OKbutton 80, 160, 40, 12
CancelButton 120, 160, 40, 12
End Dialog
Dim FrnDlg As FernUI
FrnDlg.numPointText = "1500"
button = Dialog(FrnDlg)
if button = 0 then
END
else
numPoints = FrnDlg.numPointText
if numPoints > 100000 then
MsgBox "Too many points! Please enter a value smaller than 100000."
DoFernUI
elseif numPoints < 1 then
MsgBox "Not enough points! Please enter a value larger than 0."