Jump to content

Input control -- Gray text after re-enabling [SOLVED]


2Toes
 Share

Recommended Posts

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:

#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!

Link to comment
Share on other sites

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!! :)

Link to comment
Share on other sites

  • 2Toes changed the title to Input control -- Gray text after re-enabling [SOLVED]

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...