Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Inputbox focus/not focus

$
0
0

Hi,

I want to make a func to clean one or more inputbox on click. My script:

AutoIt         
#include <GUIConstants.au3> $Form1 = GUICreate("Form1", 242, 99) $Input1 = GUICtrlCreateInput("Some text", 40, 24, 121, 21) $Input2 = GUICtrlCreateInput("", 40, 50, 121, 21) $btn1 = GUICtrlCreateButton("Initial focus", 180, 70) GUICtrlSetState($btn1, $GUI_Focus) GUISetState(@SW_SHOW) While 1     $nMsg = GUIGetMsg()     Switch $nMsg         Case $GUI_EVENT_CLOSE             Exit     EndSwitch     _Focus($Form1, $Input1, "") WEnd Func _Focus($hHandle, $Control, $Data)     If ControlGetHandle($hHandle, "", ControlGetFocus($hHandle)) = GUICtrlGetHandle($Control) Then         If GUICtrlRead($Control) <> "" Then             GUICtrlSetData($Control, $Data)             Do             Until ControlGetHandle($hHandle, "", ControlGetFocus($hHandle)) <> GUICtrlGetHandle($Control)         EndIf     EndIf EndFunc   ;==>_Focus

Work fine but has only one big problem, i can't close the GUI if the $Input1 is focused ( by Do Until )

How i can resolve? Thanks


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>