Print Page | Close Window

TrayIcon Control

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=13639
Printed Date: 22 November 2024 at 6:58pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: TrayIcon Control
Posted By: Auge_Ohr
Subject: TrayIcon Control
Date Posted: 10 March 2009 at 11:38pm
hi,

i got it working,but

if i "MaximizeFromTray" the Icon is still in Tray.
how can i "hide" Icon in Tray when "maximized" ?

btw. Property Icon :
a.) without it nothing works
b.) "as Picture" meen Bitmap while i can not got ICO to work !

"Popup menu" are not include, right ? ... but how to "close" TrayIcon without Menu ?
"Click" and "DblClick" are not usefull to "close" but i can use "DblClick" to "MaximizeFromTray"

ShowBalloonTip will "popup" Ballon.
is there any Way to show it when "hover" the Icon(Bitmap) in Tray ?

thx for Advice

-------------
greetings by OHR
Jimmy



Replies:
Posted By: Aaron
Date Posted: 16 March 2009 at 8:06am
Hi,
 
I think you don't use it as should...
 
Question:
if i "MaximizeFromTray" the Icon is still in Tray.
how can i "hide" Icon in Tray when "maximized" ?
Answer:
TrayIcon is showed when application has been started. It will be there all the time until you end it. Try with Windows TaskManager you will see same thing.   
 
Question:
btw. Property Icon :
a.) without it nothing works
b.) "as Picture" meen Bitmap while i can not got ICO to work !
Answer:
  • a) Of course it doesn't work. If no icon is assigned what is purpose of TrayIcon control?
  • If you want application icon use: wndTrayIcon.Icon = Me.Icon (= icon in form caption)  
Question:
"Popup menu" are not include, right ? ... but how to "close" TrayIcon without Menu ?
"Click" and "DblClick" are not usefull to "close" but i can use "DblClick" to "MaximizeFromTray"
Answer:
You have to build your own popup menu
 
Question:
ShowBalloonTip will "popup" Ballon.
is there any Way to show it when "hover" the Icon(Bitmap) in Tray ?
Answer:
There's no event MouseMove, so you can't... Or you have to create you own code to do this.
 
 
I created a test project so you can see what is possible with above...
 
 
https://forum.codejock.com/uploads/20090316_080841_TestTrayIcon.zip - uploads/20090316_080841_TestTrayIcon.zip
 
 


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....


Posted By: Auge_Ohr
Date Posted: 16 March 2009 at 10:39pm
Hi,

Originally posted by Aaron Aaron wrote:


I think you don't use it as should...
Question:
if i "MaximizeFromTray" the Icon is still in Tray.
how can i "hide" Icon in Tray when "maximized" ?
Answer:
TrayIcon is showed when application has been started.
It will be there all the time until you end it.
Try with Windows TaskManager you will see same thing.   

Yes most Application work this Way ... but not all.
"Total Commander" or ASUS Probe does "remove" Icon
from Tray when "maximize" ...

i just want to ask if it is possible ...

Originally posted by Aaron Aaron wrote:


Question:
btw. Property Icon :
a.) without it nothing works
b.) "as Picture" meen Bitmap while i can not got ICO to work !
Answer:
  • a) Of course it doesn't work. If no icon is assigned what is purpose of TrayIcon control?
  • If you want application icon use: wndTrayIcon.Icon = Me.Icon (= icon in form caption) 
ok understand
Originally posted by Aaron Aaron wrote:


Question:
"Popup menu" are not include, right ? ... but how to "close" TrayIcon without Menu ?
"Click" and "DblClick" are not usefull to "close" but i can use "DblClick" to "MaximizeFromTray"
Answer:
You have to build your own popup menu

see Answer about Sample

Originally posted by Aaron Aaron wrote:


Question:
ShowBalloonTip will "popup" Ballon.
is there any Way to show it when "hover" the Icon(Bitmap) in Tray ?
Answer:
There's no event MouseMove, so you can't...
Or you have to create you own code to do this.

hm ... perhaps my Question is wrong. when i "hover" a Trayicon
i will get some Tooltip ... how to get a Tooltip ?

is Tooltip the same as ShowBalloonTip ?

Originally posted by Aaron Aaron wrote:


I created a test project so you can see what is possible with above...
https://forum.codejock.com/uploads/20090316_080841_TestTrayIcon.zip - uploads/20090316_080841_TestTrayIcon.zip

THX, now i "see" what you do.

in Xbase++ we have :lbdown and :rbdown Callback slot.

Codejock does "fire" MouseDown(Button, Shift, x , y )
but i have to create my Methode to react on Parameter :

if Button = vbRightButton

ok, got it


-------------
greetings by OHR
Jimmy


Posted By: Aaron
Date Posted: 17 March 2009 at 1:49am
Hi,
 
Question:
Yes most Application work this Way ... but not all.
"Total Commander" or ASUS Probe does "remove" Icon
from Tray when "maximize" ...

i just want to ask if it is possible ...
 
Answer:
If you maximize from tray you could set icon: wndTrayIcon.Icon = nothing (remove icon of TrayControl)
If form is minimized: wndTrayIcon.Icon = Me.Icon
 
Question:
hm ... perhaps my Question is wrong. when i "hover" a Trayicon
i will get some Tooltip ... how to get a Tooltip ?

is Tooltip the same as ShowBalloonTip ?
 
Answer:
These are 2 different things, see testproject
 
Used on startup:                         wndTrayIcon.ShowBalloonTip 2, "Application.....", "Right click for options", 4
Tooltip when hovering trayicon:  wndTrayIcon.Text = Me.Caption
 
 
 
Hope it helps...  
 
 
 
 
 


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....


Posted By: Auge_Ohr
Date Posted: 20 March 2009 at 5:44am
Hi,
Originally posted by Aaron Aaron wrote:

Answer:
If you maximize from tray you could set icon: wndTrayIcon.Icon = nothing (remove icon of TrayControl)
If form is minimized: wndTrayIcon.Icon = Me.Icon

YES that it !
Originally posted by Aaron Aaron wrote:


Answer:
These are 2 different things, see testproject
Used on startup:                         wndTrayIcon.ShowBalloonTip 2, "Application.....", "Right click for options", 4
Tooltip when hovering trayicon:  wndTrayIcon.Text = Me.Caption
Hope it helps...  
now i got it, they are different !
Text Property is "myTooltip" and Method ShowBalloonTip() can show me a Ballon ...
but it was "turn off" by "Anti-Spy" so i can not see a Ballon

ok next Question : when used MouseDown Event and icon is i Tray it become some negative Value for "Y"
i can use ABS(Y) when Taskbar are "left","right" and "Bottom" but what about have on "Top" ?

is TrayIcon MouseDown Event when right-click on Icon "in" Tray the Positon "in Tray" ?
to calculate "absolute" Position i need to know who is the Parent of TrayIcon "in" Tray ?

while Tray is part of Taskbar i try this
Quote
FUNCTION TaskPosition()
LOCAL TrayWindow
LOCAL sAppBarMessage
LOCAL rc, cRet
LOCAL nIndex, nEdge, sRect
LOCAL nLeft   := 0
LOCAL nTop    := 0
LOCAL nRight  := 0
LOCAL nBottom := 0

   // Fensterhandle des Taskbar holen
   TrayWindow := FindWindowA('Shell_traywnd',0)

   // Position und Koordinaten ermitteln
   sAppBarMessage := U2Bin(36) + L2Bin(TrayWindow) + replicate( U2Bin(0), 7 )
   rc := SHAppBarMessage( ABM_GETTASKBARPOS, @sAppBarMessage )

   nIndex := 13
   nEdge := Bin2U( substr(sAppBarMessage, nIndex, 4) ) ; nIndex += 4
   sRect := substr( sAppBarMessage, nIndex, 16 )

   DO CASE
      CASE nEdge == ABE_LEFT   ; cRet := "LEFT"
      CASE nEdge == ABE_TOP    ; cRet := "TOP"
      CASE nEdge == ABE_RIGHT  ; cRet := "RIGHT"
      CASE nEdge == ABE_BOTTOM ; cRet := "BOTTOM"
   OTHERWISE
      cRet := "Error "+STR(nEdge)
   ENDCASE

   IF "Error" $ cRet
   ELSE

      nIndex  := 1
      nLeft   := Bin2L( substr(sRect, nIndex, 4) ) ; nIndex += 4
      nTop    := Bin2L( substr(sRect, nIndex, 4) ) ; nIndex += 4
      nRight  := Bin2L( substr(sRect, nIndex, 4) ) ; nIndex += 4
      nBottom := Bin2L( substr(sRect, nIndex, 4) ) ; nIndex += 4

   ENDIF

RETURN {cRet,{nLeft, nTop, nRight, nBottom} }
can TrayIcon MouseDown Event take care of Position of Taskrbar please.



-------------
greetings by OHR
Jimmy


Posted By: Aaron
Date Posted: 20 March 2009 at 10:04am
Hi,
 
I didn't get any negative values when taskbar was moved (l,t,r,b)
 
Looks like x and y value (in MouseDown event) is position in screen.
 
Why do you want these coordinates anyway?
 
 


-------------
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net