strate Posted December 20, 2006 Share Posted December 20, 2006 I have a gui with just two inputs and a button. I made the tab order so that the user can enter data into the first input hit enter enter data into the second input hit enter this creates a focus on the button user hits enter again to return to the first input then repeats. What happens though is that after the first time thru the button is disabled and the user will have to click on it with the mouse. I need it so that the user can keep hitting enter. If after the first time thru, you activate a different window then return to the GUI it will accept the enter key stroke. How can this be fixed? I've tried setting focus to it but that doesn't help. INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station... Link to comment Share on other sites More sharing options...
Valuater Posted December 20, 2006 Share Posted December 20, 2006 depends on where you put the $GUI_FOCUS.. also.... maybe you can use GUICtrlSetStyle ($button, $BS_DEFPUSHBUTTON ) in the right places ( no code... no testing for you ) 8) Link to comment Share on other sites More sharing options...
strate Posted December 20, 2006 Author Share Posted December 20, 2006 Yeah I'm trying to get useable code. INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station... Link to comment Share on other sites More sharing options...
strate Posted December 20, 2006 Author Share Posted December 20, 2006 (edited) expandcollapse popup#include <GUIConstants.au3> #Include <GuiList.au3> $Form1 = GUICreate("Labels", 682, 460, 228, 186) $Group3 = GUICtrlCreateGroup("Identification Labels", 240, 88, 201, 153) GUICtrlSetColor(-1, 0x0000FF) $Label8 = GUICtrlCreateLabel("Quantity on Label:", 256, 112, 90, 16) $IDQty = GUICtrlCreateInput("", 256, 128, 89, 21) $Label9 = GUICtrlCreateLabel("Number of labels with this quantity:", 256, 160, 167, 16) $IDQtyofLabels = GUICtrlCreateInput("", 256, 176, 89, 21) $IDAdd = GUICtrlCreateButton("Add", 256, 208, 89, 20, 0) GUICtrlCreateGroup("", -99, -99, 1, 1) $List1 = GUICtrlCreateList("", 464, 308, 201, 123) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $IDAdd Local $QtyPerLabel = GUICtrlRead($IDQty) Local $QtyofLabels = GUICtrlRead($IDQtyofLabels) If $QtyPerLabel = '' Or $QtyofLabels = '' Then ContinueLoop If $QtyofLabels > 1 Then _GUICtrlListAddItem($List1, $QtyofLabels & ' labels at a quantity of ' & $QtyPerLabel) Else _GUICtrlListAddItem($List1, $QtyofLabels & ' label at a quantity of ' & $QtyPerLabel) EndIf GUICtrlSetData($IDQty,'') GUICtrlSetData($IDQtyofLabels,'') GUICtrlSetState($IDQty,$GUI_FOCUS) Case $GUI_EVENT_CLOSE Exit EndSwitch If StringInStr(ControlGetFocus($Form1),'Edit') Then HotKeySet('{ENTER}','_CatchEnterThenTab') Else HotKeySet('{ENTER}') EndIf WEnd Func _CatchEnterThenTab() Send('{TAB}') EndFunc EDIT: I was wrong about the GUI_Focus it was to return it to the first input. Edited December 20, 2006 by strate INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station... Link to comment Share on other sites More sharing options...
Valuater Posted December 20, 2006 Share Posted December 20, 2006 maybe..... expandcollapse popup#include <GUIConstants.au3> #Include <GuiList.au3> $Form1 = GUICreate("Labels", 682, 460, 228, 186) $Group3 = GUICtrlCreateGroup("Identification Labels", 240, 88, 201, 153) GUICtrlSetColor(-1, 0x0000FF) $Label8 = GUICtrlCreateLabel("Quantity on Label:", 256, 112, 90, 16) $IDQty = GUICtrlCreateInput("", 256, 128, 89, 21) $Label9 = GUICtrlCreateLabel("Number of labels with this quantity:", 256, 160, 167, 16) $IDQtyofLabels = GUICtrlCreateInput("", 256, 176, 89, 21) $IDAdd = GUICtrlCreateButton("Add", 256, 208, 89, 20, $BS_DEFPUSHBUTTON) GUICtrlCreateGroup("", -99, -99, 1, 1) $List1 = GUICtrlCreateList("", 464, 308, 201, 123) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $IDAdd Local $QtyPerLabel = GUICtrlRead($IDQty) Local $QtyofLabels = GUICtrlRead($IDQtyofLabels) If $QtyPerLabel = '' Or $QtyofLabels = '' Then ContinueLoop If $QtyofLabels > 1 Then _GUICtrlListAddItem($List1, $QtyofLabels & ' labels at a quantity of ' & $QtyPerLabel) Else _GUICtrlListAddItem($List1, $QtyofLabels & ' label at a quantity of ' & $QtyPerLabel) EndIf GUICtrlSetData($IDQty,'') GUICtrlSetData($IDQtyofLabels,'') GUICtrlSetState($IDQty,$GUI_FOCUS) Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd 8) Link to comment Share on other sites More sharing options...
SandelPerieanu Posted December 21, 2006 Share Posted December 21, 2006 expandcollapse popup#include <GUIConstants.au3> #Include <GuiList.au3> $form1 = GUICreate("Labels", 682, 460, 228, 186) $group3 = GUICtrlCreateGroup("Identification Labels", 240, 88, 201, 153) GUICtrlSetColor(-1, 0x0000FF) $label8 = GUICtrlCreateLabel("Quantity on Label:", 256, 112, 90, 16) $idqty = GUICtrlCreateInput("", 256, 128, 89, 21) $label9 = GUICtrlCreateLabel("Number of labels with this quantity:", 256, 160, 167, 16) $idqtyoflabels = GUICtrlCreateInput("", 256, 176, 89, 21) $idadd = GUICtrlCreateButton("Add", 256, 208, 89, 20, $bs_defpushbutton) GUICtrlCreateGroup("", -99, -99, 1, 1) $list1 = GUICtrlCreateList("", 464, 308, 201, 123) GUISetState(@SW_SHOW) While 1 $nmsg = GUIGetMsg() Switch $nmsg Case $idadd Local $qtyperlabel = GUICtrlRead($idqty) Local $qtyoflabels = GUICtrlRead($idqtyoflabels) Local $complete = True If $qtyperlabel = '' And $complete Then $complete = False GUICtrlSetState($idqty, $gui_focus) EndIf If $qtyoflabels = '' And $complete Then $complete = False GUICtrlSetState($idqtyoflabels, $gui_focus) EndIf If $complete Then If $qtyoflabels > 1 Then _GUICtrlListAddItem($list1, $qtyoflabels & ' labels at a quantity of ' & $qtyperlabel) Else _GUICtrlListAddItem($list1, $qtyoflabels & ' label at a quantity of ' & $qtyperlabel) EndIf GUICtrlSetData($idqty, '') GUICtrlSetData($idqtyoflabels, '') GUICtrlSetState($idqty, $gui_focus) EndIf Case $gui_event_close Exit EndSwitch WEnd 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