[Gambas-user] Trayicon app, menu not working
Demosthenes Koptsis
demosthenesk at gmail.com
Tue Aug 1 23:15:49 CEST 2023
well i changed the code as follows and now it is working
----------------------------------------------------------
' Gambas class file
Private hTrayIcon As TrayIcon
Private Mnu As Menu
Private Opt1 As Menu
Private Opt2 As Menu
Public Sub _new()
'create trayicon
hTrayIcon = New TrayIcon As "hTrayIcon"
hTrayIcon.Picture = Picture["app.png"]
hTrayIcon.Tooltip = "The demo trayicon application"
hTrayIcon.Show
InitMenu()
End
Public Sub Form_Open()
Me.Center
End
Public Sub Form_Close()
ExitApp()
End
Public Sub InitMenu()
'setup popup menu
Mnu = New Menu(Me)
Mnu.Name = "Mnu"
'setup option1
Opt1 = New Menu(Mnu) As "MenuTray"
Opt1.Name = "Opt1"
Opt1.Caption = "Show"
Opt1.Visible = True
Opt1.Picture = Picture["show.png"]
'setup option2
Opt2 = New Menu(Mnu) As "MenuTray"
Opt2.Name = "Opt2"
Opt2.Caption = "Quit application"
Opt2.Picture = Picture["exit.png"]
Opt2.Visible = True
End
Public Sub MenuTray_Click()
Select Case Last.name
Case "Opt1"
Me.Visible = True
Me.Minimized = False
Case "Opt2"
ExitApp()
End Select
End
Public Sub hTrayIcon_Click()
Mnu.Popup
End
Public Sub ExitApp()
Quit
End
Public Sub Timer1_Timer()
If Me.Minimized = True Then
Me.Hide
Endif
End
-------------------------------------------------------
On 8/1/23 22:45, Demosthenes Koptsis wrote:
> hello,
>
> i have a demo app for the TrayIcon component.
>
> i created a menu with Show, Quit options on trayicon.
>
> This app in previous versions of Gambas3 and Mate Desktop was working
> but now on Debian 13 Mate Desktop, is not working any more.
>
> Can someone test it in his desktop and tell me if it works or not or
> if the app has a bug?
>
> Thanks
>
More information about the User
mailing list