[Gambas-user] Menu has no Click() event

Demosthenes Koptsis demosthenesk at ...626...
Mon Oct 3 14:27:53 CEST 2016


On 3/10/2016 14:39 μμ, Benoît Minisini wrote:
> Le 03/10/2016 à 13:33, Demosthenes Koptsis a écrit :
>> On 3/10/2016 14:21 μμ, Benoît Minisini wrote:
>>> Le 03/10/2016 à 10:32, Demosthenes Koptsis a écrit :
>>>> Hello,
>>>>
>>>> i try to implement a systray icon with a popup menu.
>>>>
>>>> In wiki says that each menu has a Click() event but i cannot find it in
>>>> code.
>>>>
>>>> I attach the small project.
>>>>
>>> Are you using the last version finally?
>>>
>> i use 3.9.0
>>
> Your program cannot work:
> - You must give your popup-menu a name that matches the string defined
> in the TrayIcon PopupMenu property.
> - You must define that menu before setting the property (this should not
> be necessary, but at the moment it works like that).
> - Once the popup menu is defined, you should not let-it popup on the
> Click event.
>
> All what I said is true with the new trayicon procotol.
>
> I guess you are using an old desktop that does not implement it, and so
> has other problems.
>
> Please post your system information so that I know.
>
> Regards,
>
Ok i put a Name to the hMenu ... still no Click() event

------------------------------------

' Gambas class file

   Public hMenu As Menu
   Public hMenu2 As Menu
   Public hMenu3 As Menu

Public Sub Form_Open()

  'Create the popup menu
   hMenu = New Menu(Me, True)
   hMenu.Name = "hMenu"

   hMenu2 = New Menu(hMenu)
   hMenu2.Text = "Mount ISO"

   hMenu3 = New Menu(hMenu)
   hMenu3.Text = "Unmount ISO"

   TrayIcon1.PopupMenu = "hMenu"
   TrayIcon1.Show
   TrayIcon1.Visible = True

End

Public Sub TrayIcon1_Click()

   hMenu.Popup

End

Public Sub Timer1_Timer()

   If Me.Visible == True Then
     Me.Visible = False
   Endif

End

Public Sub hMenu2_Click()

   Message.Info("hello qwerty")

End

-----------------------------------------






More information about the User mailing list