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

Gianluigi bagonergi at ...626...
Mon Oct 3 15:45:30 CEST 2016


Changes so without timer:

Public Sub Form_Open()

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

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

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

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

End

... but goofy not work


2016-10-03 15:29 GMT+02:00 Demosthenes Koptsis <demosthenesk at ...626...>:

> On 3/10/2016 16:10 μμ, Gianluigi wrote:
> > You can take a look here [0].
> > I repeat, in Ubuntu click the icon is not registered by the poject.
>
> What does it mean?
> In Ubuntu, the TrayIcon is been seen correctly.
> But when i click it, Public Sub TrayIcon1_Click()
> is been called.
>
> How can i have access to each Menu_Click() subroutines?
>
> > Regards
> > Gianluigi
> > [0] http://gambas.8142.n7.nabble.com/TrayIcon-question-td55955.html
> >
> > [System]
> > Gambas=3.9.90 r7884
> > OperatingSystem=Linux
> > Kernel=4.4.0-38-generic
> > Architecture=x86_64
> > Distribution=Ubuntu 16.04.1 LTS
> > Desktop=UNITY
> > Theme=Cleanlooks
> > Language=it_IT.UTF-8
> > Memory=15975M
> >
> > [Libraries]
> > Cairo=libcairo.so.2.11400.6
> > Curl=libcurl.so.4.4.0
> > DBus=libdbus-1.so.3.14.6
> > GStreamer=libgstreamer-1.0.so.0.802.0
> > GTK+2=libgtk-x11-2.0.so.0.2400.30
> > GTK+3=libgtk-3.so.0.1800.9
> > OpenGL=libGL.so.1.0.0
> > OpenGL=libGL.so.1.2.0
> > Poppler=libpoppler.so.58.0.0
> > QT4=libQtCore.so.4.8.7
> > QT5=libQt5Core.so.5.5.1
> > SDL=libSDL-1.2.so.0.11.4
> > SQLite=libsqlite3.so.0.8.6
> >
> > [Environment]
> > CLUTTER_IM_MODULE=xim
> > COMPIZ_BIN_PATH=/usr/bin/
> > COMPIZ_CONFIG_PROFILE=ubuntu
> > DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-k6RIFlWV3J
> > DEFAULTS_PATH=/usr/share/gconf/ubuntu.default.path
> > DESKTOP_SESSION=ubuntu
> > DISPLAY=:0
> > GB_GUI=gb.qt4
> > GDMSESSION=ubuntu
> > GDM_LANG=it
> > GIO_LAUNCHED_DESKTOP_FILE=/home/<hostname>/.local/share/
> applications/gambas3.desktop
> > GIO_LAUNCHED_DESKTOP_FILE_PID=5746
> > GNOME_DESKTOP_SESSION_ID=this-is-deprecated
> > GNOME_KEYRING_CONTROL=
> > GNOME_KEYRING_PID=
> > GPG_AGENT_INFO=/home/<hostname>/.gnupg/S.gpg-agent:0:1
> > GTK2_MODULES=overlay-scrollbar
> > GTK_IM_MODULE=ibus
> > GTK_MODULES=gail:atk-bridge:unity-gtk-module
> > HOME=/home/<hostname>
> > IM_CONFIG_PHASE=1
> > INSTANCE=
> > JOB=unity-settings-daemon
> > LANG=it_IT.UTF-8
> > LANGUAGE=it
> > LOGNAME=<hostname>
> > MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path
> > PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/
> sbin:/bin:/usr/games:/usr/local/games:/snap/bin
> > PWD=/home/<hostname>
> > QT4_IM_MODULE=xim
> > QT_ACCESSIBILITY=1
> > QT_IM_MODULE=ibus
> > QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1
> > QT_QPA_PLATFORMTHEME=appmenu-qt5
> > SESSION=ubuntu
> > SESSIONTYPE=gnome-session
> > SESSION_MANAGER=local/<hostname>:@/tmp/.ICE-unix/
> 1405,unix/<hostname>:/tmp/.ICE-unix/1405
> > SHELL=/bin/bash
> > SHLVL=0
> > SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
> > TZ=:/etc/localtime
> > UPSTART_EVENTS=xsession started
> > UPSTART_INSTANCE=
> > UPSTART_JOB=unity7
> > UPSTART_SESSION=unix:abstract=/com/ubuntu/upstart-session/1000/1207
> > USER=<hostname>
> > XAUTHORITY=/home/<hostname>/.Xauthority
> > XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/usr/share/upstart/xdg:/etc/xdg
> > XDG_CURRENT_DESKTOP=Unity
> > XDG_DATA_DIRS=/usr/share/ubuntu:/usr/share/gnome:/usr/
> local/share/:/usr/share/:/var/lib/snapd/desktop
> > XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/<hostname>
> > XDG_MENU_PREFIX=gnome-
> > XDG_RUNTIME_DIR=/run/user/1000
> > XDG_SEAT=seat0
> > XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
> > XDG_SESSION_DESKTOP=ubuntu
> > XDG_SESSION_ID=c1
> > XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
> > XDG_SESSION_TYPE=x11
> > XDG_VTNR=7
> > XMODIFIERS=@...3498...=ibus
> >
> > 2016-10-03 14:27 GMT+02:00 Demosthenes Koptsis <demosthenesk at ...626...>:
> >
> >> 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
> >>
> >> -----------------------------------------
> >>
> >>
> >>
> >> ------------------------------------------------------------
> >> ------------------
> >> Check out the vibrant tech community on one of the world's most
> >> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> >> _______________________________________________
> >> Gambas-user mailing list
> >> Gambas-user at lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/gambas-user
> >>
> > ------------------------------------------------------------
> ------------------
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list