neo van matix Posted October 1, 2006 Share Posted October 1, 2006 Hello, i tried to write a little gui with some menu-points. I need no Submenus, cause, i've only 3 oder 4 menus (like Open, Update, Exit, Info) So... $MenuItem1 = GUICtrlCreateMenu("x") $MenuItem4 = GUICtrlCreateMenu("y") $MenuItem3 = GUICtrlCreateMenu("z") $MenuItem2 = GUICtrlCreateMenu("a") Now i want to call a function, if someone click on menu "x" - i tried to call the function with GuiCtrlSetOnEvent($MenuItem1, "FUNCTION"), but, nothing happens... why ? Attention! English noob ^^ Link to comment Share on other sites More sharing options...
Sunaj Posted October 1, 2006 Share Posted October 1, 2006 (edited) You probably need to enable "GUIOnEventMode"! (remember to post GUI ?s in the v3 GUI (Graphical User Interface) section of the forum)Hello,i tried to write a little gui with some menu-points.I need no Submenus, cause, i've only 3 oder 4 menus (like Open, Update, Exit, Info)So...$MenuItem1 = GUICtrlCreateMenu("x")$MenuItem4 = GUICtrlCreateMenu("y")$MenuItem3 = GUICtrlCreateMenu("z")$MenuItem2 = GUICtrlCreateMenu("a")Now i want to call a function, if someone click on menu "x" - i tried to call the function with GuiCtrlSetOnEvent($MenuItem1, "FUNCTION"), but, nothing happens...why ? Edited October 1, 2006 by Sunaj [list=1][*]Generic way to detect full path to default browser, List/ListView Events Using GuiRegisterMsg (detect doubleclick and much more)[*]Using dllcall for full control over fileopendialog, Make DirMove act somewhat normally (by circumventing it...)[*]Avoid problems with "&" (chr(38)) in code, Change desktop maximized area/workspace (fx to make deskbar type app)[*]Change focus behavior when buttons are clicked to work closer to 'standard windows' app[*](Context) Menus With Timed Tooltips, Fast Loops & Operators in AU3[*]Clipboard UDF, A clipboard change notification udf[/list] Link to comment Share on other sites More sharing options...
neo van matix Posted October 1, 2006 Author Share Posted October 1, 2006 You probably need to enable "GUIOnEventMode"!GUIOnEventMode is set to 1 on script header Attention! English noob ^^ Link to comment Share on other sites More sharing options...
Bert Posted October 1, 2006 Share Posted October 1, 2006 Do a search for GUIOnEventMode to see how it is used. Once you see it, it is pretty strait forward. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
neo van matix Posted October 1, 2006 Author Share Posted October 1, 2006 (edited) Maybe, u doesnt understand what i try to getting work... Here's my "little" Script, it should help my by scanning files for virus... expandcollapse popup#include <GUIConstants.au3> #include <file.au3> #include <Array.au3> Opt("GUIOnEventMode", 1) #Region $Form1 = GUICreate("Auto-Scanner", 461, 288, 245, 165) $Group1 = GUICtrlCreateGroup("Offene Scans", 5, 0, 141, 231) GUICtrlCreateGroup("", -99, -99, 1, 1) $List1 = GUICtrlCreateList("", 10, 15, 130, 218) $Group2 = GUICtrlCreateGroup("Viren-Definitionen", 150, 0, 306, 146) $Label1 = GUICtrlCreateLabel("", 155, 15, 300, 120) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("Update", 155, 165, 61, 21, 0) $Button2 = GUICtrlCreateButton("Copy2Clipboard", 230, 165, 86, 21, 0) $Group3 = GUICtrlCreateGroup("", 150, 150, 176, 46) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button3 = GUICtrlCreateButton("Refresh", 10, 235, 50, 20, 0) $Button4 = GUICtrlCreateButton("Scan", 60, 235, 50, 20, 0) $MenuItem1 = GUICtrlCreateMenu("Datei") $MenuItem4 = GUICtrlCreateMenu("Scannen") $MenuItem3 = GUICtrlCreateMenu("Viren-Update") $MenuItem2 = GUICtrlCreateMenu("Info") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSE") GUICtrlSetOnEvent($Button1, "GETDEF") GUICtrlSetOnEvent($Button2, "COPY2CLIPBOARD") GUICtrlSetOnEvent($Button3, "GETDIRS") ; >>> Doesnt work - why ? <<<< GUICtrlSetOnEvent($MenuItem2, "ABOUT") While 1 Sleep(100) WEnd Func ABOUT() msgbox(0, "Info...", "This script is written by Bastian Müller") EndFunc Func GETDIRS() $open_tasks = _FileListToArray(@ScriptDir&"\open_scans\", "*.*", 2) For $i = 1 to $open_tasks[0] GUICtrlSetData($List1, $open_tasks[$i]) Next EndFunc [...] Func CLOSE() Exit EndFunc I know, that i can call functions on setting up events (like click on a button), but this method doesnt work if i click on a Menuitem (Toplevel, NO submenus). Is that possibel? To use online toplevel menus without submenus ? Edited October 1, 2006 by neo van matix Attention! English noob ^^ Link to comment Share on other sites More sharing options...
Valuater Posted October 1, 2006 Share Posted October 1, 2006 Looks suspect to me.... may be a bug 8) Link to comment Share on other sites More sharing options...
neo van matix Posted October 1, 2006 Author Share Posted October 1, 2006 oO Ahm,... kk ? ^^ Someone how tried this before ? Attention! English noob ^^ Link to comment Share on other sites More sharing options...
rambo3889 Posted October 1, 2006 Share Posted October 1, 2006 This works for me but you might not want use it since it now is a menuitem expandcollapse popup#include <GUIConstants.au3> #include <file.au3> #include <Array.au3> Opt("GUIOnEventMode", 1) #Region $Form1 = GUICreate("Auto-Scanner", 461, 288, 245, 165) $Group1 = GUICtrlCreateGroup("Offene Scans", 5, 0, 141, 231) GUICtrlCreateGroup("", -99, -99, 1, 1) $List1 = GUICtrlCreateList("", 10, 15, 130, 218) $Group2 = GUICtrlCreateGroup("Viren-Definitionen", 150, 0, 306, 146) $Label1 = GUICtrlCreateLabel("", 155, 15, 300, 120) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("Update", 155, 165, 61, 21, 0) $Button2 = GUICtrlCreateButton("Copy2Clipboard", 230, 165, 86, 21, 0) $Group3 = GUICtrlCreateGroup("", 150, 150, 176, 46) GUICtrlCreateGroup("", -99, -99, 1, 1) $Button3 = GUICtrlCreateButton("Refresh", 10, 235, 50, 20, 0) $Button4 = GUICtrlCreateButton("Scan", 60, 235, 50, 20, 0) $start=GUICtrlCreateMenu("Funcs") $MenuItem1 = GUICtrlCreateMenuitem("Datei",$start) $MenuItem4 = GUICtrlCreateMenuitem("Scannen",$start) $MenuItem3 = GUICtrlCreateMenuitem("Viren-Update",$start) $MenuItem2 = GUICtrlCreateMenuitem("Info",$start) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSE") GUICtrlSetOnEvent($Button1, "GETDEF") GUICtrlSetOnEvent($Button2, "COPY2CLIPBOARD") GUICtrlSetOnEvent($MenuItem1,"ABOUT") GUICtrlSetOnEvent($Button3, "GETDIRS") ; >>> Doesnt work - why ? <<<< GUICtrlSetOnEvent($MenuItem2, "ABOUT") While 1 Sleep(100) WEnd Func ABOUT() msgbox(0, "Info...", "This script is written by Bastian Müller") EndFunc Func GETDIRS() $open_tasks = _FileListToArray(@ScriptDir&"\open_scans\", "*.*", 2) For $i = 1 to $open_tasks[0] GUICtrlSetData($List1, $open_tasks[$i]) Next EndFunc ;[...] Func CLOSE() Exit EndFunc My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! youre the best in town Fight! 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