PC Review


Reply
Thread Tools Rate Thread

Building a dynamic right-click context menu in excel

 
 
Mareen Philip
Guest
Posts: n/a
 
      26th Jul 2009
I need to build a right-click context menu with the following requirements:
1. It should show up only when my listobject is selected.
2. Depending on the row which is selected in my listobject, some actions
may/may not be possilble. I want to only add commandbarbuttons for possible
actions. ie, I do not want to add all commandbarbuttons and mark some as
disabled, I want to not add the button based on the context
3. On of my commandbarpopups expend into commandbarbuttons that are dynamic
based on the row (ie, at coding time, I do not know how many
commandbarbuttons there will need to be). I'm generating captions & tags on
the fly for this one.
4. For the buttons in (3), the event handlers all point to the same
function, but pass different parameters.

What is the best way to approach this?
Currently, I'm building up the menu on right click, and tearing it down (by
unhooking events and calling commandbarcontrol->Delete() on each item I
added) after I'm done using it, and it's behaving a little flaky (event
handlers getting called multiple times on a single button click)

Thanks in advance.

 
Reply With Quote
 
 
 
 
Jim Cone
Guest
Posts: n/a
 
      26th Jul 2009
For number 1, you could add your new menu items to the list object right-click shortcut menus...

commandbars 67 "List Range Popup" and
commandbars 68 "List Range Layout Popup"

and not create a brand new popup
--
Jim Cone
Portland, Oregon USA




"Mareen Philip"
<(E-Mail Removed)>
wrote in message
I need to build a right-click context menu with the following requirements:
1. It should show up only when my listobject is selected.
2. Depending on the row which is selected in my listobject, some actions
may/may not be possilble. I want to only add commandbarbuttons for
possible actions. ie, I do not want to add all commandbarbuttons and
mark some as disabled, I want to not add the button based on the context
3. On of my commandbarpopups expend into commandbarbuttons that are
dynamic based on the row (ie, at coding time, I do not know how many
commandbarbuttons there will need to be). I'm generating captions & tags on
the fly for this one.
4. For the buttons in (3), the event handlers all point to the same
function, but pass different parameters.

What is the best way to approach this?
Currently, I'm building up the menu on right click, and tearing it down (by
unhooking events and calling commandbarcontrol->Delete() on each item I
added) after I'm done using it, and it's behaving a little flaky (event
handlers getting called multiple times on a single button click)

Thanks in advance.

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This 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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2003 VBA Editor Context Menu won't open on right-click - Hel Erik Microsoft Excel Programming 0 8th Mar 2010 03:17 PM
Adding a right-click context menu to Excel VBA TextBoxes ram gopal Microsoft Excel Programming 1 24th Nov 2008 07:55 AM
Building context menu on the fly Sameh Ahmed Microsoft VB .NET 3 16th Sep 2004 08:54 PM
If right click context menu order = double click action mark Windows XP Help 1 17th Aug 2004 08:17 AM
Right-click / Shortcut / Menu / Context-menu lead to network traffic Dave Nagle Windows XP General 3 5th Mar 2004 11:59 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:47 AM.