Append a custom menu to context popup menu


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Append a custom menu to context popup menu

Hybrid View

  1. #1
    Henry Guest

    Append a custom menu to context popup menu


    I like to append menu commands to default context popup menu of an ActiveX
    control, such as TextBox. Could anyone suggest a solution?

    I know how to display custom and default popup menus separately. I need a
    solution to display both in one composite menu.

    Henry


  2. #2
    Rick Rothstein Guest

    Re: Append a custom menu to context popup menu

    You can eliminate the TextBox's default popup and display just yours by itself by doing
    this:

    Put this in the (General)(Declarations) section of your Form

    Private Declare Function ReleaseCapture Lib "user32" () As Long

    and use this MouseDown event code.

    Private Sub Text1_MouseDown(Button As Integer, _
    Shift As Integer, X As Single, Y As Single)
    If Button = vbRightButton Then
    ReleaseCapture
    PopupMenu mnuYourPopUpMenuName
    End If
    End Sub

    where I am assuming your popup is named mnuYourPopUpMenuName for this example.

    Rick


    "Henry" <wanghuanjin@home.com> wrote in message news:3b15151e$1@news.devx.com...
    >
    > I like to append menu commands to default context popup menu of an ActiveX
    > control, such as TextBox. Could anyone suggest a solution?
    >
    > I know how to display custom and default popup menus separately. I need a
    > solution to display both in one composite menu.
    >
    > Henry
    >



  3. #3
    Henry Guest

    Re: Append a custom menu to context popup menu


    Rick,

    Thanks for your suggestion which provides a very simple solution to display
    a custom popup menu.

    What I would like to have is display both default and custom context popup
    menus together. I recall reading an article or tech tip for doing what I
    want but cannot find the source anymore.

    Henry


    "Rick Rothstein" <rick_newsgroup@email.com> wrote:
    >You can eliminate the TextBox's default popup and display just yours by

    itself by doing
    >this:
    >
    >Put this in the (General)(Declarations) section of your Form
    >
    > Private Declare Function ReleaseCapture Lib "user32" () As Long
    >
    >and use this MouseDown event code.
    >
    > Private Sub Text1_MouseDown(Button As Integer, _
    > Shift As Integer, X As Single, Y As Single)
    > If Button = vbRightButton Then
    > ReleaseCapture
    > PopupMenu mnuYourPopUpMenuName
    > End If
    > End Sub
    >
    >where I am assuming your popup is named mnuYourPopUpMenuName for this example.
    >
    >Rick
    >
    >
    >"Henry" <wanghuanjin@home.com> wrote in message news:3b15151e$1@news.devx.com...
    >>
    >> I like to append menu commands to default context popup menu of an ActiveX
    >> control, such as TextBox. Could anyone suggest a solution?
    >>
    >> I know how to display custom and default popup menus separately. I need

    a
    >> solution to display both in one composite menu.
    >>
    >> Henry
    >>

    >



  4. #4
    Rick Rothstein Guest

    Re: Append a custom menu to context popup menu

    You could always incorporate those menu items you want from the TextBox popup into your
    own popup.

    Rick


    "Henry" <wanghuanjin@home.com> wrote in message news:3b1538f1$1@news.devx.com...
    >
    > Rick,
    >
    > Thanks for your suggestion which provides a very simple solution to display
    > a custom popup menu.
    >
    > What I would like to have is display both default and custom context popup
    > menus together. I recall reading an article or tech tip for doing what I
    > want but cannot find the source anymore.
    >
    > Henry
    >
    >
    > "Rick Rothstein" <rick_newsgroup@email.com> wrote:
    > >You can eliminate the TextBox's default popup and display just yours by

    > itself by doing
    > >this:
    > >
    > >Put this in the (General)(Declarations) section of your Form
    > >
    > > Private Declare Function ReleaseCapture Lib "user32" () As Long
    > >
    > >and use this MouseDown event code.
    > >
    > > Private Sub Text1_MouseDown(Button As Integer, _
    > > Shift As Integer, X As Single, Y As Single)
    > > If Button = vbRightButton Then
    > > ReleaseCapture
    > > PopupMenu mnuYourPopUpMenuName
    > > End If
    > > End Sub
    > >
    > >where I am assuming your popup is named mnuYourPopUpMenuName for this example.
    > >
    > >Rick
    > >
    > >
    > >"Henry" <wanghuanjin@home.com> wrote in message news:3b15151e$1@news.devx.com...
    > >>
    > >> I like to append menu commands to default context popup menu of an ActiveX
    > >> control, such as TextBox. Could anyone suggest a solution?
    > >>
    > >> I know how to display custom and default popup menus separately. I need

    > a
    > >> solution to display both in one composite menu.
    > >>
    > >> Henry
    > >>

    > >

    >



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