AutoHotkey Community

It is currently May 27th, 2012, 12:11 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 12 posts ] 
Author Message
PostPosted: April 14th, 2011, 8:21 pm 
Offline

Joined: February 19th, 2010, 8:07 pm
Posts: 615
The following code was working perfectly until now:

Code:
    Menu, Search, add, Find...`t`tCtrl+F, MenuHandler
    Menu, Search, add, Find in Files...`t`tCtrl+Shift+F, MenuHandler
    Menu, Search, add, Find Next...`t`tF3, MenuHandler
    Menu, Search, add, Find Previous...`t`tShift+F3, MenuHandler
    Menu, Search, add, Find && Replace`t`tCtrl+H, MenuHandler
    Menu, Search, add, Go to Line`t`tCtrl+G, MenuHandler
    Menu, Search, add, Go to Matching Brace`t`tCtrl+B, MenuHandler
    Menu, Search, disable, Go to Matching Brace`t`tCtrl+B


At the moment it causes a box to be displayed on the menu on both ANSI and Unicode versions of AHK_L v1.0.97.01 right next to the hotkey text:

Quote:
Find... []Ctrl+F


Note that only one box is displayed.

_________________
Main Project: AutoHotkey Toolkit
Unless specified otherwise all my code is written for the latest Autohotkey L Unicode version.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 14th, 2011, 10:24 pm 
Offline

Joined: May 3rd, 2009, 7:16 pm
Posts: 345
Location: OH, USA
The following works fine for me in all current versions:
Code:
#Persistent
Menu, Search, add, Find...`t`tCtrl+F, MenuHandler
Menu, Search, add, Find in Files...`t`tCtrl+Shift+F, MenuHandler
Menu, Search, add, Find Next...`t`tF3, MenuHandler
Menu, Search, add, Find Previous...`t`tShift+F3, MenuHandler
Menu, Search, add, Find && Replace`t`tCtrl+H, MenuHandler
Menu, Search, add, Go to Line`t`tCtrl+G, MenuHandler
Menu, Search, add, Go to Matching Brace`t`tCtrl+B, MenuHandler
Menu, Search, disable, Go to Matching Brace`t`tCtrl+B
Menu, Search, Show
return
MenuHandler:
   ExitApp


Report this post
Top
 Profile  
Reply with quote  
PostPosted: April 15th, 2011, 2:10 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
RaptorX wrote:
The following code was working perfectly until now:
Are you sure? What's changed?

On this Windows XP system, the second tab character is rendered as a box by both AutoHotkey Basic and AutoHotkey_L. I believe that only the first tab character has special meaning, and that it has always been this way. However, I generally don't use `t in menus.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: April 15th, 2011, 3:22 am 
Offline

Joined: May 3rd, 2009, 7:16 pm
Posts: 345
Location: OH, USA
Lexikos wrote:
On this Windows XP system, the second tab character is rendered as a box by both AutoHotkey Basic and AutoHotkey_L.

This doesn't happen on Windows 7 for me. I just tested this on Windows XP and now I see the problem. Wonder why...

I seem to get the desired (same) effect by just using 1 tab character. I know it doesn't answer the question of "why", but at least it's a solution.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: April 15th, 2011, 6:35 am 
Offline

Joined: February 19th, 2010, 8:07 pm
Posts: 615
Lexikos wrote:
RaptorX wrote:
The following code was working perfectly until now:
Are you sure? What's changed?


Yes I am sure, I did reinstall XP today but I have never seen this issue before.

Considering what Solar mentioned I think it has to do with the OS (a missing update perhaps?).

I continued testing and if I add more tabs I get more boxes (only the first tab is not displayed as a box). Before, the more tabs i added i got more space on the right side of the menu (the indentation didnt really change).

I will go with 1 tab for now, but I am curious as to why this started happening.

_________________
Main Project: AutoHotkey Toolkit
Unless specified otherwise all my code is written for the latest Autohotkey L Unicode version.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 15th, 2011, 8:30 am 
Offline

Joined: May 3rd, 2009, 7:16 pm
Posts: 345
Location: OH, USA
To conclude this topic, only 1 tab character should be used in the menu caption. Using 2 tabs is incorrect syntax and shouldn't provide more "space" than 1 tab. As such, the reason for why 2 tabs once worked is irrelevant.

Reference: http://msdn.microsoft.com/en-us/library/sb0sb21a.aspx


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 15th, 2011, 9:47 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
On my Windows 7 system, the text after the tab is right-aligned (not left-aligned as it was on XP) and the menu appears the same whether it has one tab or two. This reaffirms my belief that tab is used as a delimiter between the left and right "columns", not as a subtitute for whitespace.

In general, Windows 7 and (probably) Vista either skip rendering of unprintable characters (making them effectively zero-width), or use some seemingly unrelated glyphs (if <= Chr(28), on my system). XP uses the default glyph, usually a box. However, I think it might be possible on XP to set a (system-wide) menu font which has an invisible default glyph, so perhaps that is why it was "working" for you before.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 15th, 2011, 7:14 pm 
Offline

Joined: May 3rd, 2009, 7:16 pm
Posts: 345
Location: OH, USA
After digging around a bit, I found some more information. Even though the original issue is now resolved (relating to spacing), there now seems to be an issue with alignment of menu items. The tab character should not right-align text. I do believe this is a bug.

To left-align text, the string should be delimited by the tab (`t) character. To right-align text, the string should be delimited by the alert (`a) character. However, on XP, the alert character displays a block and doesn't right-align the text. Also, as stated before, the tab character is incorrectly right-aligning strings delimited by the tab character on Windows 7 (probably Vista too).

Reference: http://msdn.microsoft.com/en-us/library/aa381024.aspx

Perhaps you can take a look at the source when you get some time Lexikos. Although, considering how trivial this is, I wouldn't make it a priority.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 16th, 2011, 12:41 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
I had already looked at the source. AutoHotkey merely adds a menu item with the text you give it. It doesn't render the menu text, therefore it can't control alignment. Similarly, the following gives right-aligned text on Windows 7 and left-aligned text on XP:
Code:
hmenu := DllCall("CreatePopupMenu", "ptr")
DllCall("AppendMenu", "ptr", hmenu, "uint", 0, "ptr", 1, "str", "This menu item name is long`tA")
DllCall("AppendMenu", "ptr", hmenu, "uint", 0, "ptr", 1, "str", "Short`tCtrl+Alt+Shift+Win+A")
DetectHiddenWindows On
hwnd := WinExist("ahk_class AutoHotkey ahk_pid " DllCall("GetCurrentProcessId"))
DllCall("TrackPopupMenu", "ptr", hmenu, "uint", 0x180, "int", 600, "int", 300, "int", 0, "ptr", hwnd, "ptr", 0)
`a shows as a black dot on Windows 7 and a box on Windows XP.

The documentation you have found applies only to menu resource definitions. For instance, if any of AutoHotkey's MENUITEM definitions (found in source\resources\AutoHotkey.rc) contain \a, the key-combination text is right-aligned in all of AutoHotkey's main menus. (On Windows 7 there is no difference between \a and \t.) Note that the documentation you linked says \a right-aligns the text, but it does not say that \t left-aligns the text.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 16th, 2011, 3:02 am 
Offline

Joined: May 3rd, 2009, 7:16 pm
Posts: 345
Location: OH, USA
Lexikos wrote:
Note that the documentation you linked says \a right-aligns the text, but it does not say that \t left-aligns the text.

I was referring the the documentationthat I linked a few posts back. It says:
Quote:
Following the menu caption, type the escape sequence for a tab (\t), so that all the menu's accelerator keys are left aligned.

Found that by disabling visual styles on Windows 7, the menu hotkeys are then left-aligned like XP. So to conclude, because AHK doesn't draw the menus, they are OS dependent. As for delimiters, it seems that only tab is valid outside of resource item definitions. Correct me if I'm wrong.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 16th, 2011, 3:13 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
Thanks for clarifying. Yes, I think that's about right.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 16th, 2011, 7:30 am 
Offline

Joined: February 19th, 2010, 8:07 pm
Posts: 615
Thank you guys for taking a look at such a trivial matter.

In the end I think your assumptions were right; i had changed the default system font and that other font did not display the subsequent tab escapes, as soon as i reinstalled XP the default font was restored which does displays the boxes.

About left/right - alignment, I never noticed anything weird on it, and as it is OS dependent I also agree it is not an AHK bug.

_________________
Main Project: AutoHotkey Toolkit
Unless specified otherwise all my code is written for the latest Autohotkey L Unicode version.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group