SysTray Example Doesn't Work as Intended

Found an issue in the documentation ? Please report it here !

Moderator: Documentation Editors

User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

SysTray Example Doesn't Work as Intended

Post 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.

I am to provide the public with beneficial shocks.
Alfred Hitshock
User avatar
mk-soft
Always Here
Always Here
Posts: 6242
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: SysTray Example Doesn't Work as Intended

Post by mk-soft »

On macOS there is no doubleclick on the systray.
As far as I know, it has always been like that.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Post Reply