# Why the & in the middle of a string?

**URL:** <https://www.ruby-forum.com/t/why-the-in-the-middle-of-a-string/206680>\
**Category:** wxRuby\
**Created:** [May 7, 2011, 7:15am UTC](https://www.ruby-forum.com/t/why-the-in-the-middle-of-a-string/206680 "2011-05-07T07:15:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [May 7, 2011, 7:15am UTC](https://www.ruby-forum.com/t/why-the-in-the-middle-of-a-string/206680/1 "2011-05-07T07:15:24Z")

</div>

In the samples directory of WxRuby-ruby 192 there is a file called  
dialogs.rb.

Within this file there is a series of menu appends . A subset of is  
shown  
below.

* * *

```
file_menu.append(DIALOGS_CHOOSE_COLOUR, "&Choose colour")
file_menu.append_separator()
file_menu.append(DIALOGS_CHOOSE_FONT, "Choose &font")
```

---

<div class="post-metadata">

**Author:** ![ann\_m](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8e8cbc/32.png) [@ann\_m](https://www.ruby-forum.com/u/ann_m)\
**Post date:** [May 7, 2011, 8:24am UTC](https://www.ruby-forum.com/t/why-the-in-the-middle-of-a-string/206680/2 "2011-05-07T08:24:38Z")

</div>

On Sat, May 7, 2011 at 12:44 PM, Ann M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> * * *
> 
> ## What is the & trying to tell me? Why not just “Choose colour” or “Choose font”

That give you shortcut alt+key on the label  
something like : _C_hoose colour and Choose _f_ont  
if you try running it, press alt and you will see it

---

<div class="post-metadata">

**Author:** ![ann\_m](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8e8cbc/32.png) [@ann\_m](https://www.ruby-forum.com/u/ann_m)\
**Post date:** [May 8, 2011, 1:33am UTC](https://www.ruby-forum.com/t/why-the-in-the-middle-of-a-string/206680/3 "2011-05-08T01:33:00Z")

</div>

It has to do with keyboard short cuts. That & puts a line under the next  
char and when the dialog is open you can use that key to do that action  
instead of the mouse. So with the sample dialog in your email, if you  
type  
‘c’ you will open the colour chooser and ‘f’ gets you the font dialog

On 07/05/2011 3:14 PM, “Ann M.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

In the samples directory of WxRuby-ruby 192 there is a file called  
dialogs.rb.

Within this file there is a series of menu appends . A subset of is  
shown  
below.

* * *

```
file_menu.append(DIALOGS_CHOOSE_COLOUR, "&Choose colour")
file_menu.append_separator()
file_menu.append(DIALOGS_CHOOSE_FONT, "Choose &font")

```

---

<div class="post-metadata">

**Author:** ![ann\_m](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8e8cbc/32.png) [@ann\_m](https://www.ruby-forum.com/u/ann_m)\
**Post date:** [May 8, 2011, 2:34am UTC](https://www.ruby-forum.com/t/why-the-in-the-middle-of-a-string/206680/4 "2011-05-08T02:34:08Z")

</div>

Phillip & Kerrie Shelton \<philkez [gmail.com](http://gmail.com)\> writes:

> It has to do with keyboard short cuts. That & puts a line under the next char  
> and when the dialog is open you can use that key to do that action  
> instead of  
> the mouse. So with the sample dialog in your email, if you type ‘c’ you  
> will  
> open the colour chooser and ‘f’ gets you the font dialog
> 
> On 07/05/2011 3:14 PM, “Ann M.” \<ann.maybury [gmail.com](http://gmail.com)\> wrote:In the  
> samples directory of WxRuby-ruby 192 there is a file called  
> dialogs.rb.Within  
> this file there is a series of menu appends . A subset of is shown  
> below.----------------------------------  
> file\_menu.append(DIALOGS\_CHOOSE\_COLOUR, “&Choose colour”)  
> file\_menu.append\_separator() file\_menu.append(DIALOGS\_CHOOSE\_FONT,  
> “Choose &font”)-----------------------------------------------What is  
> the &  
> trying to tell me? Why not just “Choose colour” or “Choose font”

THANKS FOR YOUR RESPONSE.

When I run the samples/dialogs/dialogs.rb from which my question arose,  
there  
are no underlines following the &. Is there some configuration option  
that I  
may be missing?

aNN

---

<div class="post-metadata">

**Author:** ![ann\_m](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8e8cbc/32.png) [@ann\_m](https://www.ruby-forum.com/u/ann_m)\
**Post date:** [May 9, 2011, 6:30am UTC](https://www.ruby-forum.com/t/why-the-in-the-middle-of-a-string/206680/5 "2011-05-09T06:30:22Z")

</div>

On Sun, May 8, 2011 at 7:32 AM, Ann M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> open the colour chooser and ‘f’ gets you the font dialog  
> “Choose &font”)-----------------------------------------------What is the &

Press and hold Alt key  
you should see it
