####################################################################### # # Add default macro buttons # # Macro buttons are displayed on top of the object pool unless they # are disabled in the preferences dialog. They can be used to trigger # common operations like loading a file or starting a demo. # # The button color can be set using "#RRGGBB" in hex format. # # A macro button can be removed at run-time like this: # macroButton -remove "Load" # # Example 1: add an extra "Open Data..." button # (uncomment the following line) #macroButton -add "Open Data..." -color mediumaquamarine -proc "theMain openData" # Example 2: add a "Load 16-bit..." button to load a file, attach a Convert Image Type module (HxCastField), and convert the data to unsigned short # (uncomment the following lines) #proc loadConvert16bit {} { #set script [[create HxScriptObject] setLabel "foo"] #$script newPortFilename filename #$script filename setMode 1 #$script select #$script filename exec #if [ catch { load [$script filename getFilename] } datafile ] { #remove $script #return #} #if { $datafile != "" } { #set cast [create HxCastField] #$cast data connect $datafile #$cast select #$cast fire #$cast outputType setValue 2 #$cast fire #$cast action setValue 0 #$cast fire #set newData [lindex [lindex [$cast downStreamConnections] 0] 0] #if { $newData == "" } { #return #} #$newData fire #$newData select #$newData fire #$newData master disconnect #$newData fire #remove $cast #remove $datafile #$newData deselect #} #remove $script #} #macroButton -add "Load 16-bit..." -color mediumaquamarine -proc "loadConvert16bit"