Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-04-2007, 12:10 PM
Member
 
Join Date: May 2007
Posts: 53
Default Can't create proper tray menu

Hello!
I'm trying to create a tray icon menu.
Code:
Application.SysTray.useDefaultHandler = false;
Menu.onCommand = function(id) {
trace('COMMAND' + id);
}
Application.SysTray.onRClicked = function () {
  trayMenu = new Menu;
  trayMenu.createPopupMenu();
  if(isWinMinimized) { trayMenu.appendItem("id0", "Show); }
  else { trayMenu.appendItem("id0", "Hide"); }
  //trayMenu.appendItem();
  trayMenu.appendItem("id1", "Exit");
  trayMenu.setMenu(); 
   trayMenu.show();
}
1. Created menu looks like ~100px*2px line
2. Line trayMenu.appendItem() makes it ~800px*2px
3. I can't make onRClicked handler work in any case
4. I can't get rid of free space, intended for tray menu icons..

What am i doing wrong?
__________________
#define true false //happy debugging, friends
Reply With Quote
  #2 (permalink)  
Old 06-04-2007, 12:31 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Can't create proper tray menu

Code:
Application.SysTray.useDefaultHandler = false;
// this event will only be fired by the main menu
Menu.onCommand = function(id) {
   trace('COMMAND' + id);
}
Application.SysTray.onRClicked = function () {
  trayMenu = new Menu;
  trayMenu.createPopupMenu();
  if(getMainWnd().windowState == "minimized") { 
  trayMenu.appendItem("id0", "Show"); 
  }
  else { 
  trayMenu.appendItem("id0", "Hide"); 
  }
  
  trayMenu.appendItem();
  trayMenu.appendItem("id1", "Exit");
  // don't call setMenu, which set the main menu of the program
  //trayMenu.setMenu();
  getMainWnd().bringToTop();
  // the show method returns the command you have selected
  var command = trayMenu.show();
  if (command == "id0") {
  if (getMainWnd().windowState == "minimized") {
  getMainWnd().windowState = "normal";
  } else {
  getMainWnd().windowState = "minimized";
  }
  } else if (command == "id1") {
  getMainWnd().close();
  }
}
Reply With Quote
  #3 (permalink)  
Old 06-04-2007, 01:11 PM
Member
 
Join Date: May 2007
Posts: 53
Default Re:Can't create proper tray menu

Thank for the quick answer!
1 problem left: I can't get rid of free space, intended for tray menu icons (in the left part of menu items).
__________________
#define true false //happy debugging, friends
Reply With Quote
  #4 (permalink)  
Old 06-04-2007, 01:34 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Can't create proper tray menu

No, the space cannot be removed. That is the way that swfkit draws menu items.
Reply With Quote
  #5 (permalink)  
Old 06-19-2007, 10:04 AM
Member
 
Join Date: May 2007
Posts: 53
Default Re:Can't create proper tray menu

Also, i can't find how to add an icon to a simple tray item.
Menu.appendItem(submenu, name) have no such a parameter.
Is there a way?
__________________
#define true false //happy debugging, friends
Reply With Quote
  #6 (permalink)  
Old 06-19-2007, 12:40 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Can't create proper tray menu

Yes, you can add icons to the left of the menu items.
Code:
// absolute icon path name
trayMenu.appendItem("id0", "Show", "c:\\myshow.ico");
or

Code:
//"myshow.ico" must have been added into the "Resource" list
trayMenu.appendItem("id0", "Show", "myshow.ico");
Reply With Quote
  #7 (permalink)  
Old 06-19-2007, 01:40 PM
Member
 
Join Date: May 2007
Posts: 53
Default Re:Can't create proper tray menu

Hmmm. The icon is not shown, even if i add it to my resource list.
The code:
Code:
Application.SysTray.onRClicked = function () {
  trayMenu = new Menu;
  trayMenu.createPopupMenu();
  trace(fileExists("c:\\JavaCup.ico"));
  trace(trayMenu.appendItem("id1", "SomeItem", "c:\\JavaCup.ico"));
  getMainWnd().bringToTop();
  
  var command = trayMenu.show();
  if(command == "id1") {
     getMainWnd().close();
  }
}
__________________
#define true false //happy debugging, friends
Reply With Quote
  #8 (permalink)  
Old 06-19-2007, 02:18 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Can't create proper tray menu

Please use relative path name if you have added the ico file into the "Resources" list. For example
Code:
trayMenu.appendItem("id1", "SomeItem", "JavaCup.ico")
Reply With Quote
  #9 (permalink)  
Old 06-19-2007, 02:29 PM
Member
 
Join Date: May 2007
Posts: 53
Default Re:Can't create proper tray menu

I've understood -)
It was sample for working with downloaded icons.
I can't make it work anyway.
Maybe swfkit version matter? I use swfkit pro 3.0.
__________________
#define true false //happy debugging, friends
Reply With Quote
  #10 (permalink)  
Old 06-19-2007, 06:13 PM
Member
 
Join Date: May 2007
Posts: 53
Default Re:Can't create proper tray menu

i've found. It was necessary to use getAdditionalFile("JavaCup.ico").
But nothing can force menuItem to use external icons..
Anyone tried to do this, except me ?
__________________
#define true false //happy debugging, friends
Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 04:21 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.