Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Building a dynamic right-click context menu in excel

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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default Building a dynamic right-click context menu in excel

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"

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Screwed Up my Right Click Context Menu, Please Help cpmame Excel Programming 11 March 12th 09 10:59 PM
Adding a right-click context menu to Excel VBA TextBoxes ram gopal Excel Programming 1 November 24th 08 07:55 AM
Undo button in the context menu (right click menu) Madiya Excel Programming 7 April 7th 08 04:33 PM
Custom Context menu (Right click menu) not working in sheet changeevent. Madiya Excel Programming 3 February 11th 08 01:24 PM
Right-Click (Context Menu) Kryptonix Excel Programming 6 October 25th 05 03:59 PM


All times are GMT +1. The time now is 12:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"