TNTmips

HOME

FREE PRODUCTS
  TNTlite
  TNTatlas
  TNTsim3D

DOWNLOADS
  Release Version
  Development Version
  FTP
  Language Kits
  Sample Geodata
  Reseller Resources
  Promotional

DOCUMENTATION
  Tutorials
  Technical Guides
  Quick Guides

SITE MAP


bonjour2.sml


### bonjour2.sml
### Sample script for Building Dialogs in SML

### Illustrates the use of dialog control callbacks 
### in a script tag in the dialog specification.

### Global variable declarations
numeric errXML, dlgreturn;
string xmlfile$;

# clear the console window
clear();

### create string with path and filename of XML file with the
### dialog specification (assumed to be in same directory as this script)
xmlfile$ = _context.ScriptDir + "/bonjour2.xml";

### read and parse XML file; returns an error code (number < 0 ) if there are syntax errors
class XMLDOC doc;
errXML = doc.Read(xmlfile$);

if (errXML < 0) {
	PopupError(errXML); # Popup an error dialog. "Details" button shows syntax errors.
	Exit();
}

### declare class instance for the dialog element in the XML structure
### and get the dialog handle from the XML structure.
### Pop up an error dialog and exit if the dialog ID can't be found in the XML.
class XMLNODE dlgnode;					
dlgnode = doc.GetElementByID("hello");

if (dlgnode == 0) {
	PopupMessage("Could not find dialog node in XML document");
	Exit();
}

### declare class instance for the dialog window and set the XML structure
### in memory as the source for the dialog.
class GUI_DLG dlg;
dlg.SetXMLNode(dlgnode);

### open as a modal dialog; the DoModal() method doesn't return until the dialog is
### closed; it returns -1 if the user presses [Cancel], or 0 if the user presses [OK].
dlgreturn = dlg.DoModal();

if (dlgreturn == -1) {		# exit script when Cancel button on dialog is pressed
	Exit();
	}


Back Home ©MicroImages, Inc. 2008 Published in the United States of America
11th Floor - Sharp Tower, 206 South 13th Street, Lincoln NE 68508-2010   USA
Business & Sales: (402)477-9554  Support: (402)477-9562  Fax: (402)477-9559
Business info@microimages.com  Support support@microimages.com  Web webmaster@microimages.com

9 May 2008

page update: 14 Aug 07