User Tools

Site Tools


dialog

Sometimes a button or Action within the User Interface (UI) will cause a message, or some other form of modal dialog, to be displayed to the user. For example, the New action will display a message that asks the user whether they would like to save the scene before it continues with the operation if the current scene was loaded from a file and the contents of the scene has changed since it was loaded, or if the scene was not loaded from a file but is not currently empty. While this and several other dialogs are better left as is, some dialogs are complex enough that the user needs guidance.

Guiding a user through a modal dialog is accomplished by defining an optional dialog member within the instruction. The value of this member is an Array, populated by sub-instructions. Typically, these sub-instructions are of the widget type.

Click the name of the example below to save it as a file.

Interactive_Lesson_Dialog_Widget_Example_1.dsa
var oLessonMgr = MainWindow.getInteractiveLessonMgr();
oLessonMgr.begin([
{ 
	"action": "DzNewAction",
	"info" : "Clear the scene"
},
{ 
	"action": "DzPrimitiveAction",
	"info" : "Create a new primitive.",
	"dialog" : [
		{
			"widget" : "PrimitiveTypeCmb",
			"info" : "The \"Type\" drop-down is used to change the kind of primitive being created.  Click the tag to acknowledge that you have seen the widget.",
			"locate_only" : "Type"
		},
		{
			"widget" : "PrimitiveTypeCmb",
			"value" : "Torus",
			"info" : "We'll make this one a Torus."
		},
		{
			"widget" : "BasicDlgAcceptDialogBtn",
			"info" : "Click the Accept button to confirm your choice(s)."
		}
	]
},
{ 
	"display": "Finish",
	"info" : "Congratulations!  You now have a new primitive in your scene."
},
]);