MrCreatoR Posted May 28, 2008 Share Posted May 28, 2008 Hi, The example bellow supose to display a GUI with one menu item (as menu button), when you press that item, event is fired: GUICreate("Test", 200, 100) $MenuItem = GUICtrlCreateMenuItem("Menu Button", -1) GUISetState() While 1 Switch GUIGetMsg() Case -3 Exit Case $MenuItem MsgBox(0, "", "Menu Button Pressed") If $MenuItem = 0 Then Exit EndSwitch WEndoÝ÷ Ø2¢çÇëw[h±ëbµé²g§¹»¶Èæ¥'hmz0øÁ«nè(}¼×ýö×M(®+b±¦î)÷Û]´nëh}µÛHp¢¹"§Êj+y8^צÉèµÊÞj×Ó~z{µé«zÛ«Í(y«!£hv=/Û"Ü(®K"æz+Z±«rÝéîjëh×6GUICtrlCreateMenu("Menu") $MenuItem = GUICtrlCreateMenuItem("Menu Button", -1) But i need it for the first one... 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...
Zedna Posted May 28, 2008 Share Posted May 28, 2008 Just for your information: On my 3.2.10 it works fine. GUICreate("Test", 200, 100) $MenuItem = GUICtrlCreateMenuItem("Menu Button", -1) GUISetState() ... Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
MrCreatoR Posted May 28, 2008 Author Share Posted May 28, 2008 Just for your information: On my 3.2.10 it works fine. GUICreate("Test", 200, 100) $MenuItem = GUICtrlCreateMenuItem("Menu Button", -1) GUISetState() ...That's what i say... I really don't know if it was a bug on 3.2.8.1/3.2.10.0, or it is a bug in 3.2.12.0, but on 3.2.12.0 it not working anymore I am looking for a way to do the same on 3.2.12.0 (the last released version). 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...
ResNullius Posted May 29, 2008 Share Posted May 29, 2008 Hi, The example bellow supose to display a GUI with one menu item (as menu button), when you press that item, event is fired: GUICreate("Test", 200, 100) $MenuItem = GUICtrlCreateMenuItem("Menu Button", -1) GUISetState() While 1 Switch GUIGetMsg() Case -3 Exit Case $MenuItem MsgBox(0, "", "Menu Button Pressed") If $MenuItem = 0 Then Exit EndSwitch WEndoÝ÷ Øwv+_¢»ayø«²Ú'{ú®¢×¯+aÆ®¶sduT7&VFRgV÷CµFW7BgV÷C²Â# ¢b33c´ÖVçTFVÒÒuT7G&Ä7&VFTÖVçTFVÒgV÷C´ÖVçR'WGFöâgV÷C²ÂÓ¢b33c´ÖVçTFVÓ"ÒuT7G&Ä7&VFTÖVçTFVÒgV÷C´ÖVçR'WGFöã"gV÷C²ÂÓ¤6öç6öÆUw&FRgV÷C²b33c´ÖVçTFVÓ¢gV÷C²fײb33c´ÖVçTFVÒfײ5$ÄbfײgV÷C²b33c´ÖVçTFVÓ#¢gV÷C²fײb33c´ÖVçTFVÓ"fײ5$Äb ¤uT6WE7FFR ¥vÆR¢7vF6uTvWD×6r¢66RÓ0¢W@¢66Rb33c´ÖVçTFVТ×6t&÷ÂgV÷C²gV÷C²ÂgV÷C´ÖVçR'WGFöâ&W76VBgV÷C²¢bb33c´ÖVçTFVÒÒFVâW@¢VæE7vF6¥tVæ@ The consoleWrite shows "0" for both menu IDs When you stick another menu in there, then they get proper IDs Link to comment Share on other sites More sharing options...
MrCreatoR Posted May 29, 2008 Author Share Posted May 29, 2008 When you stick another menu in there, then they get proper IDsI am sorry, i am not understand, can you show me please a working example? 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...
MrCreatoR Posted May 29, 2008 Author Share Posted May 29, 2008 (edited) Ok, here is the only solution that i can see right now:GUICreate("Test", 200, 100) $MenuItem = _GUICtrlCreateMenuItemEx("Menu Button", -1) GUISetState() While 1 Switch GUIGetMsg() Case -3 Exit Case $MenuItem MsgBox(0, "", "Menu Button Pressed") EndSwitch WEnd Func _GUICtrlCreateMenuItemEx($sText, $iMenuID, $iMenuEntry=-1, $iMenuRadioItem=0) Local $nDummyMenu = GUICtrlCreateMenu("") Local $nDummyMenuItem = GUICtrlCreateMenuItem("", $nDummyMenu) Local $nMenuItem = GUICtrlCreateMenuItem($sText, $iMenuID, $iMenuEntry, $iMenuRadioItem) GUICtrlDelete($nDummyMenu) GUICtrlDelete($nDummyMenuItem) Return $nMenuItem EndFuncI don't know what was changed about this issue (the History does not mention it as far as i can see), but the problem is one of two: Or it is a bug in earlier to 3.2.12.0 versions, or it is a bug in this new version. I think the first one is true, but i hope that the second one and it will be fixed Edited June 4, 2008 by MrCreatoR 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...
ResNullius Posted May 29, 2008 Share Posted May 29, 2008 I am sorry, i am not understand, can you show me please a working example?I was only trying to help pinpoint the bug, not imply a solution. Using your example above: GUICreate("Test", 200, 100) GUICtrlCreateMenu("Menu") $MenuItem = GUICtrlCreateMenuItem("Menu Button", -1) $MenuItem2 = GUICtrlCreateMenuItem("Menu Button2", -1) ConsoleWrite("$MenuItem: " & $MenuItem & @CRLF & "$MenuItem2: " & $MenuItem2 & @CRLF) GUISetState() While 1 Switch GUIGetMsg() Case -3 Exit Case $MenuItem MsgBox(0, "", "Menu Button Pressed") If $MenuItem = 0 Then Exit EndSwitch WEnd By creating a menu first, then the ConsoleWrite()s show Gui Control lIDs for $menuitem1 & $menuitem2 as "4" and "5" respectively. In the first (non-working example) both controls are ID "0" which is the standard return of GuiGetMsg() in the loop when nothing is happening; so the Case $MenuItem always returns true and fires the event. GuiCtrlCreation probably should never create an ID of 0, so I'm inclined to think it's a new bug. Link to comment Share on other sites More sharing options...
kmeleon Posted May 29, 2008 Share Posted May 29, 2008 GUICreate("Test", 200, 100) $filemenu = GUICtrlCreateMenu("&File") $MenuItem = GUICtrlCreateMenuItem("Open", $filemenu) GUISetState() While 1 Switch GUIGetMsg() Case -3 Exit Case $MenuItem MsgBox(0, "", "Menu Button Pressed") If $MenuItem = 0 Then Exit EndSwitch WEnd Feed Polish children: pajacyk - just go to this page and close it. Thanks. World website: free rice. Link to comment Share on other sites More sharing options...
ResNullius Posted May 29, 2008 Share Posted May 29, 2008 GUICreate("Test", 200, 100) $filemenu = GUICtrlCreateMenu("&File") $MenuItem = GUICtrlCreateMenuItem("Open", $filemenu) GUISetState() While 1 Switch GUIGetMsg() Case -3 Exit Case $MenuItem MsgBox(0, "", "Menu Button Pressed") If $MenuItem = 0 Then Exit EndSwitch WEndWe know that works! What we're talking about is creating a menuitem at the top level that acts just like a button. You don't have to navigate down through the menu to access it. Link to comment Share on other sites More sharing options...
TalivanIBM Posted September 19, 2008 Share Posted September 19, 2008 if you put only this GUICreate("Test", 200, 100) $MenuItem = _GUICtrlCreateMenuItemEx("Menu Button", -1) GUISetState() While 1 Switch GUIGetMsg() Case -3 Exit Case $MenuItem MsgBox(0, "", "Menu Button Pressed") EndSwitch WEnd Func _GUICtrlCreateMenuItemEx($sText, $iMenuID, $iMenuEntry=-1, $iMenuRadioItem=0) Local $nDummyMenu = GUICtrlCreateMenu("") ; <============== Local $nMenuItem = GUICtrlCreateMenuItem($sText, $iMenuID, $iMenuEntry, $iMenuRadioItem) GUICtrlDelete($nDummyMenu) ; <=============== Return $nMenuItem EndFunc i have version 3.2.12.1 in some of my scripts i had this problem. Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 19, 2008 Share Posted September 19, 2008 if you put only this GUICreate("Test", 200, 100) $MenuItem = _GUICtrlCreateMenuItemEx("Menu Button", -1) GUISetState() While 1 Switch GUIGetMsg() Case -3 Exit Case $MenuItem MsgBox(0, "", "Menu Button Pressed") EndSwitch WEnd Func _GUICtrlCreateMenuItemEx($sText, $iMenuID, $iMenuEntry=-1, $iMenuRadioItem=0) Local $nDummyMenu = GUICtrlCreateMenu(""); <============== Local $nMenuItem = GUICtrlCreateMenuItem($sText, $iMenuID, $iMenuEntry, $iMenuRadioItem) GUICtrlDelete($nDummyMenu) ; <=============== Return $nMenuItem EndFunc i have version 3.2.12.1 in some of my scripts i had this problem. I don't get it. Why not just this? GUICreate("Test", 400, 200) $Menu = GUICtrlCreateMenu("") $MenuItem = GUICtrlCreateMenuItem("Menu Button", -1) GUISetState() While 1 Switch GUIGetMsg() Case -3 Exit Case $MenuItem MsgBox(0, "", "Menu Button Pressed") EndSwitch WEnd What did you revive this old topic for? What did you want it to do? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
TalivanIBM Posted September 20, 2008 Share Posted September 20, 2008 I don't get it. Why not just this? GUICreate("Test", 400, 200) $Menu = GUICtrlCreateMenu("") $MenuItem = GUICtrlCreateMenuItem("Menu Button", -1) GUISetState() While 1 Switch GUIGetMsg() Case -3 Exit Case $MenuItem MsgBox(0, "", "Menu Button Pressed") EndSwitch WEnd What did you revive this old topic for? What did you want it to do? In the title don't put solved and seems to me there is no final reply, excuse me. 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