This 4d plugin allow to add status bar item to macOS simply by passing method to execute on click event and the picture icon.
STATUS BAR ITEM(<method name>; <icon>)
Example
var $picture; $statusPicture : Picture
READ PICTURE FILE(Folder:C1567(fk resources folder).file("icon.png").platformPath; $picture)
CREATE THUMBNAIL($picture; $statusPicture; 20; 20)
STATUS BAR ITEM("ShowMenuOrAlert"; $statusPicture)
then in your method you could for instance open a form or display a menu (on right or left click) using mouse event information.
var $mouseX; $mouseY : Real
var $mouseButton : Integer
GET MOUSE($mouseX; $mouseY; $mouseButton)
Case of
: ($mouseButton=2) // right click
var $refMainContextMenu; $refMenuEdit : Text
$refMainContextMenu:=Create menu
APPEND MENU ITEM($refMainContextMenu; "menu item 1")
SET MENU ITEM PARAMETER($refMainContextMenu; -1; "1")
APPEND MENU ITEM($refMainContextMenu; "menu item 2")
SET MENU ITEM PARAMETER($refMainContextMenu; -1; "2")
var $paramRef : Text
$paramRef:=Dynamic pop up menu($refMainContextMenu; ""; $mouseX-22; 22)
RELEASE MENU($refMainContextMenu)
Case of
: ($paramRef="1")
ALERT("1")
: ($paramRef="2")
ALERT("2")
End case
: ($mouseButton=1)
ALERT("left click")
End case
If you run a business and you’re using one of my projects in a revenue-generating product, it makes business sense to sponsor this open source development
Thank you for your support!