More scripts: Dialog
Syntax Highlighing:
comments, key words, predefined symbols, class members & methods, functions & classes
# WIDGET1.SML
# Sample script for Building Dialogs in SML.
# Creates and opens a simple dialog window
# using Motif Widget classes.
# Define parent widget for dialog window.
class XmForm win1;
# Procedure for closing window
proc OnClose() {
DialogClose(win1);
DestroyWidget(win1);
}
# Set up dialog window
win1 = CreateFormDialog("Hello World");
win1.MarginHeight = 5;
win1.MarginWidth = 5;
# Create label text for window
class XmLabel winLabel;
winLabel = CreateLabel(win1,"Sample Dialog Window");
winLabel.TopWidget = win1;
winLabel.LeftWidget = win1;
winLabel.LeftOffset = 10;
winLabel.RightWidget = win1;
winLabel.RightOffset = 10;
# Create Close button attached to label on
# on top and to window margin on left and right
class XmPushButton closeButton;
closeButton = CreatePushButton(win1,"Close");
closeButton.TopWidget = winLabel;
closeButton.TopOffset = 5;
closeButton.leftWidget = win1;
closeButton.rightWidget = win1;
closeButton.bottomWidget = win1;
WidgetAddCallback(closeButton.ActivateCallback,OnClose);
# Open dialog window and keep script active
# until window is closed.
DialogOpen(win1);
DialogWaitForClose(win1);