2.3.1.21 GETN_COMBO_BUTTON 
 
Name
GETN_COMBO_BUTTON
 
Declaration
#define GETN_COMBO_BUTTON(_NODE_NAME, _BUTTON_NAME, _NODE_LABEL, _BUTTON_MODE, _COMBO_STR, _DEFAULT_VAL)  _tmpSubNode = _tmpNode.AddTextNode(_DEFAULT_VAL, #_NODE_NAME, ONODETYPE_BROWSECOMBO);TREE_ADD_LABEL(_NODE_LABEL); string str=#_BUTTON_NAME + ".."+ _BUTTON_MODE + "|:|" +_COMBO_STR;_tmpSubNode.SetAttribute(STR_COMBO_ATTRIB, str); 
Remark
This macro allows user to pick different kind of string to fill into an editable combo box. Programmer can prefill the combo dropdown as hints
 
Parameters
-  _NODE_NAME
 
- [input] name of the control node
 
-  _BUTTON_NAME
 
- [input] string to display on the button if _BUTTON_MODE is valid
 
-  _NODE_LABEL
 
- [input] label to display on dynamic control
 
-  _BUTTON_MODE
 
- [input] specify which type of dialog to open, valid mode are {"sheet(s)", "graph(s)", "column(s)", "matrix/matrices", "report(s)", "path(2)", "file(s)", "FileMultiSel", "Save", "SaveAs"}
 
-  _COMBO_STR
 
- [input] tokens contains in this control
 
-  _DEFAULT_VAL
 
- [input] default value of the combo list
  
Return
Examples
EX1
 
#include <GetNbox.h>
void GETN_COMBO_BUTTON_ex1()
{
    //this example prefill the combo with User.Dat, System.Dat, Group.Dat for user to pick
    //but also allow a browe button to let user browe to pick a file
    //the combo is prefilled with Untitle.dat
    GETN_BOX(tr)
    GETN_COMBO_BUTTON(fname, "Browse", "Picking a Data File", "File", "User.dat|System.dat|Group.dat", "Untitle.dat")
    if ( GetNBox(tr) )
        printf("You have selected %s\n", tr.fname.strVal);
    else
        printf("User Cancel\n");
}
EX2
 
- This example shows
 
-  
 
- 1. how to catch the combo button "click" event
 
- 2. how to show menu after click the button
  
#include <GetNbox.h>
#include <control.h>
int _event_func_ex(TreeNode& tr, int nRow, int nEvent, DWORD& dwEnables, LPCSTR lpcszNodeName, WndContainer& getNContainer, string& strAux, string& strErrMsg)
{
    //on click the ">" button
    if(ONODETYPE_BROWSECOMBO == nEvent && lstrcmpi(lpcszNodeName,"test") == 0)
    { 
	//show a menu
    	Menu myMenu;
    	myMenu.Add("Item1", 1, MF_STRING);
    	myMenu.Add("Item2", 2, MF_STRING);
    	
    	int nSelCmd;
	POINT pt;
	GetCursorPos(&pt);
	myMenu.TrackPopupMenu(0, pt.x, pt.y, getNContainer.GetSafeHwnd(), &nSelCmd);
	if(nSelCmd > 0)
	{
		string strName;
		myMenu.GetMenuString(nSelCmd, strName, MF_STRING);
		tr.test.strVal = strName;
	}
    }
    
    return true;
}
void GETN_COMBO_BUTTON_ex2()
{
    //combo with ">" button 
    GETN_BOX(tr)
    GETN_COMBO_BUTTON(test, ">", "List", "User", "AAA|BBB", "")
    if ( GetNBox(tr, _event_func_ex) )
        out_tree(tr);
    else
        printf("User Cancel\n");
}
See Also
GETN_BUTTON_BRANCH, GETN_BUTTON
 
Header to Include
GetNBox.h
 
Reference
             |