[Gambas-user] Hiding FMain not possible?

Benoit Minisini gambas at ...1...
Thu Dec 11 11:24:19 CET 2008


On jeudi 11 décembre 2008, Stefano Palmeri wrote:
> Il mercoledì 10 dicembre 2008 19:34:44 Benoit Minisini ha scritto:
> > On mercredi 10 décembre 2008, Stefano Palmeri wrote:
> > > Il mercoledì 10 dicembre 2008 15:50:15 Rolf-Werner Eilert ha scritto:
> > > > Benoit Minisini schrieb:
> > > > > On mercredi 10 décembre 2008, Rolf-Werner Eilert wrote:
> > > > >> Hi folks,
> > > > >>
> > > > >> meanwhile I've understood how to use the TrayIcon, but if my
> > > > >> application should show only the tray icon, no application window,
> > > > >> how can I hide the whole thing (except the tray icon, of course)?
> > > > >>
> > > > >> Thanks for your advice!
> > > > >>
> > > > >> Rolf
> > > > >
> > > > > FMain.Hide ?
> > > >
> > > > This is what I tried, and I tried setting FMain.Visible = False and
> > > > so on - no help, it just shows up on screen.
> > > >
> > > > It is shown when started in the IDE and when started as an executable
> > > > as well.
> > > >
> > > > Seems this has to do with my KDE version, like the other thing we
> > > > discussed yesterday...
> > > >
> > > > Rolf
> > >
> > > I've the same problem under KDE 3.5.9. To solve I use the same
> > > solution explained by Toni. In a startup module I just put:
> > >
> > > ---------------------------------
> > > PUBLIC SUB Main()
> > >
> > >   FMain.Visible = FALSE
> > >
> > > END
> > > ---------------------------------
> > >
> > >
> > > Bye,
> > >
> > > Stefano
> >
> > If your startup class is not a form, you don't have to do FMain.Visible =
> > FALSE. Just create your TrayIcon there, and show FMain only if needed.
> >
> > Regards,
>
> Benoit, the Module startup class is a workaround.
> The little problem here is that if I have a startup class that is a Form
> with a TrayIcon, is not possible to hide it on start. I don't know if this
> is a bug of Gambas or KDE. I attached a little example to explain.
> I would like to iconify the app on startup, I mean I don't want to see
> the Form, just the icon in KDE kicker. If the the startup class is the
> FMain form, Me.Hide or ME.Visible are unuseful. The Form is shown. 

Yes, this is the purpose of having a startup form: showing it automatically.

So having a startup module is not a workaround, it is the normal way for 
starting the application. :-)

Otherwise, to prevent a startup class from being shown, just override its 
Main() static method defined in the Form class.

STATIC PUBLIC SUB Main()

  ' Loads the hidden instance of FMain without showing it.
  FMain.Load

END

I will post a fix so that when the Visible property of the form is set to 
FALSE, the form is not shown at startup, but loaded. So the workaround above 
will not be needed anymore!

Regards,

-- 
Benoit Minisini




More information about the User mailing list