How to create a notification area balloon?

Forums for specific tips, techniques and example code
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

How to create a notification area balloon?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:56 pm

by Anonymous >> Fri, 1 Dec 2006 16:18:02 GMT

Hi,

Wondering if anyone had created a notification area (system tray) balloon from Jade? I can't find any documentation on the web that applies out of the context of VB.

Ideally, I need to be able to show and hide this myself and also receive some sort of callback when the user clicks on the balloon (I can see that all this is possible in VB.)

Thanks,

Rob

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: How to create a notification area balloon?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:56 pm

by Rob >> Tue, 5 Dec 2006 10:04:08 GMT

Further update:

After spending several hours looking at this I've found the following:

Call required is Shell32 Notify_IconA. It's not easy to use this as the call uses a struct which we have to emulate in a Binary, and we can't pass a pointer to the Binary from a presentationClient, so the purpose of what I want to do is defeated.

Also, the call requires a handle to the application icon, which Jade doesn't appear to be able to supply.

Finally, a PAR has been raised to put this functionality in Jade. It seems to me that using external calls like this is un-necessarily heavy work and this shouldn't really need a PAR. Could there be some sort of support for implementing external calls with structs?

Rob

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: How to create a notification area balloon?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:56 pm

by allistar >> Wed, 6 Dec 2006 3:07:54 GMT
Further update:

After spending several hours looking at this I've found the following:

Call required is Shell32 Notify_IconA. It's not easy to use this as the call uses a struct which we have to emulate in a Binary, and we can't pass a pointer to the Binary from a presentationClient, so the purpose of what I want to do is defeated.

Even if you define the external function as "presentationClientExecution"? I would expect Jade to marshall the binary data down to the thin client before calling the external function call. If not, you could write an external function call that takes the individual members of the struct as Strings and Integers, which then combine these into the struct (in C++) and calls the external function from there. Seems like overkill but it should work.
Also, the call requires a handle to the application icon, which Jade doesn't appear to be able to supply.

You should be able to enumerate the system tray icons and find the one that relates to your Jade process in an external function call in C++. It could be tricky associating the particular Jade process for a particular system tray icon if more than one Jade process is running on the workstation.

Take a look at this link for a starting point on doing this:

http://www.codeproject.com/tools/ShellTrayInfo.asp
Finally, a PAR has been raised to put this functionality in Jade. It seems to me that using external calls like this is un-necessarily heavy work and this shouldn't really need a PAR. Could there be some sort of support for implementing external calls with structs?

This could be simulated by defining a class that represents the struct (with properties relating to the struct members as appropriate) and an "output" or "serialise" method that returns a binary representation of the struct. You'd have to hand code the ordering (and sizes) of the struct members in this method.

Allistar.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: How to create a notification area balloon?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:56 pm

by Rob >> Thu, 14 Dec 2006 17:02:42 GMT

Allistar,

Thanks for your very helpful reply.

Best wishes.

Rob

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: How to create a notification area balloon?

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:57 pm

by Stephen Persson >> Mon, 22 Jan 2007 0:18:52 GMT

Sorry for the late reply, I don't know if you are still playing around with this.

We have built one into our app just using a standard Jade form. The trick is to set the border style to none, in painter then do the following before showing the form:

//Make sure the popup window is always on top
alwaysOnTop(true);

//Get the actual screensize so the popup will be displayed in the lower right corner
app.mGetScreenSize(h, w);
//then use this info to position the popup window

//Don't show the form in the taskbar
call setWindowLong(self.hwnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
//where the constants are GWL_EXSTYLE = -20; WS_EX_TOOLWINDOW = #80; //setWindowLong(hWnd , nIndex, dwNewLong : Integer) : Integer is SetWindowLongA in user32;


Where app.mGetScreenSize is:
mGetScreenSize(height, width : Integer output);
// Author : Stephen P
// Date Created : 08 August 2003
// Description :
// Returns :
// Modifications :
constants
SM_CXSCREEN = 0;
SM_CYSCREEN = 1;
SM_CXFULLSCREEN = 16;
SM_CYFULLSCREEN = 17;
vars
begin

width := call getSystemMetrics32(SM_CXSCREEN);
height := call getSystemMetrics32(SM_CYSCREEN); //getSystemMetrics32(index : Integer) : Integer is GetSystemMetrics in user32;
epilog

end;


We then have a method app.mShowPopUpMessage that we pass the title, text, the icons to use etc.. to. It is then on a timer to make the window fade up, then plays the alert sound we have.
We can also pass options to put control boxs, radio buttons, or text boxs onto the popup so you can prompt the user in the notification not just a message, but get a response to a question or prompt for text etc... We also pass a userObject to the form, so if the user clicks on the window, or clicks one of the radio button or check boxes, it can process the response according to the obect given, then closes the notification window.

Let me know if you need any further pointers.
Stephen


Return to “Tips and Techniques”

Who is online

Users browsing this forum: No registered users and 9 guests

cron