B4J Question System Tray - Tooltip text not displaying

rgarnett1955

Active Member
Licensed User
Longtime User
Hi,

I have written the following to create a system tray item with a tooltip:

App startup - system tray tooltip:
Sub AppStart (Form1 As Form, Args() As String)
    fu.Initialize
    MainForm = Form1
    Form1.SetFormStyle("UNIFIED")
    MainForm.RootPane.LoadLayout("Layout1")
    fu.SetIconified(MainForm, True)
    MainForm.Close
    
    trayIcon.Initialize(File.DirAssets, cmdCon.ICON_ORANGE)
    Dim JO As JavaObject = MainForm.RootPane
    JO =JO.RunMethod("getScene",Null)
    JO = JO.RunMethod("getWindow",Null)
    Dim SIcons As List = JO.RunMethod("getIcons", Null)
    'Add icon to Stage/Window
    SIcons.Add(trayIcon)
    
    'Create a system tray
    sysTray.Initialize
    YellowImage = fx.LoadImage(File.DirAssets, cmdCon.ICON_ORANGE)
    GreenImage  = fx.LoadImage(File.DirAssets, cmdCon.ICON_GREEN)
    
    trayMenuItems = Array As String("Open Main Form", "Hide Main Form", "-", "Stop MCU Server When Done",  "Start MCU Server", "-", "Stop MCU Server Now",  "-", "Exit - When Done", "-", "-", "Close Application")
    iconTray.Initialize("iconTray", YellowImage, trayMenuItems)
    iconTray.ToolTip = "MCU Host = " & cmdCon.CLIENT_NAME & CRLF & "MCU Port = " & cmdCon.MCU_CLIENT_PORT
    sysTray.AddTrayIcon(iconTray)

Problem is that the tooltip does not display when I hover over the tray icon.

Every other function right click etc works fine.

I am using Windows 11.

Refards
Rob
 
Top