[Gambas-user] TrayIcon control

Demosthenes Koptsis demosthenesk at ...626...
Thu Dec 4 12:14:24 CET 2008


i propose to hide or show the FMain form instead close it.

so this code may help you

PUBLIC SUB TrayIcon1_DblClick()

'when double click tray icon show or hide FMain
  IF FMain.Visible = TRUE THEN
    FMain.Visible = FALSE
  ELSE
    FMain.Visible = TRUE
  END IF

END

PUBLIC SUB btnHide_Click()

  ME.Hide()

END

PUBLIC SUB btnExit_Click()

  ME.Close()

END


On Wed, Dec 3, 2008 at 10:55 PM, Toni <arosa at ...2015...> wrote:
> Hi,
> I have created a new project "gb.gui" with two forms, "Fmain" (startup
> class) and "Form1".
>
> "Fmain" has a Button "ButtonExit" and one IconTray "TrayIcon1".
> What I am trying to accomplish is that the application can be only
> "exited" clicking on the button. When the form "Fmain" is Closed, it
> "places" it self into an Icontray.
> When "doubleclicking" on the "Icontray" it will show "Fmain" again.
> "Icontray1" has a "contextual menu" to show another form (Form1).
>
> Now, the steps to reproduce problems I mentioned in my prevoius mail:
> 1. Launch application, close Fmain. It "places" itself in the IconTray.
> 2. Then  select Icontray1 menu "Opt1" (it will "showmodal()" Form1)
> 3. Then "DoubleClick"  on Icontray1 again, it will show "Fmain".
> *First problem: Although the "showmodal()" has been called, Icontray1
> has still processed events and show "FMain"
> 4. "Click" on FMain ButtonExit
> *Second problem, clicking on "ButtonExit" will crash with signal #11.
>
>
>
> The Code in "Fmain"  is the following:
>
> PUBLIC Mnu AS menu
> PUBLIC Opt1 AS Menu
> PUBLIC Opt2 AS Menu
>
> PUBLIC SUB _new()
>  Mnu = NEW Menu(ME)
>  Mnu.Name = "Mnu"
>  Opt1 = NEW Menu(Mnu) AS "MenuTray"
>  Opt1.Name = "Opt1"
>  Opt1.Caption = "Opt1"
>  Opt1.Visible = TRUE
>  Opt2 = NEW Menu(Mnu) AS "MenuTray"
>  Opt2.Name = "Opt2"
>  Opt2.Caption = "Opt2"
>  Opt2.Visible = TRUE
>  ME.Persistent = TRUE
>  TrayIcon1.Visible = FALSE
> END
>
> PUBLIC SUB Form_Close()
>  ME.Visible = FALSE
>  ME.SkipTaskbar = TRUE
>  TrayIcon1.Visible = TRUE
> END
>
> PUBLIC SUB MenuTray_Click()
> DIM Frm AS NEW Form1
>  IF LAST.name = "Opt1" THEN
>    Frm.Showmodal()
>  ELSE
>    ButtonExit_Click()
>  ENDIF
> END
>
> PUBLIC SUB TrayIcon1_Menu()
>  Mnu.popup
> END
>
>
> PUBLIC SUB TrayIcon1_DblClick()
>  ME.Visible = TRUE
>  ME.SkipTaskbar = FALSE
>  TrayIcon1.Visible = FALSE
> END
>
> PUBLIC SUB ButtonExit_Click()
>    ME.Persistent = FALSE
>    ME.Close
> END
>
>
>
>
>
> Thanks!
>
> P.S. I have, yet, another problem related to Icontrays. I would like to
> use it as the "control" sended to "Ballon", so the "ballon" displays
> information pointing at it... but it doesn't compile arguing that it
> (ballon) expected a Control not an Icontray :(
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



-- 

Γεια χαρα σε όλους!!!

Regards,

Demosthenes Koptsis


More information about the User mailing list