[Gambas-user] TrayIcon control

Toni arosa at ...2015...
Wed Dec 3 21:55:48 CET 2008


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 :(




More information about the User mailing list