Jump to content

Recommended Posts

Posted

TrayItemDelete($TRAY_ITEM_PAUSE) ; this doesn't work. Why ?

I do not want to build a own menu handler, but just want to use the default menu handler.

But I want to hide the Pause item since it is an alarm clock application and it makes no sense to pause it. Just a item to terminate the alarm is required.

The handle should be correct, otherwise the text would not change.

#include <Constants.au3>
#include <GuiConstantsEx.au3>
Opt("TrayAutoPause", 0)
GUICreate("Tray Test", 150, 40)
GUISetState()
TrayItemSetText($TRAY_ITEM_EXIT, "Terminate")
TrayItemSetText($TRAY_ITEM_PAUSE, "Have a break")
TrayItemDelete($TRAY_ITEM_PAUSE); this doesn't work. Why ?
While 1
    If GUIGetMsg()= $GUI_EVENT_CLOSE Then Exit
WEnd
Posted

Well, if you do

Opt("TrayMenuMode",1)  ; Default tray menu items (Script Paused/Exit) will not be shown.
then both the pause and the exit function will not be in the menu. If there are no other menu items, no menu will be shown at all when clicking the icon.

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Posted

TinyBoy

As says in the help:

  Quote

TrayItemDelete

Parameters:

controlID - The control identifier (controlID) as returned by a TrayCreateItem or TrayCreateMenu function

I think you can't delete the default menu items, but you can create your own menu items and do any actions with them.

Look, I try to get a handle from the default menu item and the script is crashes:

#include <Constants.au3>
#include <GuiConstantsEx.au3>

Opt("TrayAutoPause", 0)

GUICreate("Tray Test", 150, 40)
GUISetState()

TrayItemSetText($TRAY_ITEM_EXIT, "Terminate")

TrayItemSetText($TRAY_ITEM_PAUSE, "Have a break")

$hTrayItem = TrayItemGetHandle($TRAY_ITEM_PAUSE)

ConsoleWrite($hTrayItem & @LF)

While 1
    If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
WEnd

Looks like a bug :)

Posted

  rasim said:

TinyBoy

As says in the help:

I think you can't delete the default menu items, but you can create your own menu items and do any actions with them.

Look, I try to get a handle from the default menu item and the script is crashes:

#include <Constants.au3>
#include <GuiConstantsEx.au3>

Opt("TrayAutoPause", 0)

GUICreate("Tray Test", 150, 40)
GUISetState()

TrayItemSetText($TRAY_ITEM_EXIT, "Terminate")

TrayItemSetText($TRAY_ITEM_PAUSE, "Have a break")

$hTrayItem = TrayItemGetHandle($TRAY_ITEM_PAUSE)

ConsoleWrite($hTrayItem & @LF)

While 1
    If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
WEnd

Looks like a bug :)

Yes, this seems to be an old bug, even on 3.2.8.1 it crashes the script. I made a bug report about it.

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted

  rasim said:

I think you can't delete the default menu items, but you can create your own menu items and do any actions with them.

rasim, just see my first post: I do not want to build a own menu handler

It would be desirable to have the option:

Opt("TrayAutoPause", -1)

to omit the pause item.

But I assume that such a feature request will be rejected.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...