Floating Pallete Functions


REQUIREMENTS
------------

The functions listed below are valid for DigitalMicrograph 3.6.0 (Gatan Microscopy Suite 1.0) and later.

Note that the user-interface changes with GMS 2.0 and that the commands listed below will not all work. In particular, registring/unregistring of palettes has changed.


HOW TO CREATE FLOATING PALETTES
-------------------------------

To display your dialog as a floating palette, first create the dialog object using the appropriate tags, then use RegisterScriptPalette(...) to register your dialog object as a floating palette. You can then use OpenGadgetPanel()/CloseGadgetPanel() to open and close the floating palette window.


------ FLOATING PALETTE FUNCTIONS ----------------------------------

// Registers a uiframe dialog object as a floating palette; returns the palette token value.
number RegisterScriptPalette( ScriptObject dialog_object, String type_name, String display_name )

// un-registers a floating palette.
void UnregisterScriptPalette( number palette_token )

// Opens a gadget panel and places it in its default position.
Window opengadgetpanel( string gadget_panel_name )

// Opens a gadget panel and places it in its default position.
// The gadget panel object is passed back in the second argument.
Window OpenGadgetPanel( String gadget_panel_name, ScriptObject gadget_panel )

// Closes a gadget panel.
Window closegadgetpanel( String gadget_panel_name )

// Closes a gadget panel. The gadget panel object is passed back in the second argument.
Window CloseGadgetPanel( String gadget_panel_name, ScriptObject gadget_panel )

// Returns whether the indicated gadget panel is open in 'gadget_window'.
Boolean GadgetWindowGetIsGadgetPanelOpen( Window gadget_window, ScriptObject gadget_panel )

// Opens or closes the gadget panel in 'gadget_window'.
void GadgetWindowSetIsGadgetPanelOpen( Window gadget_window, ScriptObject gadget_panel, Boolean is_open )

// Finds a gadget panel and passes it back in the second argument.
Window FindGadgetPanel( string gadget_panel_name, ScriptObject gadget_panel )

// Insert the gadget panel 'gadget_panel' in 'gadget_window' by 'ref_gadget_panel'.
void GadgetWindowAddGadgetPanel( Window gadget_window, ScriptObject gadget_panel, ScriptObject ref_gadget_panel, Boolean insert_after )

// Remove the gadget panel 'gadget_panel' from 'gadget_window'.
void GadgetWindowRemoveGadgetPanel( Window gadget_window, ScriptObject gadget_panel )

// Return the panel in 'gadget_window' with the name 'gadget_panel_name'.
ScriptObject GadgetWindowFindGadgetPanelByName( Window gadget_window, String gadget_panel_name )

// Puts up to 'des_num_panels' gadget panels into 'gadget_panel_list', returning the number of panels placed there.
Number GadgetWindowGetGadgetPanels( Window gadget_window, number start_panel_index, number des_num_panels, ScriptObject gadget_panel_list )


GadgetPanel methods:

Window GetGadgetWindow( ScriptObject gadget_panel )
String GetGadgetPanelType( ScriptObject gadget_panel )
String GetGadgetPanelName( ScriptObject gadget_panel )


You can vary the width and position of the floating palette by specifying
the "Width" and "Side" attributes,
as in the sample code below:

TagGroup theTags = DLGCreateDialog("Sample Dialog")

TagGroup position
position = DLGBuildPositionFromApplication()
position.TagGroupSetTagAsString( "Width", "Medium" )
//OR specify a numeric width: position.TagGroupSetTagAsNumber( "Width", 400 )
position.TagGroupSetTagAsString( "Side", "Right" )
theTags.TagGroupSetTagAsTagGroup( "Positioning", position )

The valid values for "Width" are: "Narrow", "Medium", "Wide", or a positive integer.
Defaults to "Narrow". (*** positive integer is no longer a valid attribute after DM3.7.0 ***)
The valid values for "Side" are: "Top", "Bottom", "Left", "Right". Defaults to "Left".
These two attributes work only on floating palettes (not modeless/modal dialogs).