Modify ↓
Opened on Jul 20, 2012 at 4:10:45 PM
Closed on Jul 25, 2012 at 9:20:57 PM
Last modified on Jul 26, 2012 at 11:22:02 AM
#2233 closed Bug (No Bug)
TraySetOnEvent does not set $TRAY_EVENT_PRIMARYDOWN properly
| Reported by: | Owned by: | ||
|---|---|---|---|
| Milestone: | Component: | AutoIt | |
| Version: | 3.3.8.1 | Severity: | None |
| Keywords: | Cc: |
Description
Check this example:
#NoTrayIcon
#include <Constants.au3>
Opt("TrayOnEventMode", 1)
Opt("TrayMenuMode", 1+2) ; Default tray menu items (Script Paused/Exit) will not be shown.
TrayCreateItem("Exit")
TrayItemSetOnEvent(-1, "ExitEvent")
TraySetOnEvent($TRAY_EVENT_PRIMARYDOWN, "SpecialEvent")
TraySetOnEvent($TRAY_EVENT_PRIMARYUP, "SpecialEvent")
TraySetState()
TraySetClick(16)
While 1
Sleep(10) ; Idle loop
WEnd
Func SpecialEvent()
Switch @TRAY_ID
Case $TRAY_EVENT_PRIMARYDOWN
MsgBox(64, "SpecialEvent-Info", "Primary mouse button pressed down.")
Case $TRAY_EVENT_PRIMARYUP
MsgBox(64, "SpecialEvent-Info", "Primary mouse button clicked.")
EndSwitch
EndFunc
Func ExitEvent()
Exit
EndFunc
Both MsgBoxes shown after we release primary mouse button.
Expected behavior is that first MsgBox should be shown after we hold down primary mouse button, and second after we release the button.
Attachments (0)
Change History (2)
comment:1 by , on Jul 25, 2012 at 9:20:57 PM
| Resolution: | → No Bug |
|---|---|
| Status: | new → closed |
comment:2 by , on Jul 26, 2012 at 11:22:02 AM
Then why we need this event, i think it should be removed.
Or replace it with $TRAY_EVENT_DRAGBEGIN/END events.
Note:
See TracTickets
for help on using tickets.

It's windows thing.
WM_LBUTTONDOWN message is send back to us after explorer confirms you are not trying to initiate drag operation. That happens right before you release the button if no mouse move happened in the meantime.
Therefore no bug.