What does the & (ampersand) inside the string do?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ann Maybury
    New Member
    • May 2011
    • 3

    What does the & (ampersand) inside the string do?

    In the wxruby samples there is a file called dialogs.rb.

    When setting up the menu on the windows a bunch of lines of the form

    file_menu_appen d (DIALOGS_CHOOSE _COLOR, "&Choose colour")

    exist. What does the ampersand inside the string do?

    Ann
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Probably To allow for keyboard shortcuts.

    Comment

    • Ann Maybury
      New Member
      • May 2011
      • 3

      #3
      Thanks for your quick response.

      In the line
      Code:
      file_menu.append(DIALOGS_CHOOSE_COLOUR, "&Choose colour")
      I tried alt c without success. Which keyboard shortcut would you guess.
      cntrl c closed the window.

      This line is from the dialogs.rb sample distributed with wxruby 1.9.2.
      I could include the full code, but don't think it necessary since it executes well and I understand most of it.

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        If it's adding it to the file menu, then the shortcut would be alt+f and then c.

        Comment

        • Ann Maybury
          New Member
          • May 2011
          • 3

          #5
          Thank you. I now understand what is going on here.

          Comment

          Working...