Results 1 to 10 of 10

Thread: Assigning menu shortcuts on runtime

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2001
    Posts
    485

    Resolved Assigning menu shortcuts on runtime [RESOLVED]

    Is that possible?

    As I have a few popupmenus that are using the same shortcut, but appears on different forms. I get an error when assigning the same shortcut in the Menu Editor. So the only way is to do it during run-time.

    Thanks

    Harddisk
    Last edited by Harddisk; Oct 10th, 2005 at 11:42 PM.

  2. #2
    spetnik
    Guest
    It is, using the API.
    Ask Megatron how.

  3. #3
    Lively Member knochenfish's Avatar
    Join Date
    Apr 2001
    Location
    Cologne
    Posts
    77

    Question

    hi harddisk
    i tested it and received no error!
    is THAT possible?

    cheers

  4. #4
    spetnik
    Guest
    u know u can delete your post...

  5. #5
    Lively Member knochenfish's Avatar
    Join Date
    Apr 2001
    Location
    Cologne
    Posts
    77
    thanks aron, i´m new to that thing.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2001
    Posts
    485
    hmmm......API again

  7. #7
    Matthew Gates
    Guest
    To make an event happen when a key is pressed, use the KeyPress or KeyDown events.


    Code:
    Private Sub Form_KeyPress(KeyAscii As Integer)
        'if KeyAscii = ... Then...
        MsgBox KeyAscii & Chr$(9) & Chr(KeyAscii)
    End Sub
    
    Private Sub Form_Load()
        Me.KeyPreview = True
    End Sub

    And to have a menu and make it look like it has that big gap between, as a regular assigned shortcut would, use Chr$(9).


    Code:
    MyMenu.Caption = "Help" & Chr$(9) & "F1"

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2001
    Posts
    485
    MyMenu.Caption = "Help" & Chr$(9) & "F1"
    Thanks Gates, that's just what I need.

    Harddisk

  9. #9
    spetnik
    Guest
    this can also b done via api. i have the code on a book&cd, but its at work. if u pm me w/ ur email, i can email u the code

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2001
    Posts
    485
    Originally posted by spetnik
    this can also b done via api. i have the code on a book&cd, but its at work. if u pm me w/ ur email, i can email u the code
    Thanks for the offer.
    I think Matthew's suggestion is enough, it works great.

    Just wanted to show the Shortcut for the user so that they know of the shortcut exists. It doesnt really work when the shortcuts are applied to context menu.

    Harddisk

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width