bonebreaker Posted January 23, 2007 Posted January 23, 2007 Hi, maybe noob question but how can i get the id of the inputbox in which the cursor is? I need it because i have buttons which would send keys to the inputbox in which the cursor is.. I can't do this since when i press the button the the cursor diappears so the only method is to record the cursor position constantly.. thx for the help My programs:[topic="40019"]Sudoku[/topic], [topic="41258"]Suitcase game & Random jokes[/topic], [topic="41641"]8 Queens[/topic], [topic="41679"]Puzzle Generator[/topic], [topic="42045"]Snake[/topic]My UDFs:[topic="41309"]Prime functions & Prime game[/topic]Other:Fake emailer
_Kurt Posted January 23, 2007 Posted January 23, 2007 Well, I think this is what you want: $pos = MouseGetPos () MsgBox(0,"","X position of mouse = " & $pos[0] & @CRLF & "Y position of mouse = " & $pos[1]) Description of MouseGetPos(): Returns a two-element array that containing the mouse coordinates: $array[0] = X coord (horizontal), $array[1] = Y coord (vertical) Kurt Awaiting Diablo III..
bonebreaker Posted January 23, 2007 Author Posted January 23, 2007 Well, I think this is what you want:$pos = MouseGetPos () MsgBox(0,"","X position of mouse = " & $pos[0] & @CRLF & "Y position of mouse = " & $pos[1])Description of MouseGetPos():Returns a two-element array that containing the mouse coordinates: $array[0] = X coord (horizontal), $array[1] = Y coord (vertical)KurtAnwsering without reading the post, smart Thx anyway My programs:[topic="40019"]Sudoku[/topic], [topic="41258"]Suitcase game & Random jokes[/topic], [topic="41641"]8 Queens[/topic], [topic="41679"]Puzzle Generator[/topic], [topic="42045"]Snake[/topic]My UDFs:[topic="41309"]Prime functions & Prime game[/topic]Other:Fake emailer
crzftx Posted January 23, 2007 Posted January 23, 2007 I have not used it, but I think you would use ControlGetFocus()
bonebreaker Posted January 24, 2007 Author Posted January 24, 2007 I have not used it, but I think you would use ControlGetFocus()Can't realy make it work, i would only want to get the control id if its an inputbox, any idea on doing that ?The other solution would be if buttons couldn't get focus..is that solveable ? My programs:[topic="40019"]Sudoku[/topic], [topic="41258"]Suitcase game & Random jokes[/topic], [topic="41641"]8 Queens[/topic], [topic="41679"]Puzzle Generator[/topic], [topic="42045"]Snake[/topic]My UDFs:[topic="41309"]Prime functions & Prime game[/topic]Other:Fake emailer
Isildur Posted January 24, 2007 Posted January 24, 2007 You can get the control id of an inputbox with the helf of "AutoIt Window Info" or with the programme Spy ++. Or you do this: $inputbox = InputBox ... Then $inputbox will be the control id.
eltorro Posted January 24, 2007 Posted January 24, 2007 I think this may do what you want: expandcollapse popup;Control Id from ClassnameNN --eltorro <steve at ocotillo sytes net> $Gui = GuiCreate("Input Test") $Input1 = GUICtrlCreateInput("",5,5,100,20) $Input2 = GuiCtrlCreateInput("",5,25,100,20) $Input3 = GuiCtrlCreateInput("",5,50,100,20) GUISetState() $lastCNN ="" Opt("WinTitleMatchMode",4) While 1 $nMsg = GuiGetMsg() if $nMsg = -3 then Exit $control = ControlGetFocus("Input Test","") if StringLeft($control,4) = "Edit" then if $lastCNN <> $control Then $lastCNN = $control ConsoleWrite($control&@LF) $cHwnd = ControlGetHandle("Input Test","",$control) if $cHwnd Then $CtrlId = _GetDlgCtrlID($cHwnd) ConsoleWrite("Control ID = "&$CtrlId&@LF) EndIf EndIf EndIf Switch $nMsg Case -3 Exit Case $Input1 ConsoleWrite("Control Id ="&$Input1&@LF) Case $Input2 ConsoleWrite("Control Id ="&$Input2&@LF) Case $Input3 ConsoleWrite("Control Id ="&$Input3&@LF) Case Else ;;; EndSwitch sleep(10) WEnd Exit ;=============================================================================== ; Function Name: GetDlgCtrlID ; Description: ; Parameter(s): $hwnd Handle of control ; Requirement(s): Beta (for dllcall) ; Return Value(s): Control Id on success ; Author(s): ;=============================================================================== Func _GetDlgCtrlID($hwnd) $ID = DllCall('user32.dll', 'int', 'GetDlgCtrlID', 'hwnd', $hwnd) if IsArray ($ID) Then Return $ID[0] Return 0 EndFunc ;==>GetDlgCtrlID Regards, eltorro Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code
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