3.7.5.17 Gadget

LabTalk Object Type:

Utility

The Gadget Object is derived from the Graphic Objects from which it inherits methods and properties. To declare a gadget variable, you should do as follows:

addtool_quickfit;	//execute XF to create gadget
gadget gg = rect;	//"rect" is the object name shown in the Object Name text box in the Programming Control dialog box

Properties:

Property Access Description
gadget.x, gadget.y Read/write,
numeric
X Y coordinates of the center of the ROI box.
gadget.dx, gadget.dy Read/write,
numeric
Width and height of the ROI box.
gadget.x#, gadget.y# Read/write,
numeric
x# and y# are the XY coordinates of the #th point of the ROI box. The ROI box has 4 points.

Methods:

Syntax

gadget name.Method(arguments)

  • Method is one of the available gadget methods.
  • arguments are specific to the method

General Methods

Method Description
gadget.output() Output the result at current position
gadget.output(nUpdateLast, nTag) Update last output or/and tag peak position, where nUpdateLast = 1 or 0 is used to control whether to update last output, and nTag = 1 or 0 is used to control whether to tag peak information on the graph. For example, if you only want to tag peak but not update last output, you can use gadget.output(0,1). nUpdate bit can only be turned on when results have already been output once. This syntax is mainly used for Quick Fit and Quick Peaks gadgets.
gadget.expand() Expand ROI to full range of the graph
gadget.gettree(tree) Get the GUI settings tree
gadget.settree(tree) Apply GUI changes to the gadget
gadget.loadtheme(string) load the pre-saved Theme
gadget.savetheme(string) Save the Theme of this dialog for reuse
gadget.data(PlotIndex, Option) Change the input data

Option can have 3 choices: 0-remove, 1-replace (default), 2-add; If PlotIndex=0, it means to deselect(option=0)/select(option=1,2) all.

gadget.getresult(tree) Get the result tree

Example

//assume there is a graph with a plot from row number data.
addtool_rise_time;	//execute XF to create gadget
gadget gg = rect;	//declare LT gadget variable

gg.x=15;		//move to some place
gg.x1=5;		//change the size of the ROI

gg.output();		//output result at current position
gg.x=20;		//move again


gg.gettree(trgui);	//get gui settings tree
trgui.roi.rectcolor=5;	//change the ROI fill color
gg.settree(trgui);	//apply gui changes to the gadget

gg.expand();		//expand ROI to full range
gg.output();		//output result at current position

tree mytr;              //define a tree variable
gg.getresult(mytr);     //output result to the tree variable mytr
mytr.=;                 //view the tree variable