AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[solved]The & character will not be written by GuiContro

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Tuncay



Joined: 07 Nov 2006
Posts: 1886
Location: Germany

PostPosted: Sun Feb 21, 2010 3:34 pm    Post subject: [solved]The & character will not be written by GuiContro Reply with quote

AutoHotkey Version: 1.0.48.5 (mainstream version by Chris)

Is this a bug or known limitation? Or why does it not work?
Code:
Gui, Add, Text, Vtext w140 h80, hello world.
Gui, Show
Return
F1::GuiControl, Text, text, new & text
GuiClose:
ExitApp

Why is the & character not written to the control? Instead of an underscore is shown or a space.

[Moved from Bug Reports forum. ~jaco0646]
_________________
{1:"ahkstdlib", 2:"my libs", 3:"my apps", 4:"my license"}
--> Don't feed the troll! <--


Last edited by Tuncay on Sun Feb 21, 2010 4:33 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
tidbit



Joined: 09 Mar 2008
Posts: 1807
Location: Minnesota, USA

PostPosted: Sun Feb 21, 2010 3:47 pm    Post subject: Reply with quote

& makes the fallowing letter a hotkey.
notice the _ ?
notice in many apps, some specific letter is underlined on most buttons|menus? it makes it a hotkey.

to avoid this, 'escape' it. use the ` character (the key on the ~ (tilde)).

`&
_________________
rawr. be very afraid
*poke*
Note: My name is all lowercase for a reason.
Even monkeys fall from trees. - Japanese proverb
Back to top
View user's profile Send private message
Tuncay



Joined: 07 Nov 2006
Posts: 1886
Location: Germany

PostPosted: Sun Feb 21, 2010 3:50 pm    Post subject: Reply with quote

Of course I tried that `&, and at least on my computer it does not work. I am working on Windows Vista now. And it is a text control.

Is there any workaround??
_________________
{1:"ahkstdlib", 2:"my libs", 3:"my apps", 4:"my license"}
--> Don't feed the troll! <--
Back to top
View user's profile Send private message Send e-mail Visit poster's website
tidbit



Joined: 09 Mar 2008
Posts: 1807
Location: Minnesota, USA

PostPosted: Sun Feb 21, 2010 4:01 pm    Post subject: Reply with quote

yeah, whoops. you are supposed to use &&.
one of those lame exceptions like "".

Quote:
Certain controls may contain an ampersand (&) to create a keyboard shortcut, which might be displayed in the control's text as an underlined character (depending on system settings). A user activates the shortcut by holding down the ALT key then typing the corresponding character. For buttons, checkboxes, and radio buttons, pressing the shortcut is the same as clicking the control. For GroupBoxes and Text controls, pressing the shortcut causes keyboard focus to jump to the first input-capable tabstop control that was created after it. However, if more than one control has the same shortcut key, pressing the shortcut will alternate keyboard focus among all controls with the same shortcut.

To display a literal ampersand inside the control types mentioned above, specify two consecutive ampersands as in this example: Save && Exit

Code:
#SingleInstance force

Gui, Add, text, Vtext w140 h40, hello && world.
Gui, Add, text, Vtext2 w140 h40, hello world.
Gui, Show
Return
F1::GuiControl, Text, text2, new && text
GuiClose:
ExitApp

_________________
rawr. be very afraid
*poke*
Note: My name is all lowercase for a reason.
Even monkeys fall from trees. - Japanese proverb
Back to top
View user's profile Send private message
Tuncay



Joined: 07 Nov 2006
Posts: 1886
Location: Germany

PostPosted: Sun Feb 21, 2010 4:33 pm    Post subject: Reply with quote

Oh thx and sorry for that. I did search but could not find this information. I was sure it is a bug. So never mind.
_________________
{1:"ahkstdlib", 2:"my libs", 3:"my apps", 4:"my license"}
--> Don't feed the troll! <--
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Tuncay



Joined: 07 Nov 2006
Posts: 1886
Location: Germany

PostPosted: Sat Mar 06, 2010 1:38 pm    Post subject: Reply with quote

I just found that in the documentation about (Unnamed Style) of Text Controls:
Quote:
SS_NOPREFIX 0x80 Prevents interpretation of any ampersand (&) characters in the control's text as accelerator prefix characters. This can be useful when file names or other strings that might contain an ampersand (&) must be displayed within a text control

_________________
{1:"ahkstdlib", 2:"my libs", 3:"my apps", 4:"my license"}
--> Don't feed the troll! <--
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group