BugFix Posted July 11, 2012 Share Posted July 11, 2012 (edited) With this UDF you can create own context menus with following features:- Show menu only, if an condition is TRUE (ie: number of entries in an listview must be greater than zero)- Item types: Label, Checkbox, Radio, Image (jpg,bmp,gif), Icon (from Icon file, DLL), Shape --- Image files should be (nearly) quadratic. It is scaled to 16 x 16 pixel.- The menu width is selectable. (Default 200 px)- Left margin for general and additional for each menu item can be set (Indents are thus possible)- The Items are default controls. You can Disable/Enable them, change text color, set state. But don't change background color. The background color is changed when the mouse is over the entry.- If you like an other hover color, you can change it during the menu creation. Or later with an own function.Edit:Now I've made some changes:- more speed during hover (decrease adlib time from 50 to 10 ms)- if menu is shown and you click with right: on menu - nothing happens, outside menu - menu will closed- renamed functions to _GUICtrlOwnContext_...- used funkeys tip for Bkcolor- In my Win 7 the hover color is clearly to see. If you've a problem with this, change color during creation of menu or general with changing the declaration:Global $__iMNU_DEF_HOVERCOLOR = 0xEFFFFFEdit 2:- Added: For each entry you can create an submenu (1 level depth). Important: First, create all entries to the menu. Only then can sub-menus and their entries are created. See the example.- Changed:Now the entire area of the entry is detected as an control. Also used Images.- Changed: No more Adlib function, all processing inside window- and mouse- procedures.- New Example for v0.9 (dont works with older version)Current version: v0.9So it looks:v0.8v0.9OwnContext.au3OwnContext_Example.au3OwnContext0.9.au3OwnContext_Example0.9.au3 Edited July 15, 2012 by BugFix funkey, qsek and UEZ 3 Best Regards BugFix Link to comment Share on other sites More sharing options...
funkey Posted July 11, 2012 Share Posted July 11, 2012 Very nice! Thanks for sharing. I will have use for it! But there are a few things I have to say: # MenuEx sounds like beeing an extension UDF of the original control. I would call it OwnMenu or GuiMenu or something, but that's just my opinion. # On my Win7 the hover color is hard to see (nearly the same than the background color). # And on my WinXP the color after control is hovered is wrong. I would change this line in __IsHover() If $iID_LastOver <> 0 Then GUICtrlSetBkColor($iID_LastOver, 0x0F0F0F0) to If $iID_LastOver <> 0 Then GUICtrlSetBkColor($iID_LastOver, $GUI_BKCOLOR_TRANSPARENT) Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
MrCreatoR Posted July 11, 2012 Share Posted July 11, 2012 Very nice concept. But there is a few problems that i have notice at the beginning: * The hover is slow. * If you right click on the gui after menu is shown, the menu is still there and hovering does not working. Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: 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 ProgramUDFs: 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 Examples: 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 ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
BugFix Posted July 11, 2012 Author Share Posted July 11, 2012 Thanks for testing and your replys. @funkey I'll change it with next version. (both points) @MrCreatoR * The hover is slow. I'll decrease the Adlib-time to 10 ms. Than it should be fast enough. (atm i use 50 ms) * If you right click on the gui after menu is shown, the menu is still there and hovering does not working. I've never used right click if the menu is shown. So i have not seen this behavior. Thanks, that you've found this bug. I'll fix this with next version. Best Regards BugFix Link to comment Share on other sites More sharing options...
BugFix Posted July 11, 2012 Author Share Posted July 11, 2012 I've now taken your advices. See changes in my first post. Best Regards BugFix Link to comment Share on other sites More sharing options...
UEZ Posted July 11, 2012 Share Posted July 11, 2012 You changed the name of your UDF - example is not working! Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
BugFix Posted July 11, 2012 Author Share Posted July 11, 2012 Oops The Include must be renamed, have changed it in example now. Thanks for your report. Best Regards BugFix Link to comment Share on other sites More sharing options...
BugFix Posted July 15, 2012 Author Share Posted July 15, 2012 New Version v0.9 Creating submenu is possible. See post #1 Best Regards BugFix Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now