testingtest Posted August 14, 2007 Share Posted August 14, 2007 (edited) i got a script with a GUI and my script updates the GUI every second or so but if I hit close on the GUI it sleeps for that second and the data being told in while loop to be send to the GUI has to be constant While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Cancel Exit EndSwitch Sleep(250) ;do something WEnd i don't like seeing flicking while updating gui thats what the sleeps for Edited August 14, 2007 by testingtest Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 14, 2007 Share Posted August 14, 2007 i got a script with a GUI and my script updates the GUI every second or so but if I hit close on the GUI it sleeps for that second and the data being told in while loop to be send to the GUI has to be constanti don't like seeing flicking while updating gui thats what the sleeps forThe code you showed does not reproduce the symptoms as it will not flicker the GUI because it doesn't change anything. Write a short demo that creates a GUI and shows how you are updating it. 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...
DW1 Posted August 14, 2007 Share Posted August 14, 2007 i don't like seeing flicking while updating gui thats what the sleeps forThats why you check to see if somehting needs updating before updating it on the gui AutoIt3 Online Help Link to comment Share on other sites More sharing options...
testingtest Posted August 15, 2007 Author Share Posted August 15, 2007 Thats why you check to see if somehting needs updating before updating it on the gui but i want it to have a good effect #include <GUIConstants.au3> $Example = GUICreate("Length = 16" , 252 , 120, 0 , 0 , $WS_CLIPSIBLINGS) $Encode = GUICtrlCreateInput("133-A75-321-8K26", 8, 32, 233, 21) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Cancel Exit EndSwitch Sleep(250) WinSetTitle($Example , "" , "Length = " & StringLen(GUICtrlRead($Encode))) WEnd Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 15, 2007 Share Posted August 15, 2007 but i want it to have a good effect This does a few things: 1. Adds $Cancel, which was causing an error 2. Eliminates flickering by only updating when there is a change (as danwilli suggested) 3. Tightens up the message loop so it doesn't miss clicking on things Note that there is no Sleep(). GuiGetMsg() has an effective Sleep(10) built into it, so you don't need any more. #include <GUIConstants.au3> $Example = GUICreate("Length = 16", 252, 120, 0, 0) $Encode = GUICtrlCreateInput("133-A75-321-8K26", 8, 32, 233, 21) $Cancel = GUICtrlCreateButton("Cancel", 76, 80, 100, 30) GUISetState(@SW_SHOW) $sEncode = "" While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Cancel Exit EndSwitch If GUICtrlRead($Encode) <> $sEncode Then $sEncode = GUICtrlRead($Encode) WinSetTitle($Example, "", "Length = " & StringLen($sEncode)) EndIf WEnd 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...
testingtest Posted August 15, 2007 Author Share Posted August 15, 2007 This does a few things: 1. Adds $Cancel, which was causing an error 2. Eliminates flickering by only updating when there is a change (as danwilli suggested) 3. Tightens up the message loop so it doesn't miss clicking on things Note that there is no Sleep(). GuiGetMsg() has an effective Sleep(10) built into it, so you don't need any more. #include <GUIConstants.au3> $Example = GUICreate("Length = 16", 252, 120, 0, 0) $Encode = GUICtrlCreateInput("133-A75-321-8K26", 8, 32, 233, 21) $Cancel = GUICtrlCreateButton("Cancel", 76, 80, 100, 30) GUISetState(@SW_SHOW) $sEncode = "" While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Cancel Exit EndSwitch If GUICtrlRead($Encode) <> $sEncode Then $sEncode = GUICtrlRead($Encode) WinSetTitle($Example, "", "Length = " & StringLen($sEncode)) EndIf WEnd works great but can you explain so I can learn from it please. I thought <> was another form of = and is it checking for input Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 15, 2007 Share Posted August 15, 2007 works great but can you explain so I can learn from it please. I thought <> was another form of = and is it checking for inputAuto it doesn't use '!' for 'NOT', but '<>' would be equivalent to '!=' if it did.Read the help file under 'Operators' 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...
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