Notifications
Clear all

[Closed] 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

2 Replies
 lo1

fn cmCamViewsItemClick sender arg=
 (
   --sender is your menu item.
  sender.name --is it name? I can't remember? maybe .text?
 )

Thanks Lo,

It was sender.text

Such an easy thing…

Thanks anyway