2Toes Posted December 2, 2018 Posted December 2, 2018 Hi all.. I'm having slight issue that has be a bit puzzled. I have an Input control.. After a certain function runs, it Disables that Input control, and sets it to ReadOnly. When running another certain function, it re-Enables that Input control, and sets the style back to Default. Which does work, however, when typing into the Input control after re-Enabling it, the text appears as a light gray color, rather than its original black color. I'm sure there's a simple solution here.. But what that is, appears to be beyond me. Here is a simplified example code: expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= Global $Form1 = GUICreate("Form1", 245, 215, 192, 124) Global $disableBTN = GUICtrlCreateButton("Disable", 32, 64, 75, 25) Global $enableBTN = GUICtrlCreateButton("Enable", 128, 64, 75, 25) Global $Input1 = GUICtrlCreateInput("", 32, 120, 169, 21) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $disableBTN disable() Case $enableBTN enable() EndSwitch WEnd Func disable() GUICtrlSetState($Input1, $GUI_DISABLE) GUICtrlSetStyle($Input1, $ES_READONLY) EndFunc Func enable() GUICtrlSetState($Input1, $GUI_ENABLE) GUICtrlSetStyle($Input1, $GUI_SS_DEFAULT_INPUT) EndFunc Any help would be greatly appreciated Thank you in advance!
2Toes Posted December 2, 2018 Author Posted December 2, 2018 After some tinkering, I figured out a solution. Removing the SetStates of Enable & Disable ... and only setting the Styles of ReadOnly & Default, does what I need it to do, whilst dealing with the issue of the text being grayed out. Issue solved!!
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