crystalburner Posted May 22, 2007 Share Posted May 22, 2007 Chaps When you have a GUI with InputBoxes you press tab to go to the next inputbox. Any way at all of having it accept ENTER or TAB to go to the next box? C Link to comment Share on other sites More sharing options...
Gif Posted May 22, 2007 Share Posted May 22, 2007 ChapsWhen you have a GUI with InputBoxes you press tab to go to the next inputbox.Any way at all of having it accept ENTER or TAB to go to the next box?C? inputbox accepts ENTERwell didnt quite understood what you "want" but HotKeySet() might be good Link to comment Share on other sites More sharing options...
Helge Posted May 22, 2007 Share Posted May 22, 2007 Maybe something like this...#include <GUIConstants.au3> GUICreate("", 300, 190) $nInput1 = GUICtrlCreateInput("", 10, 10, 280, 20) $nInput2 = GUICtrlCreateInput("", 10, 40, 280, 20) $nInput3 = GUICtrlCreateInput("", 10, 70, 280, 20) $nInput4 = GUICtrlCreateInput("", 10, 100, 280, 20) $nInput5 = GUICtrlCreateInput("", 10, 130, 280, 20) $nButton = GUICtrlCreateButton("Confirm", 10, 160, 280, 20) GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $nInput1, $nInput2, $nInput3, $nInput4, $nInput5 GUICtrlSetState($nMsg + 1, $GUI_FOCUS) Case $nButton GUISetState(@SW_HIDE) MsgBox(64, "", "OK") Exit EndSwitch WEndThe way I moved focus to next control here assumes that the controls are created after each others, but you can do it in in other ways too. Array of control-IDs, a Case for each control etc. You get the idea. Link to comment Share on other sites More sharing options...
crystalburner Posted May 22, 2007 Author Share Posted May 22, 2007 Maybe something like this...#include <GUIConstants.au3> GUICreate("", 300, 190) $nInput1 = GUICtrlCreateInput("", 10, 10, 280, 20) $nInput2 = GUICtrlCreateInput("", 10, 40, 280, 20) $nInput3 = GUICtrlCreateInput("", 10, 70, 280, 20) $nInput4 = GUICtrlCreateInput("", 10, 100, 280, 20) $nInput5 = GUICtrlCreateInput("", 10, 130, 280, 20) $nButton = GUICtrlCreateButton("Confirm", 10, 160, 280, 20) GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $nInput1, $nInput2, $nInput3, $nInput4, $nInput5 GUICtrlSetState($nMsg + 1, $GUI_FOCUS) Case $nButton GUISetState(@SW_HIDE) MsgBox(64, "", "OK") Exit EndSwitch WEndThe way I moved focus to next control here assumes that the controls are created after each others, but you can do it in in other ways too. Array of control-IDs, a Case for each control etc. You get the idea. Hmmm.. Link to comment Share on other sites More sharing options...
crystalburner Posted May 22, 2007 Author Share Posted May 22, 2007 Hmmm.. Would be okay if I knew how many inputboxes were in the GUI but I don't as the gui is built in a loop depending on an INI file (x is an integer read from the ini file) dim $inputbox[x] then for $i = 1 to ubound($inputbox) -1 guictrlcreateinput.....bla bla next I'm sort of playing with this in the main GUI loop, but only prob is I don't know the inputbox names 'editx' and I'm wondering if a while wend loop like this would be too consuming on resource, and Im playing with this code but $h isn't the input box name it's a hex key for $i=1to ubound($inputbox) -1 $h = GUICtrlGetHandle($q[$i]) Case _IsItPressed('0D') And ControlGetFocus($main) = $h MSGBOX(262144,'','You pressed Enter'); I'd jump to the next box here next Func _pr($v_R, $v_dll = 'user32.dll') $v_R = DllCall($v_dll, 'int', 'GetAsyncKeyState', 'int', '0x' & $v_R) Return (Not @error And BitAND($v_R[0], 0x8000) = 0x8000) * 1 EndFunc Link to comment Share on other sites More sharing options...
crystalburner Posted May 22, 2007 Author Share Posted May 22, 2007 Sorry Func _pr and _Isitpressed are the same typo Link to comment Share on other sites More sharing options...
crystalburner Posted May 22, 2007 Author Share Posted May 22, 2007 Sorry Func _pr and _Isitpressed are the same typoI could use just Case _IsItPressed('0D') And ControlGetFocus($main)And then * GET the currently selected inputboxname (eg. $box1) Do my thingBut I don't know how to do the line with the * the rest ok Link to comment Share on other sites More sharing options...
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