Scripting Resources for DigitalMicrograph™

banner

Dave Mitchell's DigitalMicrograph™ Scripting Website

Home | Scripts | Examples | Functions | Recent Updates | Tutorials | Resources | Publications | Consulting | Projects | Contact & Bio | Private | Search

 

Example: Image Selection Dialog
Function
Shows how to create an image selection pulldown menu in a dialog, displaying all the currently open images.
Version
version:20091903, v1.0
Author
D. R. G. Mitchell
Acknowledgements
-
Comments
-
System Requirements
Should be compatible with all recent versions of DigitalMicrograph.
Known Issues
-
Supported
Yes
Included Files
Main script file.
Source Code

// Example script showing how to create a dialog shows a pulldown menu


// listing all the open images - from which one may be selected.

// version:20091903, v1.0

 

// D. R. G. Mitchell, Oct 2009

// adminnospam@dmscripting.com (remove the nospam to make this email address work)

// Methods in the class respond to changes in the dialog.

class Testimagedialog : UIFrame

{

// This method is invoked when the pulldown menu is changed

void getimage(object self, taggroup imagegot)

{

string imageletter

imagegot.dlggetvalue(imageletter)

okdialog(""+imageletter)

}

}

 

// Creates a popup menu listing the currently open images.

 

taggroup dialogtest=dlgcreatedialog("Displayed Images")

TagGroup testimagemenu=DLGCreateImagePopup(127).dlgchangedmethod("getimage")

dialogtest.dlgaddelement(testimagemenu)

object dialog_frame = alloc(testimagedialog).init(dialogtest)

dialog_frame.display("Image Select")