autonomouslogic 0 Posted August 19, 2015 Hello everyone! I have a question concerning how to manipulate an input box in order to display the text 'username' when the input box isnt able to be typed in because it has not been clicked and when it doesnt have anything typed in to serve as a prompt to the user to type in their username.$Form1 = GUICreate("Username", 170, 235, 190, 200) $usernamefield = GUICtrlCreateInput("Username", 21, 120, 130, 20) $passwordfield = GUICtrlCreateInput("Password", 21, 145, 130, 20, 0x0020) while True $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit if ControlGetFocus($usernamefield) == True and GUICtrlRead($usernamefield) = "Username" Then GUICtrlSetData($username, "") ElseIf ControlGetFocus($usernamefield) == True Then GUICtrlSetData($username, "Username") EndIf wendas you can see I have attempted to use the controlgetfocus() function to achieve this however it simply does not work.Is this the right function and is it the most appropiate function to use in this situation? i Hope everyone understand what I mean and thanks for taking your time to read. Share this post Link to post Share on other sites
SupaNewb 4 Posted August 19, 2015 #include <GUIConstantsEx.au3> #include <GuiEdit.au3> $Form1 = GUICreate("Username", 170, 235, 190, 200) $usernamefield = GUICtrlCreateInput("", 21, 120, 130, 20) $passwordfield = GUICtrlCreateInput("Password", 21, 145, 130, 20, 0x0020) _GUICtrlEdit_SetCueBanner(GUICtrlGetHandle($usernamefield), "User Name") GUISetState() While True $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit ;~ if ControlGetFocus($usernamefield) = True and GUICtrlRead($usernamefield) = "Username" Then ;~ GUICtrlSetData($usernamefield, "") ;~ ElseIf ControlGetFocus($usernamefield) = True Then ;~ GUICtrlSetData($username, "Username") ;~ EndIf EndSwitch WEnd Share this post Link to post Share on other sites