macweirdo Posted June 9, 2011 Share Posted June 9, 2011 I tried to create a GUI in this chunk of code. Can someone tell me what I failed in? #include <GuiListBox.au3> #include <GUIConstantsEx.au3> #include <Clipboard.au3> Dim $data, $msg $winhandle = GUICreate("SmartClip",800,160) $listctrl = GUICtrlCreateList("wtf",0,0,200,160) #cs $ = $ #ce GUISetState(@SW_SHOW) ;GUICtrlRead While Not $msg = -3 $msg = GUIGetMsg() WEnd Link to comment Share on other sites More sharing options...
somdcomputerguy Posted June 9, 2011 Share Posted June 9, 2011 (edited) You probably need define $msg before the While loop.. Edited June 9, 2011 by somdcomputerguy - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 9, 2011 Moderators Share Posted June 9, 2011 macweirdo,You are creating the GUI, but you have misused Not and so the code exits the While..WEnd loop and the GUI closes as soon as any event occurs! I will try to explain:By using Not you converted $msg into a boolean variable (either True or False) - from now on any comparison operator (such as <>) will make Boolean comparisons. As far as AutoIt is concerned, 0 = False and any other value = True.While no events are occuring, GUIGetMsg returns zero - you convert that to True by using Not and the comparison is valid because -3 is also treated as True.As soon as an event of any kind occurs, GUIGetMsg returns an integer which Not converts to 0 (False) - now the comparison is not valid and you exit the loop and the script.A bit complex, but I hope you follow. Just use:While $msg <> -3in your loop and all will be well.Please ask if anyting is unclear. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
macweirdo Posted June 9, 2011 Author Share Posted June 9, 2011 (edited) Just use: While $msg <> -3 in your loop and all will be well. M23 Thank you! EDIT: how do I change the title of this topic to begin with [sOLVED]? Edited June 9, 2011 by macweirdo Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 9, 2011 Moderators Share Posted June 9, 2011 (edited) macweirdo, My pleasure. how do I change the title of this topic to begin with [sOLVED]?You need 5 posts total (I think) and then you will see an "EDIT" button appear on the post. Then edit the first post and select the "Use full editor" option" - that allows you to edit the title. I will ask a Mod to change this one for you. M23 Edit: And as you can see, it has been done within a few minutes - thanks to the kind Mod! Edited June 9, 2011 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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