Komawoyo Posted October 3, 2007 Posted October 3, 2007 is it possible to to get the variable of what input box your cursor is in?? say my input box are these $R1I1 = GUICtrlCreateInput ($VR1I1, 90, 20, $Box_XL, 20) $R1I2 = GUICtrlCreateInput ($VR1I2, 140, 20, $Box_XL, 20) $R1I3 = GUICtrlCreateInput ($VR1I3, 190, 20, $Box_XL, 20) i put my cursor in $R1I1 can i get it to show what input box my cursor is in as the variable ($R1I1)??
Nahuel Posted October 3, 2007 Posted October 3, 2007 Look here, might help:http://www.autoitscript.com/forum/index.ph...hl=controlhover
GaryFrost Posted October 3, 2007 Posted October 3, 2007 with slight modification yep. expandcollapse popup#include <GuiConstants.au3> ; comment out the following 4 lines if using beta 3.2.9.2 or above Global Const $WM_COMMAND = 0x0111 Global Const $EN_CHANGE = 0x300 Global Const $EN_SETFOCUS = 0x100 Global Const $EN_KILLFOCUS = 0x200 Global Const $DebugIt = 1 Global $DEFAULTINPUTDATA = "Click and type something here..." Global $NONEAACTIVECOLOR = 0x989898 Global $Input _Main() Func _Main() Local $GUI, $ExitButton, $y = 20 $GUI = GUICreate("Check Inputs Demo", 280, 150) For $x = 0 To 2 If IsArray($Input) Then ReDim $Input[UBound($Input) + 1] Else Dim $Input[1] EndIf $Input[UBound($Input) - 1] = GUICtrlCreateInput($DEFAULTINPUTDATA, 15, $y, 250, 20) GUICtrlSetColor(-1, $NONEAACTIVECOLOR) $y += 40 Next $ExitButton = GUICtrlCreateButton("Exit", 110, 125, 60, 20) GUICtrlSetState(-1, $GUI_DEFBUTTON) ControlFocus($GUI, "", $ExitButton) GUISetState() GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND") While 1 Switch GUIGetMsg() Case $ExitButton, $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd EndFunc ;==>_Main Func _Input_Changed($hControl) ;---------------------------------------------------------------------------------------------- If $DebugIt Then _DebugPrint("Input Changed:" & GUICtrlRead($hControl)) ;---------------------------------------------------------------------------------------------- EndFunc ;==>_Input_Changed Func _Input_SetFocus($hControl) ;---------------------------------------------------------------------------------------------- If $DebugIt Then _DebugPrint("Input SetFocus") ;---------------------------------------------------------------------------------------------- If GUICtrlRead($hControl) = $DEFAULTINPUTDATA Then GUICtrlSetData($hControl, "") GUICtrlSetColor($hControl, 0x000000) EndFunc ;==>_Input_SetFocus Func _Input_KillFocus($hControl) ;---------------------------------------------------------------------------------------------- If $DebugIt Then _DebugPrint("Input KillFocus") ;---------------------------------------------------------------------------------------------- If Not StringLen(GUICtrlRead($hControl)) Then GUICtrlSetData($hControl, $DEFAULTINPUTDATA) GUICtrlSetColor($hControl, $NONEAACTIVECOLOR) EndFunc ;==>_Input_KillFocus Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam) Local $nNotifyCode = BitShift($wParam, 16) ; high word Local $nID = BitAND($wParam, 0xFFFF) ; low word Local $hCtrl = $lParam For $x = 0 To UBound($Input) - 1 Switch $nID Case $Input[$x] Switch $nNotifyCode Case $EN_CHANGE _Input_Changed($nID) Case $EN_SETFOCUS _Input_SetFocus($nID) Case $EN_KILLFOCUS _Input_KillFocus($nID) EndSwitch ExitLoop EndSwitch Next ; Proceed the default Autoit3 internal message commands. ; You also can complete let the line out. ; !!! But only 'Return' (without any value) will not proceed ; the default Autoit3-message in the future !!! Return $GUI_RUNDEFMSG EndFunc ;==>MY_WM_COMMAND Func _DebugPrint($s_Text, $line = @ScriptLineNumber, $file = @ScriptName) ConsoleWrite( _ "!===========================================================" & @LF & _ "+======================================================" & @LF & _ "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_Text & @LF & _ "+======================================================" & @LF) EndFunc ;==>_DebugPrint SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
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