Jump to content

GUI/Tray Menu with icons and colors


Holger
 Share

Recommended Posts

Update 28.07.2007

- Fixed: wrong call of function CreateFont()

- Changed: included samples to demonstrate using of icon clicks

Thanks to you SleepyExtreme, this was again a merging error (hopefully this was the last one) :)

Greets Holger

Edited by Holger
Link to comment
Share on other sites

new problem:

Func TrayedWindows($tID, $tMsg)
    for $x = 1 to $trayCounter
        $windowtitlefortray = IniRead(@ScriptDir & "\Emergency Windows.ini", "Open Window List", $x, "NotFound")
    Switch $tID     
        Case $nTrayIcon[$x]
            Switch $tMsg
                Case $WM_LBUTTONDOWN
                    WinSetState(HWnd($windowtitlefortray),"",@SW_SHOW)
                    WinActivate(HWnd($windowtitlefortray), "")
                    _TrayIconDelete($nTrayIcon[$x])
            EndSwitch
    EndSwitch
Next
EndFunc

Obfuscator screws this up so it doesn't work. I've narrowed the problem down to this section of my script.

Obfuscator says:

>### current Func: TrayNotifyIcon

ModernMenu.au3(316,1) Warning for line:Call($TRAYNOTIFYIDS[$nID][4], $nID, $lParam)

Edited by SleepyXtreme
Link to comment
Share on other sites

OK, but there is no problem in the line.

I can't see anything.

So it must be a problem of this 'Obfuscator' whoever it wrote.

I have no idea why it shows a warning for this line...

So long.

Holger

Link to comment
Share on other sites

Update 03.08.2007

- Fixed: error in _TrayIconDelete() and new icon creation

- Added: additional parameter to _TrayIconCreate(ToolTip, IconFile, IconID, Callback, Msg, hIcon) to use existing icon handles

I added also the sample_Win2Tray: 'moves' all minimized windows to the tray

Ok, there are maybe some better ways to do this and it's not really finished but maybe it will help you do to/understand some things :)

Please see the 1st post.

So long...

Holger

Link to comment
Share on other sites

Heh, you are really rolling with this lib - hope it'll be considered for inclusion in the AutoIt package once it has stabilized completely! :) Talking standards, I recently noticed that my accelerator keys in the menu's don't work any longer once they are owner drawn - would it be possible to rectify this?

Here's the an example line of how one could allow "1-9" to activate the various items in the menu once it has been opened:

_GUICtrlODMenuItemSetText($hOption, "&" & "1" & ". " & "Options")

The "&" item activates the accel.key behavior in the normal AutoIt menu (found out by accident, don't know whether it is mentioned in docs anywhere) but only underlines the item once the menu is drawn with "GUI/Tray Menu".

Regards,

Sunaj

Edit: typo

Update 03.08.2007

- Fixed: error in _TrayIconDelete() and new icon creation

- Added: additional parameter to _TrayIconCreate(ToolTip, IconFile, IconID, Callback, Msg, hIcon) to use existing icon handles

I added also the sample_Win2Tray: 'moves' all minimized windows to the tray

Ok, there are maybe some better ways to do this and it's not really finished but maybe it will help you do to/understand some things :P

Please see the 1st post.

So long...

Holger

Edited by Sunaj
Link to comment
Share on other sites

  • 2 weeks later...

Yeah, this is a missing feature.

Real accelarators are/were never buildin Autoit (I mean no HotKeys) so I also didn't check for them.

I will check the next days in my very old C++ source (which was a Test-Autoit) how I implemented the check for Tabs.

I think it will be just some StringSplit-ting, some modifications to the text width calculation and an additional DrawText() for the accel. string...

Greets

Holger

Link to comment
Share on other sites

  • 4 weeks later...

Can I use TrayItemDelete to remove a Menu Item that was created with _TrayCreateItem? Or is there a _TrayItemDelete?

By the way, Nice UDF, I dig it. I will even dig it more when I get my script migrated over to use it.

I put a sample/test below! Am I missing something? Im sure I am.

#NoTrayIcon
#Include <Constants.au3>
#include <GUIConstants.au3>
#include 'ModernMenu.au3'

Global $var1
Global $var2

$TrayIcon = _TrayIconCreate ("Test Tray Icon", "shell32.dll", 8)
_TrayItemSetIcon (-1, "shell32.dll", 8)

$TestMenu = _TrayCreateMenu (-1, "Test Menu")


$var1 = _TrayCreateItem (-1, 'This should be deleted!', $TestMenu, -1)
MsgBox(1024,"","")
TrayItemDelete($var1)
$var2 = _TrayCreateItem (-1, 'This should not be deleted!', $TestMenu, -1)
MsgBox(1024,"","")
TrayItemDelete($var2)
_TrayIconDelete ($TrayIcon)
Exit

GoogleDude?

Edited by GoogleDude
Link to comment
Share on other sites

  • 4 weeks later...

@Holger: How did you get those unicode characters in your tray menu screenshot?? (the first post here)

Edited by sandman

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Link to comment
Share on other sites

  • 2 months later...

Update 07.12.2007

- Fixed: now works with 3.2.10.0 and 3.2.8.1

- Changed: all stuff in only 1 ZIP file

Please see the 1st post for new file.

Greets

Holger

Thanks Holger;

Good to see you around again. I mean posting as Holger :)

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

  • 1 month later...

Hi Holger,

I have one small problem - it seems that we can not set text for menu item with tabs characters...

I would like to set an item to display hotkey at the right side of menu item, but tab is ignored:

_GUICtrlCreateODMenuitem("My Item " & @TAB & "(F1)", $Menu)

Is there any way to fix it?

Thanks.

 

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

Hi Holger,

I have one small problem - it seems that we can not set text for menu item with tabs characters...

I would like to set an item to display hotkey at the right side of menu item, but tab is ignored:

_GUICtrlCreateODMenuitem("My Item " & @TAB & "(F1)", $Menu)

Is there any way to fix it?

Thanks.

Have you tried

_GUICtrlCreateODMenuitem("My Item" & Chr(32) & Chr(9) & "(F1)", $Menu)

Not sure if tabs are even allowed on menu items but I would think they are.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Have you tried

No, thanks, but it's not working eather :P

Not sure if tabs are even allowed on menu items

Sure they do :) ... see this example:

#include <GuiConstants.au3>

$GUI = GUICreate("Test Script", 300, 200)

$Menu = GUICtrlCreateMenu("Menu")

GUICtrlCreateMenuItem("Menu Item 1" & @TAB & "(F1)", $Menu)
GUICtrlCreateMenuItem("Menu Item 2" & @TAB & "(F2)", $Menu)
GUICtrlCreateMenuItem("Menu Item 3" & @TAB & "(F3)", $Menu)
GUICtrlCreateMenuItem("Menu Item 4 with long text" & @TAB & "(F4)", $Menu)

GUISetState(@SW_SHOW, $GUI)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

As you can see, all hotkey values are tabbed (aligen) to the right, even if one text item is longer then the others.

I can not do the same with menu items in ModernMenu.au3 :blink:

 

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

Any one? :P

I guess it something inside the drawing item functions, but i have no idea where to look, they all connected, and there is so many of them :) ...

 

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 12.01.2008:

- Changed: 'local' Dll calls to global DllOpen to speedup (some virusscanners sometimes slowdown the process cause of opening these Dll's again and again)

- Added: Using of @Tab for accelerator showing/drawing

If there are any problems (cause maybe of the internal changes) just please let me know.

Greets

Holger

post-1133-1200095874_thumb.jpg

Link to comment
Share on other sites

Update 12.01.2008:

- Changed: 'local' Dll calls to global DllOpen to speedup (some virusscanners sometimes slowdown the process cause of opening these Dll's again and again)

- Added: Using of @Tab for accelerator showing/drawing

If there are any problems (cause maybe of the internal changes) just please let me know.

Greets

Holger

Nicely done Holger. I knew we could count on you. :D

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Holger

Thank you very much! it was quicker then i thouth it would :D

 

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

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...