2.3.1.101 SET_AUTO_VALUE


Name

SET_AUTO_VALUE

Declaration

#define SET_AUTO_VALUE(_VAL) _tmpSubNode.SetAttribute(STR_AUTO_VALUE, _VAL);

Remark

show empty value when auto check box is checked

Parameters

_VAL

Return

Examples

EX1

#include <GetNBox.h>
static bool _on_change(TreeNode& trGUI, int nRow, int nCol, TreeNode& trNode, DWORD dwCntrl, int nType, WndContainer& theDlg)
{
	// Event for when user clicks on the auto checkbox associated with the control calling this event.
	if ( GETNEVENT_ON_AUTO_BUTTON_CLICKED & dwCntrl)
	{
		// Returns state of auto checkbox.
		int nCheck = octree_get_auto_support(&trNode);
		if (AUTO_UNCHECKED == nCheck)
		{
			if(trNode.dVal < 0)
				trNode.dVal= 0;
		}
		else if (AUTO_CHECKED == nCheck)
		{
			double dAutoValue;
			trNode.GetAttribute(STR_AUTO_VALUE, dAutoValue);
			trNode.dVal = dAutoValue;
		}
	}

	return true;
}

void auto_checkbox_click_test()
{
	double dAutoValue = 12.5;
	GETN_TREE(tr)

	// To show empty value in the control, pass the control value to SET_AUTO_VALUE.
	GETN_NUM(num, _L("Set some value"), dAutoValue) 
		GETN_ADD_AUTO(1) // Using GETN_ADD_AUTO(1) initially checks the checkbox. GETN_ADD_AUTO(0) initially unchecks the checkbox.
		SET_AUTO_VALUE(dAutoValue) 
		GETN_OPTION_EVENT_EX(_on_change)
		
	if (GetNBox(tr))
		out_tree(tr);
}

See Also

GETN_ADD_AUTO
tree_check_replace_auto
octree_get_auto_support


Header to Include

GetNbox.h

Reference