DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3

Thread: Menu Shortcut

  1. #1
    Fred Dalton Fred Guest

    Menu Shortcut


    I want to assign Alt+1, Alt+2 and Alt+3 to my form's menus, just like Windows
    Media Player. But VB's menu editor doesn't let me. Is there some API that
    will let me manually assign a short cut to a menu? If not, how does Windows
    Media Player do it? Thanks....

    - Fred Dalton

  2. #2
    Larry Rebich Guest

    Re: Menu Shortcut

    Fred,

    Code similar to this will work:

    Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKey1 And Shift = vbAltMask Then
    Caption = "Alt1 Pressed"
    End If
    End Sub

    Private Sub Form_Load()
    Me.KeyPreview = True
    End Sub

    Cheers,
    Larry Rebich

    More tips link to:
    http://www.buygold.net/tips.html

    Please:
    No personal e-mail questions :-)


    <Fred Dalton Fred> wrote in message news:3a0f669f$1@news.devx.com...
    >
    > I want to assign Alt+1, Alt+2 and Alt+3 to my form's menus, just like

    Windows
    > Media Player. But VB's menu editor doesn't let me. Is there some API that
    > will let me manually assign a short cut to a menu? If not, how does

    Windows
    > Media Player do it? Thanks....
    >
    > - Fred Dalton




  3. #3
    Larry Rebich Guest

    Re: Menu Shortcut

    Fred,

    Code similar to this will work:

    Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKey1 And Shift = vbAltMask Then
    Caption = "Alt1 Pressed"
    End If
    End Sub

    Private Sub Form_Load()
    Me.KeyPreview = True
    End Sub

    Cheers,
    Larry Rebich

    More tips link to:
    http://www.buygold.net/tips.html

    Please:
    No personal e-mail questions :-)


    <Fred Dalton Fred> wrote in message news:3a0f669f$1@news.devx.com...
    >
    > I want to assign Alt+1, Alt+2 and Alt+3 to my form's menus, just like

    Windows
    > Media Player. But VB's menu editor doesn't let me. Is there some API that
    > will let me manually assign a short cut to a menu? If not, how does

    Windows
    > Media Player do it? Thanks....
    >
    > - Fred Dalton




Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links