Page 1 of 1

SysTray Example Doesn't Work as Intended

Posted: Fri Dec 31, 2021 10:06 pm
by fsw
The original PB example uses #PB_EventType_LeftDoubleClick but it doesn't work.
#PB_EventType_LeftClick works.
Not sure if it's a PB issue or if Apple changed something for the Status Menu events (SysTray in PB terms).

The code below differs from the original PB example.
Comment/uncomment the desired LeftClick/LeftDoubleClick to test.

Code: Select all

If OpenWindow(0, 100, 150, 300, 100, "PureBasic - Status Menu Example", #PB_Window_SystemMenu)


  UsePNGImageDecoder()
  IconName1$ = #PB_Compiler_Home + "examples/sources/Data/world.png"
  IconName2$ = #PB_Compiler_Home + "examples/sources/Data/ToolBar/find.png"

  
  AddSysTrayIcon(1, WindowID(0), LoadImage(0, IconName1$))
  SysTrayIconToolTip(1, "Icon 1")
  
  Repeat
    Event = WaitWindowEvent()
    
    If Event = #PB_Event_SysTray
;       If EventType() = #PB_EventType_LeftClick
;         MessageRequester("SysTray", "Left Click on SysTrayIcon "+Str(EventGadget()),0)
      If EventType() = #PB_EventType_LeftDoubleClick
        MessageRequester("SysTray", "Left DoubleClick on SysTrayIcon "+Str(EventGadget()),0)
        
        ChangeSysTrayIcon (EventGadget(), LoadImage(0, IconName2$))
        SysTrayIconToolTip(EventGadget(), "Changed !")
      EndIf
      
    EndIf
  Until Event = #PB_Event_CloseWindow
  
EndIf
M1 MacBook with macOS Monterey 12.1 and PB6 beta 1.

Re: SysTray Example Doesn't Work as Intended

Posted: Sat Jan 01, 2022 2:57 am
by mk-soft
On macOS there is no doubleclick on the systray.
As far as I know, it has always been like that.