GETN_COMBO_BUTTON
#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);
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
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
#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"); }
GETN_BUTTON_BRANCH, GETN_BUTTON
GetNBox.h