[Gambas-user] Form stealing focus problem (was Re: Balloon.Info on TrayIcon)

Fabien Bodard gambas.fr at ...626...
Mon Mar 2 22:03:02 CET 2015


Cool for popup menu
Le 2 mars 2015 21:25, "Benoît Minisini" <gambas at ...1...> a
écrit :

> Le 12/02/2015 01:58, Benoît Minisini a écrit :
> > Le 12/02/2015 01:23, Michael A. Capone a écrit :
> >> Hi folks,
> >>
> >> First of all, a big THANK YOU for the creation of Gambas!  It has
> >> allowed us to port legacy VB code to linux and get several of our users
> >> off the Windows platform.
> >>
> >> I've searched everywhere for this, and seen several requests, but no
> >> satisfactory answer.
> >>
> >> Is there any way to implement a Balloon message that can be attached to
> >> a tray icon?  This is common functionality that is seen in many
> >> applications.  Unfortunately, TrayIcons are "Classes", not "Controls",
> >> so when you call
> >>
> >>      Balloon.Info("Hello World", myTrayIcon)
> >>
> >> ... you get the error "Expected 'Control', got 'TrayIcon'".
> >>
> >> I've found this question in mailing lists going back to 2008, but no
> >> answer.
> >>
> >> My workaround is to render a small form in the lower right hand corner
> >> of the screen, put a tiny label on the tiny form, and have that label be
> >> the Control that the balloon attaches to.  A timer then closes the form
> >> after a few seconds.
> >>
> >> The problem with that solution is that the newly rendered form steals
> >> focus from whatever application is currently running.  So if I'm typing
> >> away in an e-mail, and my miniature balloon form loads, my e-mail client
> >> loses focus.
> >>
> >> I'm using gb.qt on Gambas 3.5.0; QT certainly has support for this
> >> (http://qt-project.org/doc/qt-4.8/desktop-systray.html), although I'll
> >> admit I know next to nothing about QT programming.  But is this a
> >> feature that can be built into the TrayIcon class, perhaps in the form
> >> of TrayIcon.Balloon.Info?  Or, is there a way to do that that I'm not
> >> familiar with yet?
> >>
> >> Thanks so much!
> >> Michael
> >>
> >
> > This is a windows idea : tray icons do not work anymore like that on
> > Linux, even if you can hack to get what your want.
> >
> > At the moment Gambas does not support the new standard tray icon system,
> > and if you have something to say to the user, you should use the
> > notification system :
> >
> >
> https://people.gnome.org/~mccann/docs/notification-spec/notification-spec-latest.html
> >
> >
> > As for the form stealing the focus, this is a problem I'm aware of. But
> > I have to find a good interface yet that allows showing a form without
> > it taking the focus.
> >
> > Regards,
> >
>
> Form stealing focus problem has been solved in revision #6937 with a new
> property added to the Window class: TakeFocus.
>
> If you set TakeFocus to False, then your window will not steal the focus
> the first time it is shown.
>
> Regards,
>
> --
> Benoît Minisini
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website,
> sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for
> all
> things parallel software development, from weekly thought leadership blogs
> to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> 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