Kip Posted September 7, 2008 Share Posted September 7, 2008 (edited) Hi, I want to stop a control being redrawed. It works pretty well actually, using: _SendMessage($hButton, $WM_SETREDRAW, False, 0) But then, when I want to start drawing again using: _SendMessage($hButton, $WM_SETREDRAW, True, 0) it doesn't redraw. I tried several combinations with _WinAPI_RedrawWindow($hButton) and _WinAPI_InvalidateRect($hButton) but none of them work. Thnx, Kip Edited September 7, 2008 by Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
Kip Posted September 8, 2008 Author Share Posted September 8, 2008 Bump MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
martin Posted September 8, 2008 Share Posted September 8, 2008 Bump Can you give some sample code for us to play with? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Kip Posted September 8, 2008 Author Share Posted September 8, 2008 Nevermind, I already got it working. Btw: Does anyone know how to get messages from a control that isn't being painted. Because when I stop redrawing, lets say, a button, it doesnt notify me anymore when it is pressed. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
Kip Posted September 24, 2008 Author Share Posted September 24, 2008 bump? MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 24, 2008 Share Posted September 24, 2008 Nevermind, I already got it working.How? Please post your resolution of the first issue, as others may find this topic in search for the same answer.Btw: Does anyone know how to get messages from a control that isn't being painted.Because when I stop redrawing, lets say, a button, it doesnt notify me anymore when it is pressed.Messages? Have you tried it in event mode? 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...
Kip Posted September 24, 2008 Author Share Posted September 24, 2008 How? Please post your resolution of the first issue, as others may find this topic in search for the same answer.By calling _SendMessage($hButton, $WM_SETREDRAW, False, 0) outside the notification. expandcollapse popup#Include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <WinAPI.au3> $Draw = 0 $GUI = GUICreate("Buttons", 500, 400) $iButton = GUICtrlCreateButton("Frozen",100,100,120,23) $hButton = GUICtrlGetHandle($iButton) GUIRegisterMsg($WM_PAINT, "Paint") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $iButton MsgBox(0,"sdsds","sdsds") EndSwitch If $Draw = 1 Then _SendMessage($hButton,$WM_SETREDRAW,False,0); Wont be redrawed. It's 'Frozen' $Draw = 0 EndIf WEnd Func Paint($hWnd, $iMsg, $wParam, $lParam) If $hWnd = $GUI Then _SendMessage($hButton,$WM_SETREDRAW,True,0) _WinAPI_RedrawWindow($GUI) $Draw = 1 EndIf EndFunc MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 24, 2008 Share Posted September 24, 2008 (edited) By calling _SendMessage($hButton, $WM_SETREDRAW, False, 0) outside the notification. Thanks for posting the resolution. >_< On having the control still work while not being redrawn, did you try GuiOnEventMode? Edit: Nope, not in EventMode either. (I couldn't figure out what the point of registering $WM_PAINT was, so I took it out.)expandcollapse popup#include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <WinAPI.au3> Opt("GuiOnEventMode", 1) $Draw = True $n = 0 $GUI = GUICreate("Buttons", 500, 400) GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit") $iButton_1 = GUICtrlCreateButton("UnFrozen: " & $n, 100, 100, 200, 23) $hButton_1 = GUICtrlGetHandle(-1) GUICtrlSetOnEvent(-1, "_ButtonHit") $iButton_2 = GUICtrlCreateButton("Freeze", 100, 200, 200, 23) GUICtrlSetOnEvent(-1, "_ButtonHit") GUISetState() AdlibEnable("_IncrementN", 2000) While 1 Sleep(20) WEnd Func _Quit() Exit EndFunc ;==>_Quit Func _ButtonHit() Switch @GUI_CtrlId Case $iButton_1 MsgBox(0, "Button", "$n = " & $n) Case $iButton_2 $Draw = Not $Draw If $Draw Then GUICtrlSetData($iButton_2, "Freeze") _SendMessage($hButton_1, $WM_SETREDRAW, True, 0); Will be redrawn. It's 'UnFrozen' Else GUICtrlSetData($iButton_2, "UnFreeze") GUICtrlSetData($iButton_1, "Frozen") _SendMessage($hButton_1, $WM_SETREDRAW, False, 0); Wont be redrawn. It's 'Frozen' EndIf EndSwitch EndFunc ;==>_ButtonHit Func _IncrementN() $n += 1 GUICtrlSetData($iButton_1, "UnFrozen: " & $n) EndFunc ;==>_IncrementN Edited September 24, 2008 by PsaltyDS 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...
Kip Posted September 25, 2008 Author Share Posted September 25, 2008 (I couldn't figure out what the point of registering $WM_PAINT was, so I took it out.)To redraw the window when moving the window out of the screen. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. 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