Andreik Posted February 26, 2014 Share Posted February 26, 2014 (edited) Just now I observed the strange behavior of GUICtrlSetColor that seems to delete the edit control and them recreate it. This is how it works GUICtrlSetColor? I have the code below and to see what I mean just select the edit control and then click the combo control. Can someone try to see if I have just me this issue? #include <WindowsConstants.au3> GUICreate("Test") Global $edit = GUICtrlCreateEdit("",5,10,390,100) GUICtrlCreateCombo("",5,250,390,20,0x03) GUICtrlSetData(-1,"Yes|No","Yes") GUIRegisterMsg($WM_COMMAND, 'WM_COMMAND') GUISetState() Do Sleep(10) Until GUIGetMsg() = -3 Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) $iCtrl = BitAND($wParam, 0x0000FFFF) Switch BitShift($wParam, 16) Case 0x0100 ; EN_SETFOCUS Switch $iCtrl Case $edit If GUICtrlRead($iCtrl) = "Test" Then GUICtrlSetData($iCtrl, "") GUICtrlSetColor($iCtrl, 0) EndIf EndSwitch Case 0x0200 ; EN_KILLFOCUS Switch $iCtrl Case $edit If Not GUICtrlRead($iCtrl) Then GUICtrlSetColor($iCtrl, 0x606060) GUICtrlSetData($iCtrl, "Test") EndIf EndSwitch EndSwitch Return "GUI_RUNDEFMSG" EndFunc Edited February 26, 2014 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
FireFox Posted February 26, 2014 Share Posted February 26, 2014 Hi, It seems to be related to the Combo control, try with a button and you will see. I'm looking at it. Br, FireFox. Link to comment Share on other sites More sharing options...
Andreik Posted February 26, 2014 Author Share Posted February 26, 2014 Indeed but this is quite odd, is this how it should work or is a bad behavior? When the words fail... music speaks. Link to comment Share on other sites More sharing options...
FireFox Posted February 26, 2014 Share Posted February 26, 2014 I don't know if it's an issue or not, but I would say it's an issue. A workaround : ... Case 0x0200 ; EN_KILLFOCUS Switch $iCtrl Case $edit If Not GUICtrlRead($iCtrl) Then GUICtrlSetData($edit, "Test") AdlibRegister("setcolor", 0) EndIf EndSwitch EndSwitch Return "GUI_RUNDEFMSG" EndFunc Func setcolor() AdlibUnRegister("setcolor") GUICtrlSetColor($edit, 0x606060) EndFunc Br, FireFox. 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