rexx Posted October 18, 2009 Posted October 18, 2009 I use _GUICtrlMenu_SetItemBmp() to set an icon to my menu item. In vista, all works good, but in xp, i works but looks not so good. Here's a screenshot. The left one is au3, and the right one is ahk_L (a mod of ahk). In the au3 one, there's no margin between icon and text. And the highlighted item's icon is also highlighted. But I prefer something like the ahk one. Is there any way to do so? Thanks!
rexx Posted October 21, 2009 Author Posted October 21, 2009 Can you post the code of the menu? Just run the example script in UDF help file and you can see the same problem. expandcollapse popup#include <GuiMenu.au3> #include <GuiConstantsEx.au3> #include <WinAPI.au3> Opt('MustDeclareVars', 1) Global $iMemo _Main() Func _Main() Local $hGUI, $hFile, $hEdit, $hHelp, $hMain Local Enum $idNew = 1000, $idOpen, $idSave, $idExit, $idCut, $idCopy, $idPaste, $idAbout ; Create GUI $hGUI = GUICreate("Menu", 400, 300) ; Create File menu $hFile = _GUICtrlMenu_CreateMenu () _GUICtrlMenu_InsertMenuItem ($hFile, 0, "&New", $idNew) _GUICtrlMenu_InsertMenuItem ($hFile, 1, "&Open", $idOpen) _GUICtrlMenu_InsertMenuItem ($hFile, 2, "&Save", $idSave) _GUICtrlMenu_InsertMenuItem ($hFile, 3, "", 0) _GUICtrlMenu_InsertMenuItem ($hFile, 4, "E&xit", $idExit) ; Create Edit menu $hEdit = _GUICtrlMenu_CreateMenu () _GUICtrlMenu_InsertMenuItem ($hEdit, 0, "&Cut", $idCut) _GUICtrlMenu_InsertMenuItem ($hEdit, 1, "C&opy", $idCopy) _GUICtrlMenu_InsertMenuItem ($hEdit, 2, "&Paste", $idPaste) ; Create Help menu $hHelp = _GUICtrlMenu_CreateMenu () _GUICtrlMenu_InsertMenuItem ($hHelp, 0, "&About", $idAbout) ; Create Main menu $hMain = _GUICtrlMenu_CreateMenu () _GUICtrlMenu_InsertMenuItem ($hMain, 0, "&File", 0, $hFile) _GUICtrlMenu_InsertMenuItem ($hMain, 1, "&Edit", 0, $hEdit) _GUICtrlMenu_InsertMenuItem ($hMain, 2, "&Help", 0, $hHelp) ; Set window menu _GUICtrlMenu_SetMenu ($hGUI, $hMain) ; Create memo control $iMemo = GUICtrlCreateEdit("", 2, 2, 396, 276, 0) GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New") GUISetState() ; Set New menu item to have a bitmap _GUICtrlMenu_SetItemBmp ($hFile, 0, _WinAPI_CreateSolidBitmap ($hGUI, 0xFF0000, 11, 11)) MemoWrite("Item bitmap handle: 0x" & Hex(_GUICtrlMenu_GetItemBmp ($hFile, 0))) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>_Main ; Write message to memo Func MemoWrite($sMessage) GUICtrlSetData($iMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite
Authenticity Posted October 21, 2009 Posted October 21, 2009 It seems like this is a known problem with XP that AHK solves using WM_DRAWITEM or owner-drawn menus. You can try ModernMenu made by Holger. Check to see if it's compatible with your version of AutoIt because it may contain script breaking issues.
GEOSoft Posted October 21, 2009 Posted October 21, 2009 For the spacing try adding empty space before the text with eithe a space or @Tab Example" _GUICtrlMenu_InsertMenuItem ($hEdit, 0, " &Cut", $idCut) Or _GUICtrlMenu_InsertMenuItem ($hEdit, 0, @Tab & "&Cut", $idCut) 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!"
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