How to add click events to dynamic context menus?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
Old 01 January 2013   #1
How to add click events to dynamic context menus?

Hi all,

Here is the line that triggers the event on a context menu item click. The items are generated dynamically when the user clicks the button. How do I get the name of the item that is clicked?

fn cmCamViewsItemClick arg=
   " I want to get the name of the item clicked over here"
for i = 0 to cmCamViews.MenuItems.count-1 do
   dotNet.addEventHandler cmCamViews.MenuItems.item[i] "click" cmCamViewsItemClick 

Here cmCamViews is the contextmenu.

I am just totally confused checking the MSDN library and cgtalk posts.
Still on the same project which is on the viewport configuration, trying out multiple ways, got stuck two times prior to this trial and I fell this approach would be much better than I initially thought about it.

Please help
Thanks all.
Old 01 January 2013   #2

fn cmCamViewsItemClick sender arg=
   --sender is your menu item. --is it name? I can't remember? maybe .text?
Old 01 January 2013   #3
Thanks Lo,

It was sender.text

Such an easy thing..

Thanks anyway
Thanks all.
Old 01 January 2013   #4
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 08:14 AM.

Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.