Kickassjoe Posted March 7, 2008 Share Posted March 7, 2008 (edited) After the GUI is made, I made it check to see if $msg = the menuitem, it always returns yes... can anyone fix it?EDIT:Uploading Code.Download Here, .exe and .au3 Edited March 7, 2008 by Kickassjoe What goes around comes around... Payback's a bitch. Link to comment Share on other sites More sharing options...
rasim Posted March 7, 2008 Share Posted March 7, 2008 After the GUI is made, I made it check to see if $msg = the menuitem, it always returns yes... can anyone fix it? EDIT:Uploading Code. Download Here, .exe and .au3Hi! And this not work? #include <GuiConstants.au3> $hGui = GUICreate("Context menu test", 300, 200) $button = GUICtrlCreateButton("Button", 110, 80, 80, 25) $ContextMenu = GUICtrlCreateContextMenu($button) $MenuAbout = GUICtrlCreateMenuItem("About", $ContextMenu) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case -3 ExitLoop Case $MenuAbout MsgBox(0, "About", "This is a button control", 2) EndSwitch WEnd Link to comment Share on other sites More sharing options...
rasim Posted March 7, 2008 Share Posted March 7, 2008 I have looked your code and i think GuiSetOnEvent better then GuiGetMsg() for your code. Link to comment Share on other sites More sharing options...
Kickassjoe Posted March 7, 2008 Author Share Posted March 7, 2008 Your code worked, my code didn't, and still doesn't, nor does that put me any closer to figuring out why it isn't working. Thanks for the help? P.S. GuiSetOnEvent would mean i would have to basically rewrite all of that, and I think not using GuiSetOnEvent is doing just fine, other than it not working correctly. (Which GuiSetOnEvent would not help IMO) What goes around comes around... Payback's a bitch. Link to comment Share on other sites More sharing options...
smashly Posted March 7, 2008 Share Posted March 7, 2008 I can see why you'd be better off with OnEventMode , due to your cpu time will be chewed up every time the mouse is anywhere over gui even when not clicking anything. The While loop will start polling through the For loops and CPU time will sky rocket. Other things I find to hard to work with are 3d and 4d arrays, I really can't see the point of them for your script. I understand what they're for, but I cant see the need as you seem to be just complicating what should be a simple context menu per item and making one context menu into 3 different arrays of varying dimensions. To each his own, but to me that's just making life hard for yourself. A from scratch re-think of your control layout could probably save you some time in the long run and make it a hell of alot easier to follow where it's going wrong. Cheers Link to comment Share on other sites More sharing options...
Kickassjoe Posted March 7, 2008 Author Share Posted March 7, 2008 I guess I'll "redo" it to be GuiOnEvent... but isnt a 4d array necessary for the context menu? I want to keep track of 3 different kinds of abilities, on varying tabs (the first dimension), which have up to 10 different pictures on 10 different tab items (2nd and 3rd dimensions), and then which one is pressed (the 4th dimension). If you have another way of doing that, I'd be happy to know. I know I don't necessarily need any of the other arrays except $MenuItem, but how would I just put $MenuItem into a non-array variable without losing the functionality? What goes around comes around... Payback's a bitch. 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