Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Wed Dec 11, 2019 11:07 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 15 posts ] 
Author Message
 Post subject: WindowsSystemTrayMBS question
PostPosted: Fri Feb 26, 2010 7:42 am 
Offline

Joined: Sat Sep 26, 2009 8:58 pm
Posts: 13
Location: Boston
I've looked the the example code, and it runs fine. However, when I place the following code in
my applications window open event, I never get a system tray icon to appear. Note "SystemTray" is a class that
inherits from WindowsSystemTrayMBS.

....Window.Open() has...

e=new SystemTray
e.ID=12345678
e.Tooltip="Tool tip"
e.BalloonText="Balloon text"
e.BalloonTitle="Balloon title"
e.BalloonMode=0
Dim IconFile as FolderItem
IconFile=GetFolderItem("myicon.ico")
call e.SetIconFile (IconFile,1)
call e.InstallEvent self

Am I missing something?

_________________
---
ChannelBrain
http://www.channelbrain.com


Top
 Profile  
Reply with quote  
 Post subject: Re: WindowsSystemTrayMBS question
PostPosted: Fri Feb 26, 2010 8:05 am 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
is e a local variable or some window property so the object lives long enough?

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: WindowsSystemTrayMBS question
PostPosted: Fri Feb 26, 2010 1:53 pm 
Offline

Joined: Sat Sep 26, 2009 8:58 pm
Posts: 13
Location: Boston
Christian,

Yes, "e" is a property.

Gary

_________________
---
ChannelBrain
http://www.channelbrain.com


Top
 Profile  
Reply with quote  
 Post subject: Re: WindowsSystemTrayMBS question
PostPosted: Fri Feb 26, 2010 2:08 pm 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
Well, compare your code to the example. Something is missing.
Did you copy more code?

Do you call the Add function?

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: WindowsSystemTrayMBS question
PostPosted: Fri Feb 26, 2010 3:01 pm 
Offline

Joined: Sat Sep 26, 2009 8:58 pm
Posts: 13
Location: Boston
I don't call the add function, no... I'll check the example out and report back.

Thanks,
Gary

_________________
---
ChannelBrain
http://www.channelbrain.com


Top
 Profile  
Reply with quote  
 Post subject: Re: WindowsSystemTrayMBS question
PostPosted: Wed Sep 15, 2010 11:18 am 
Offline

Joined: Sat Aug 04, 2007 11:41 am
Posts: 212
I have my SystemTray icon working well, but I am not sure how I could set it up so the user can easily close my program.
My program is not running a GUI, so I just need to figure out that they've either clicked on the SystemTray icon, or double clicked on it, or right clicked, doesn't matter as long as I can trap one of them and close my app when I can.

Thanks,
Alan


Top
 Profile  
Reply with quote  
 Post subject: Re: WindowsSystemTrayMBS question
PostPosted: Wed Sep 15, 2010 11:23 am 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
Create a subclass of WindowsSystemTrayMBS and fill code in the events.

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: WindowsSystemTrayMBS question
PostPosted: Wed Sep 15, 2010 11:41 am 
Offline

Joined: Sat Aug 04, 2007 11:41 am
Posts: 212
Christian,
Thanks, I will give it a try.
Alan


Top
 Profile  
Reply with quote  
 Post subject: Re: WindowsSystemTrayMBS question
PostPosted: Wed Sep 15, 2010 12:11 pm 
Offline

Joined: Sat Aug 04, 2007 11:41 am
Posts: 212
I think I have it subclassed it, called it MyWindowsSystemTray, and I can see the Event Handlers, but if I put say a Msgbox in the BalloonUserClick for the RightButtonDoubleClick, it never fires. It's probably something very stupid that I'm doing wrong.


Top
 Profile  
Reply with quote  
 Post subject: Re: WindowsSystemTrayMBS question
PostPosted: Wed Sep 15, 2010 12:39 pm 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
Did you call InstallEvent?
I think BalloonUserClick is only working if you have a balloon visible.

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: WindowsSystemTrayMBS question
PostPosted: Wed Sep 15, 2010 12:49 pm 
Offline

Joined: Sat Aug 04, 2007 11:41 am
Posts: 212
This is part of the code that I'm using.
e=new MyWindowsSystemtray
e.ID=12345678
e.Tooltip="Initialize"
e.BalloonMode=0
col=rgb(255,0,0)
UpdateStopLight

call e.InstallEvent self

if not e.add then
MsgBox ("error creating button")
quit
end if


UpdateStopLIght does this:
dim p,m as picture

const w=16
const h=16

p=newpicture(w,h,32)
m=newpicture(w,h,32)

p.graphics.foreColor=col
p.graphics.filloval 0,0,w,h

m.graphics.foreColor=&c00000
m.graphics.fillrect 0,0,w,h
m.graphics.foreColor=&cFFFFFF
m.graphics.filloval 0,0,w,h

call e.SetIconPicture(p,m)



if e.modify then
end if


I don't have a clue why I have the if e.modify then end if statement in there, but it's there.
Most of this code was taken from whatever I could find and it does work for what I am trying to do.
and yes 'e' is a property


Top
 Profile  
Reply with quote  
 Post subject: Re: WindowsSystemTrayMBS question
PostPosted: Wed Sep 15, 2010 1:19 pm 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
Did you try the Windows System Tray example project?

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: WindowsSystemTrayMBS question
PostPosted: Wed Sep 15, 2010 1:37 pm 
Offline

Joined: Sat Aug 04, 2007 11:41 am
Posts: 212
I thought that's where this code came from, but I played with it back a year ago, so I'm not sure.

I will take a look tonight and see if it helps.

Thanks


Top
 Profile  
Reply with quote  
 Post subject: Re: WindowsSystemTrayMBS question
PostPosted: Wed Sep 15, 2010 2:23 pm 
Offline

Joined: Sat Aug 04, 2007 11:41 am
Posts: 212
Christian,
I might have an idea of what's happening. I have gone thru the example, and I'm basically doing the same thing except...


I look at a database, then make the icon be green, yellow or red depending on the data I see.
I then sleep 60 seconds using DelayMBS but since the docs say that the application stops for that period of time, I suspect the app never sees my clicks on the SystemTray.

Is there a better way to do this, that won't use CPU time, but will wait for 60 seconds, then continue?

Thanks


Top
 Profile  
Reply with quote  
 Post subject: Re: WindowsSystemTrayMBS question
PostPosted: Thu Sep 16, 2010 8:58 am 
Offline

Joined: Sat Aug 04, 2007 11:41 am
Posts: 212
I am going to change over and use a Timer. I think that should work okay.
Alan


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group