Jump to content
Sign in to follow this  

Tray menu width resize?

Recommended Posts


I'm creating a litle script that will fill the Tray Menu dinamically and found a litle bug/problem on Windows 7!

I made a simple script to ilustrate the problem:

#include <Constants.au3>

Opt("TrayMenuMode", 3)
Opt("TrayOnEventMode", 1)

dim $txt = "Very long menu text line"
dim $id = 0, $clicks = 0

Func Example()
    TrayCreateItem("Click me")
    TrayItemSetOnEvent(-1, "ClickMe")


    TrayItemSetOnEvent(-1, "ExitScript")


    While 1
EndFunc   ;==>Example

Func ExitScript()
EndFunc   ;==>ExitScript

Func ClickMe()
    switch $clicks
        Case 0 ; 1st click add long text
            $id = TrayCreateItem($txt,-1, 1)
            $txt = "Option2"
        Case 1 ; 2nd click delete long text
        Case 2 ; 2rd click add small text (the menu size isn't adjusted!)
            TrayCreateItem($txt,-1, 1)
    $clicks = $clicks + 1

;;; Main

To test run the script above, open the Tray Menu and click the ClickMe option three times

- on the 1st click a new entry is created with a long line

- 2nd click will remove the long line. When this happens the tray menu resizes properly

- on the 3rd click a new option is added with smaller text. The problem is here! The Tray menu doesn't resize to adjust it uses the old big size!


The code above or the compiled exe will work just fine on Windows XP but not on Windows 7!

Is there any way arround this or is it possible to delete the Tray Menu and start over?


I also tried to reset the Tray Menu using the following code but after Destroy I coudn't create a new Tray Menu!

local $Tray_ID = TrayItemGetHandle(0)
Edited by rpaz

Share this post

Link to post
Share on other sites

Sorry for necroposting but I'm having this very same problem. Is there any way to reset the tray menu text width after having expanded it with a longer line?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Create New...