Merrik 0 Posted June 30, 2011 Hi, Has anyone ever tried to change the text color of an input box after a button click? The text will be black when the user enters it and it turns green after theu click the button. I have been trying to this using "$nColor = DllCall("gdi32.dll", "int", "SetTextColor", "hwnd", $hDC, "int", $nColor)" I was thinking of something like this: expandcollapse popupinclude <GUIConstants.au3> ; GUI $GUI1 = GUICreate(" tasks", 400, 175) GUICtrlSetColor(-1, 0xFB1409) ; InputBox $ipbox = GUICtrlCreateInput("Enter", 50, 50, 90, 20) $Button1r1 = GUICtrlCreateButton("Web", 10, 100, 85, 30) $newColor = DllCall("gdi32.dll", "int", "SetTextColor", "hwnd", $hDC, "int", $nColor) GUISetState(@SW_SHOW) ;R1 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Button1r1, $ipbox $data = StringStripWS(GUICtrlRead($ipbox), 3);$data is the contents of the input, but remove leading and trailng spaces $newColor = DllCall("gdi32.dll", "int", "SetTextColor", "hwnd", $hDC, "int", $nColor) ;ConsoleWrite($data & @CRLF) Select If Case $data = "gmail" Then $newColor ShellExecute("http://www.gmail.com") Else Case $data = "exit" _Exit() EndIf EndSelect Case $GUI_EVENT_CLOSE _Exit() EndSwitch WEnd Func _Exit() Exit EndFunc ;==>_Exit GUIDelete() Share this post Link to post Share on other sites
JohnOne 1,603 Posted June 30, 2011 Does it work? I thought you could not change a input control colour, and you need to use a richedit control. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Share this post Link to post Share on other sites
monoscout999 10 Posted June 30, 2011 (edited) the script will not work... you need to script right first, make it one step after another, first you need to have a working GUI after that you set the events and there will see... well i end it scripting for you... next time try to learn first for the beggining. and use the tidy tool of scite to make your script more readeable.(for us) #include <GUIConstants.au3> $GUI1 = GUICreate(" tasks", 400, 175) GUICtrlSetColor(-1, 0xFB1409) $ipbox = GUICtrlCreateInput("Enter", 50, 50, 90, 20) $Button1r1 = GUICtrlCreateButton("Web", 10, 100, 85, 30) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _Exit() Case $Button1r1 Guictrlsetcolor($ipbox,0xff0000) EndSwitch WEnd Func _Exit() Exit EndFunc ;==>_Exit Edited June 30, 2011 by monoscout999 Share this post Link to post Share on other sites