Jack023 Posted December 26, 2013 Share Posted December 26, 2013 Hey all, I'm making an api for a website and make my own gui with it. I read from website and that changes the labels inside the gui, but because it can't run at same time all the labels will change after each other - IMO this is ugly. Is there a way to freeze the gui? And when all the fuctions are done it will unfreeze it so all labels change in 1 time? Got it what i mean? Greets, Jack Link to comment Share on other sites More sharing options...
spudw2k Posted December 26, 2013 Share Posted December 26, 2013 (edited) Here's a simple way GUISetState(@SW_DISABLE) ;do stuff GUISetState(@SW_ENABLE) or maybe using @SW_LOCK, @SW_UNLOCK Edited December 26, 2013 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Jack023 Posted December 26, 2013 Author Share Posted December 26, 2013 Thanks, i will check this out tommorow ! Thanks mate Link to comment Share on other sites More sharing options...
Jack023 Posted December 27, 2013 Author Share Posted December 27, 2013 Nope tried it but even when it's locked it will change the labels Link to comment Share on other sites More sharing options...
spudw2k Posted December 30, 2013 Share Posted December 30, 2013 (edited) Hmm, some of the other controls allow you to lock them while updates are made and then unlock them (_GUICtrlComboBox_BeginUpdate, _GUICtrlEdit, GUICtrlListBox, etc.) , but there does not appear to be a UDF for this func with Label controls. Maybe you could collect the info first then apply it to the labels quickly at the end? I'll look at the UDFs for the func I mentioned and see if that is something that can be adapted to labels. edit: I tried crafting a BeginUpdate and EndUpdate func for the labels but it's not very good. When I update the "locked" label it goes blank and I have to forcibly refresh/redraw it after unlock. Ther's prob a more ekegant way to do this, but considering even if the lock/unlock worked differently I'd probably opt to update all the labels at once anyways. Someone else want to chime in? Here's my lousy example. expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <SendMessage.au3> Global Const $__LABELCONSTANT_WM_SETREDRAW = 0x000B #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 438, 192, 124) $Button1 = GUICtrlCreateButton("Button1", 200, 264, 161, 57) $Label1 = GUICtrlCreateLabel("This is my label", 112, 48, 283, 65) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 _UpdateLabel() EndSwitch WEnd Func _UpdateLabel() $msg = InputBox("Change Label","","This is my updated label") If Not $msg Then Return 0 MsgBox(0,"Freezing Label Control","") _GUICtrlLabel_BeginUpdate($Label1) MsgBox(0,"Setting new text for label control","") GUICtrlSetData($Label1, $msg) MsgBox(0,"Click OK to Unfrezze label control","") _GUICtrlLabel_EndUpdate($Label1) MsgBox(0,"Redraw Label Control","") GUICtrlSetData($Label1, GUICtrlRead($Label1)) EndFunc Func _GUICtrlLabel_BeginUpdate($hWnd) If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd) Return _SendMessage($hWnd, $__LABELCONSTANT_WM_SETREDRAW) = 0 EndFunc Func _GUICtrlLabel_EndUpdate($hWnd) If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd) Return _SendMessage($hWnd, $__LABELCONSTANT_WM_SETREDRAW, 1) = 0 EndFunc Edited December 30, 2013 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Kilmatead Posted December 30, 2013 Share Posted December 30, 2013 (edited) It's easier to just stop painting the entire window, rather than aiming the $WM_SETREDRAW (already defined in WindowsConstants) at an individual label... _SendMessage($Form1, $WM_SETREDRAW, False) ; ... _SendMessage($Form1, $WM_SETREDRAW, True) _WinAPI_RedrawWindow($Form1) This works fine for multiple control updates or whatever, though if (for example) you physically resize a non-drawing window larger than the old client area, the window will resize (even though it won't paint), so the "new" area will look oddly black until the final API redraw kicks it back into action. But that's the only real caveat I've run into. That said, a non-redrawing window is also more susceptible to losing its z-order when focus is lost (as in your example above using msgbox's), so disabling redraw for extended periods (or when other windows are spawned) wouldn't be recommended. Edited December 30, 2013 by Kilmatead 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