How to reset a menu width?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
think
Posts: 136
Joined: 09 Feb 2014, 05:20

How to reset a menu width?

09 Feb 2014, 05:28

Would it be it possible to reset a menu width after renaming an item without re-creating a menu? As you see in the following example, after renaming the item, menu width doesn't get adapted to short name.

Code: Select all

menu, mymenu, add, loooooooooooooooooooooongitem, handler
menu, mymenu, show
menu, mymenu, rename, loooooooooooooooooooooongitem, shortitem
menu, mymenu, show

handler:
return
User avatar
alvitawa
Posts: 71
Joined: 20 Jan 2014, 09:46

Re: How to reset a menu width?

09 Feb 2014, 15:03

think wrote:Would it be it possible to reset a menu width after renaming an item without re-creating a menu? As you see in the following example, after renaming the item, menu width doesn't get adapted to short name.

Code: Select all

menu, mymenu, add, loooooooooooooooooooooongitem, handler
menu, mymenu, show
menu, mymenu, rename, loooooooooooooooooooooongitem, shortitem
menu, mymenu, show

handler:
return
I don't think so, not with normal commands at least. You probably can do it with some dll calls or something but that's beyond my reach.
think
Posts: 136
Joined: 09 Feb 2014, 05:20

Re: How to reset a menu width?

10 Feb 2014, 18:19

Any dll call idea? Thanks.
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: How to reset a menu width?

12 Feb 2014, 22:10

Why not just recreate the menu?
think
Posts: 136
Joined: 09 Feb 2014, 05:20

Re: How to reset a menu width?

13 Feb 2014, 14:40

Menu contains many items and subitems with icons (file and folder structure) so it takes some time to recreate. That's why I hoped for any other solution.
Zelio
Posts: 278
Joined: 30 Sep 2013, 00:45
Location: France

Re: How to reset a menu width?

17 Feb 2014, 16:28

Anyway, it will be better and easier if you delete and recreate your menu, or to use custom alternative GUI...

Else you will need to rebuild it completly from the beggining of the start with msdn function at http://msdn.microsoft.com/en-us/library ... 46977.aspx or maybe try to investigate with a double script, because to catch the menu identification is impossible with a single script or maybe a trick with OnMessage or other... Also, to do some search, maybe people did an alternative library for create and select menu (I dunno)...

You can see that menu used internally by AutoHotkey is currently like a sleep (routine freezed) but still a wonderfull shortcut (as Gui command), you need a script "2" to catch the id and do action for the menu of the script "1". Test this script about menu thread for understand...

Code: Select all

#Persistent
; menu class 32768
SetTimer, WatchCursor, 100
return

WatchCursor:
MouseGetPos, , , id, control
WinGetTitle, title, ahk_id %id%
WinGetClass, class, ahk_id %id%
ToolTip, ahk_id %id%`nahk_class %class%`n%title%`nControl: %control%
return

a::
menu, mymenu, add, loooooooooooooooooooooongitem, handler
menu, mymenu, show
menu, mymenu, rename, loooooooooooooooooooooongitem, shortitem
menu, mymenu, show
return

handler:
return

esc::exitapp
Good luck, it will be complicated and hard if you continue in this menu way, recreate menu or reinvint the wheel or replace menu by GUI...

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], scriptor2016 and 308 guests