About Store Forum Documentation Contact
Donations:
158$/mo



Post Reply 
Context menus..
Author Message
b1s Offline
Member

Post: #1
Context menus..
Hey I have a question and I know its probably a stupid one.
But how do I get the selected list item from context menus.
I used the list on the context menu to create context
just like in the list tutorial but cant seem to get
the current selected element from that list anyway?
Is there a way to get this straight from the menu or?
01-22-2012 10:48 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Context menus..
it's better to use Node<CMenuElm>

CMenu& setData(Node<CMenuElm> &node, Bool check_column_hidden=false); // set data from node of CMenuElm's

sample:

Node<CMenuElm> n;
n.New().create("Import" , Edit::ImportFull );
n.New().create("Import Animation to current Mesh/Skeleton", Edit::ImportAnimation);
n.New().create("Import as Clothing to current Skeleton" , Edit::ImportCloth );
Gui+=import_mode_fbx.create(n, true);


or when using List you can try to setup callback function:
CMenu& func(void (*func)(Str path, Ptr user)=NULL, Ptr user=NULL); // set function called when any sub-element has been pushed, with 'user' as its parameter
T1(TYPE) CMenu& func(void (*func)(Str path, TYPE *user) , TYPE *user ) {return T.func((void(*)(Str, Ptr))func, user);} // set function called when any sub-element has been pushed, with 'user' as its parameter
T1(TYPE) CMenu& func(void (*func)(Str path, TYPE &user) , TYPE &user ) {return T.func((void(*)(Str, Ptr))func, &user);} // set function called when any sub-element has been pushed, with 'user' as its parameter

will receive Str 'path' (text value of the element selected)
01-24-2012 12:09 PM
Find all posts by this user Quote this message in a reply
b1s Offline
Member

Post: #3
RE: Context menus..
Okay thanks. seems pretty straight forward.
01-24-2012 12:58 PM
Find all posts by this user Quote this message in a reply
Post Reply