Dynamic Context Menus


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Dynamic Context Menus

  1. #1
    Join Date
    Sep 2005
    Posts
    2

    Dynamic Context Menus

    I want to create a context menu dynamically during run time.

    easy enough with something like:

    For I = 1 To UBound(g_DispMenu)
    myForm.mnurightSlot.MenuItems.Add(g_DispMenu(I).Description)
    Next

    So the question becomes how do I handle some one clicking an item? I can not do something like this as I do not know how many menu items until run time?

    Private Sub mnuRightSlot_Popup(ByVal sender As Object, ByVal e As System.EventArgs) Handles MenuItem1.Click, MenuItem2.Click, MenuItem3.Click

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Look up the AddHandler statement in VB's online help.
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Oct 2005
    Location
    California
    Posts
    10

    Dynamic Context Menus

    For ASP.NET forms you can put the following in the page_Load method:

    if you have a control that you need the contex menu opened on, you can just put the following into the Page_Load method

    if control's id = "lblMyLabel"
    you would code the following:

    lblMyLabel.Attributes.Add("oncontext", "myJavascriptroutine");

    Romel Evans

Similar Threads

  1. Dynamic Context Menus
    By No-e in forum .NET
    Replies: 1
    Last Post: 09-19-2005, 12:56 PM
  2. IDesigner, Context Menus, and Verbs
    By byerkes in forum .NET
    Replies: 0
    Last Post: 06-23-2005, 12:19 PM
  3. dynamic nested menus
    By Brad Taylor in forum VB Classic
    Replies: 16
    Last Post: 03-29-2001, 10:21 AM
  4. dynamic nested menus
    By Brad Taylor in forum VB Classic
    Replies: 0
    Last Post: 03-26-2001, 05:37 PM
  5. Context Menus
    By RK in forum ASP.NET
    Replies: 0
    Last Post: 10-11-2000, 07:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center