Jump to content

GUI/Tray Menu with icons and colors


Holger
 Share

Recommended Posts

Update 23./24.02.2008

- Fixed: GDI object overload when bold font is used

Everyone who is using a "Default" menu item (state: $GUI_DEFBUTTON - which is drawn with bold font) should update!

Greets

Holger

Edited by Holger
Link to comment
Share on other sites

Update 23./24.02.2008

- Fixed: GDI object overload when bold font is used

Everyone who is using a "Default" menu item (state: $GUI_DEFBUTTON - which is drawn with bold font) should update!

Greets

Holger

Sweet, thanks for these great function... I'm planning on updating Multiple Desktops to have a menu using this...
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

After using AutoIt 3.2.11.0 I'm getting tons of errors... Lots more errors with previously declared constants and undefined @unicode macro.

Edit: Also, could this work with on event some how? I tried TrayItemSetOnEvent just in case, but as I expected it didn't work.

Edited by Achilles
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

Edit: Also, could this work with on event some how? I tried TrayItemSetOnEvent just in case, but as I expected it didn't work.

I feel your pain. I have a lot of Tray and GUI based Scripts that are based on EventMode and thus far I had to re-write a lot of code to get it to work with the icons and images.

But nice UDF none-the-less.

GoogleDude

Link to comment
Share on other sites

Ok, one more time: the whole thing uses the GUI message procedure so if you want to use any commands for the items you have to use the GUI commands.

So, use GUICtrlSetOnEvent here.

With the next changes I will also include a "GUIOnEvent"-sample too.

For the @Unicode problem you could try something like:

If @AutoitVersion <= "3.2.10.0" Then
    $bUnicode = @Unicode
Else
    $bUnicode = @AutoItUnicode
EndIf

Just insert it at the beginning of the "ModernMenu(Raw).au3" and replace all other "@Unicode" with "$bUnicode".

However, the au3check will fail of the unknown macro.

Just ignore that messages.

Greets

Holger

Edited by Holger
Link to comment
Share on other sites

  • 2 weeks later...

This is a great script and I'm still playing with and learning from it.

Are there any plans to include more than the two states available in "_TrayIconSetState()"?

"TraySetState" has five possible states including show, hide, flash, stop flashing and reset; will these be incorporated here? Or am I completely off?

What I am trying to do is test a condition that when false will cause the tray icon to flash until the condition tests true. Right now I am just cycling between the icon set in "_TrayIconCreate()" and an icon that is completely transparent set with "_TrayIconSetIcon()".

"_TrayIconSetState($nTrayIcon1, 2)" creates a hole in the tray while the transparent one leaves an empty space.

Is there is an easier way to accomplish this?

Thank you.

Link to comment
Share on other sites

Are there any plans to include more than the two states available in "_TrayIconSetState()"?

"TraySetState" has five possible states including show, hide, flash, stop flashing and reset; will these be incorporated here? Or am I completely off?

I like that Idea. I second that! (Kinda wish I had the AutoIt Skills to make those types of changes myself).

GoogleDude

Link to comment
Share on other sites

I program PLC's and other types of industrial controls for a living so I'm kind of like the fat kid thrashing around in the deep end here; please forgive my ignorance. I really don't do Windows either so this has been both fun and painful; kind of like getting a lap dance from a 300 pound stripper.

The NotifyIconData structure is used to pass pointers to the Shell_NotifyIcon function in Shell32.dll. $NIM_MODIFY, $NIM_ADD and $NIM_DELETE already exist but you have only defined $NIM_ADD = 1 and $NIM_DELETE = 2. Is this correct?

I am trying to understand this so I can learn from it. I have been playing with this for days now and have been able to absorb quite a bit more than when I first started.

As I had mentioned in a previous post, I am able to cycle a transparent icon with the default icon to simulate the icon flashing. Is this really all that $NIM_MODIFY would potentially do or is there more that I am missing?

Thank you for your efforts.

Link to comment
Share on other sites

Hi outthere :)

here is my script-stuff to create ownerdrawn menuitems with icons and colors.

It uses GUIRegisterMsg() and WM_DRAWITEM / WM_MEASUREITEM - messages proceeding.

Feel free to read/modify/delete it :)

Hi, Holger. Your script have some bugs:

1) The array $arMenuItems is constantly grown up. ie if I will dinamic create several Trays (or menu and so on) programm will crash because limit of items is equal 4000

2) The array $arMenuItems is constantly grown up, and he is don't clean up then if I in the beginning is create some tray and then destroy them, and again I is create tray like first he will not wokring.

3) And in the end this MODERN MENU is good thing, but this is not good work with dinamic trays. In this case raise some bugs in addition to 1 and 2 point, which I didn't determine for the present/

Link to comment
Share on other sites

The array $arMenuItems is constantly grown up

Nope, the last version (and all the previouse if i am not wrong) have predefined the size of items array:

; Store here the ID/Text/IconIndex/ParentMenu/Tray/SelIconIndex
Global $arMenuItems[4000][7]
$arMenuItems[0][0] = 0

programm will crash because limit of items is equal 4000

It crashes because the array have reached the created number of elements. You could create a dinamycaly array, as i did in the GetFolderToMenu UDF.

and he is don't clean up then if I in the beginning is create some tray and then destroy them, and again I is create tray like first he will not wokring.

I think for that purposes there is need to set the main array ($arMenuItems) dynamicly, and create a functions like _TrayDeleteMenu(), _TrayDeleteItem(), _GUICtrlDeleteODMenu(), _GUICtrlDeleteODMenuItem() - in those functions ReDim the array as needed (searching thru array for needed id/handle)...

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Already in progress...

(even how can someone has so much items in a _menu_, I understand for _some_ dynamics ie. recent files or something but for a normal menu...how knows... :) )

Holger

Link to comment
Share on other sites

Nope, the last version (and all the previouse if i am not wrong) have predefined the size of items array:

; Store here the ID/Text/IconIndex/ParentMenu/Tray/SelIconIndex
Global $arMenuItems[4000][7]
$arMenuItems[0][0] = 0
Yes. I will a few not accurately, I mean counter of items in this array grown up and never grown down or clear array or rebuild array. This fact will raise crash.

I think for that purposes there is need to set the main array ($arMenuItems) dynamicly, and create a functions like _TrayDeleteMenu(), _TrayDeleteItem(), _GUICtrlDeleteODMenu(), _GUICtrlDeleteODMenuItem() - in those functions ReDim the array as needed (searching thru array for needed id/handle)...

Again You read my mind.

Or in other side, searching items in array from end of array instead of searching from begin.

I describe situation in which program will crash, and for present moment I don't know where is bug. I can only exactly say what bug placed not in my script.

My program dinamicaly create "Trays". At first, tray all looks good and work with no problem.

Secondly, visual can be damaged, I add script which clear $arMenuItems and solve this problem. But some buttons can work and some can raise crash. Why?

Link to comment
Share on other sites

Already in progress...

Good news Holger!

searching items in array from end of array instead of searching from begin.

I don't think there is a different, any way the array must be changed if the id/handle is found.

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Update: 21.03.2008

- Changed: dynamic array sizing of the saved menu items

- Added: _TrayDeleteItem(menuID), _GUICtrlODMenuItemDelete($nID) - please delete (tray) menu (items) with these commands

- Added: _TrayIconSetState() modes 4 and 8 for flashing and flashstopping of tray icons

- Added: _SetFlashTimeOut([timeOut]) to set the flash timeout

- Added: OnEvent sample

Please let me know about problems and suggestions.

Greets :)

Holger

Link to comment
Share on other sites

Good news Holger!

I don't think there is a different, any way the array must be changed if the id/handle is found.

It's a big difference. Items having similar id are stored periodically, but have different order number. Search finds the first coincidence of id in array, but real id is stored much long away in this array.

If search begins from the end then will find real id.

Link to comment
Share on other sites

Update: 21.03.2008

- Changed: dynamic array sizing of the saved menu items

- Added: _TrayDeleteItem(menuID), _GUICtrlODMenuItemDelete($nID) - please delete (tray) menu (items) with these commands

- Added: _TrayIconSetState() modes 4 and 8 for flashing and flashstopping of tray icons

- Added: _SetFlashTimeOut([timeOut]) to set the flash timeout

- Added: OnEvent sample

Please let me know about problems and suggestions.

Greets :)

Holger

That's good news.

I will try these changes.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...