Home » U++ Library support » TopWindow&PopUp, TrayIcon » runtime tray icon? Draw a number?
runtime tray icon? Draw a number? [message #8213] |
Tue, 20 February 2007 04:20  |
DrGary
Messages: 7 Registered: February 2007
|
Promising Member |
|
|
How can you create a tray icon at runtime? I would like to write/draw a number in the tray icon location. There was an example in the forum, but it is a year old and no longer works with the current version.
Would someone post a simple example program?
Thanks,
Gary
|
|
|
|
Re: runtime tray icon? Draw a number? [message #8230 is a reply to message #8224] |
Thu, 22 February 2007 07:01   |
DrGary
Messages: 7 Registered: February 2007
|
Promising Member |
|
|
Hey, that was pretty easy. It looks like a mask is necessary. Without the line that includes 'img.Alpha().DrawText()', only a black square appears. Is this correct?
--Gary
The code below is a modification of the TrayIcon sample.
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
struct App : TrayIcon {
Image icon1;
void drawImage(String str) {
ImageDraw img(16, 16);
img.Alpha().DrawText(0, 0, str, Arial(14), GrayColor(255));
img.DrawText(0, 0, str, Arial(14), Blue());
Icon(img);
}
void Info() {
drawImage("11");
PromptOK("TrayIcon launched this prompt!");
drawImage("ab");
}
virtual void Menu(Bar& bar) {
bar.Add("Info..", THISBACK(Info));
bar.Separator();
bar.Add("Exit", THISBACK(Break));
}
typedef App CLASSNAME;
App() {
WhenBar = THISBACK(Menu);
WhenLeftDouble = THISBACK(Info);
Tip("This is U++ tray icon");
drawImage("56");
}
};
GUI_APP_MAIN
{
App().Run();
}
|
|
|
|
Goto Forum:
Current Time: Fri Apr 25 19:08:17 CEST 2025
Total time taken to generate the page: 0.00458 seconds
|