DAZ Script "Simple Dialog" sample

Description :

Below is the source for a simple DAZ Script that provides the standard dialog button layout of dialogs in DAZ Studio.

 
Concepts Covered :
  • Using Operators to assign/validate the value of a variable
  • Constructing a Dialog with various Widgets for interfacing with the user
  • Using Global variables and methods
  • Providing information to the user via Message Box
 
Source : ./samples/
00001 // DAZ Studio version 3.0  filetype DAZ Script
00002 /**********************************************************************
00003     File: simpleDialog.dsa
00004 
00005     Copyright © 2002-2009 DAZ Productions. All Rights Reserved.
00006 
00007     This file is part of the DAZ Script Documentation.
00008 
00009     This file may be used only in accordance with the DAZ Script 
00010     license provided with the DAZ Script Documentation.
00011 
00012     The contents of this file may not be disclosed to third parties, 
00013     copied or duplicated in any form, in whole or in part, without the 
00014     prior written permission of DAZ Productions, except as explicitly
00015     allowed in the DAZ Script license.
00016 
00017     See http://www.daz3d.com to contact DAZ Productions or for more 
00018     information about DAZ Script.
00019 **********************************************************************/
00020 // Create a new dialog
00021 var wDlg = new DzBasicDialog;
00022 wDlg.caption = "My DzBasicDialog";
00023 wDlg.whatsThis = "This is the \"What\'s This?\" text for the dialog.";
00024 
00025 // Create a label
00026 var wLbl = new DzLabel( wDlg );
00027 wLbl.text = "This is a DzLabel.";
00028 wLbl.whatsThis = "This is the \"What\'s This?\" text for the label.";
00029 wDlg.addWidget( wLbl );
00030 
00031 // Limit the dialog size to the minimum required size
00032 wDlg.maxWidth = wDlg.minWidth;
00033 wDlg.maxHeight = wDlg.minHeight;
00034 
00035 // Launch the dialog and do something depending on the button pressed
00036 if( wDlg.exec() )
00037 {
00038     MessageBox.information( "Dialog accepted.", "Information", "&OK" );
00039 }
00040 else
00041 {
00042     MessageBox.information( "Dialog rejected.", "Information", "&OK" );
00043 }
00044 

Generated on Thu Sep 24 12:21:06 2009

Copyright © 2002 - 2009 DAZ 3D, Inc.