B4J Question jSystemTray with MacOS

Blueforcer

Well-Known Member
Licensed User
Longtime User
Hello,

i move the Application to the tray and close the Form. This works perfectly in Windows.
But under MacOS nothing happens if i close the app. The App stays open.
Does jSystemTray works in MacOS? I want to move the app to the top Statusbar with the same behavior in windows.

B4X:
Sub MainForm_CloseRequest (EventData As Event)
    tray.AddTrayIcon(icon1)
    MainForm.Close
End Sub

B4X:
Sub Icon1_DoubleClick
    tray.RemoveTrayIcon(icon1)
    MainForm.show
End Sub
 

Blueforcer

Well-Known Member
Licensed User
Longtime User
Yes and i figure out whats the problem.
it doesn't work if i call AddTrayIcon in the CloseRequest.
adding in Appstart works. But i want to add the icon when the form is closed, not the whole time.
This behavior only exists in MacOS
 
Upvote 0

Blueforcer

Well-Known Member
Licensed User
Longtime User
And when i close the app, the app minimize and the icon stays in the dock (even though I want to close the Form), but isnt accessible from the Dock. Is there no way to remove the icon from the Dock in MacOS?
right click the tray icon to open the form also doesn't work, and makes the app stop responding..i have to kill it. It seems that removeIconTray also doesn't work.

there some strange thins in MacOS
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
And when i close the app, the app minimize and the icon stays in the dock (even though I want to close the Form), but isnt accessible from the Dock. Is there no way to remove the icon from the Dock in MacOS?
You should start a new thread for a new question.

t doesn't work if i call AddTrayIcon in the CloseRequest.
Try this:
B4X:
Sub MainForm_CloseRequest (EventData As Event)
   EventData.Consume
   'add system tray
   Sleep(300)
   MainForm.Close
End Sub
 
Upvote 0
Top