litlmike Posted March 15, 2006 Posted March 15, 2006 Use Ctrl + F9 to open the GUI. I want the first input box to have a 'focus' (be selected) when the script is run. Currently, the user has to {TAB} twice to get to the first input box. How do I do this? expandcollapse popup#include <IE.au3> #include <Date.au3> #include <GUIConstants.au3> #include <GuiTab.au3> ; To do: Add Vacation Rentals ;Making GUI for 'How Many Storefronts?' Global $Paused, $o_IE Global $Paused, $cat_1, $cat_2, $cat_3, $discount, $cat_1A, $cat_2A, $cat_3A, $street, $city, $state, $Province, $Zip, $Country,$o_IE Global $company, $date_e, $date_i, $discountB, $o_Keywords, $contact, $email, $Calc, $total, $sf_input1a, $sf_input2a, $sf_input3a Global $CIS_inputa, $DA_inputa, $FA_inputa ;HotKeySet("^7","New_Proposal_Maker") ;HotKeySet("^8","Proposal_2597") HotKeySet("^9","GUI_Pick_Proposal_Types") HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") ;;;; Body of program would go here;;;; While 1 Sleep(100) WEnd ;;;;;;;; ; Pause and Escape Functions Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc Func GUI_Pick_Proposal_Types () ;Make GUI GUICreate("Input Data", 400, 450); ,(@DesktopWidth-640), (@DesktopHeight)/4 GUISetState(@SW_SHOW) ; will display an empty dialog box $a = 30 $b = 310 $y = 40 $Z = 325 $zero = 0 $v = 250 GUICtrlCreateLabel ("Enter the # of Storefronts @ $2997", 10, $a) GUICtrlCreateLabel ("Enter the # of Storefronts @ $2597", 10, $a + $y) GUICtrlCreateLabel ("Enter the # of Storefronts @ $2200", 10, $a + ($y)*2) GUICtrlCreateLabel ("Enter the # of CIS", 10, $a + ($y)*3) GUICtrlCreateLabel ("Enter the # of DA", 10, $a + ($y)*4) GUICtrlCreateLabel ("Enter the # of FA", 10, $a + ($y)*5) GUICtrlCreateLabel ("Qty.", $v, $a - 15) GUICtrlCreateLabel ("Discount per SF", $Z - 15,$a - 15 ) $Calc = GUICtrlCreateButton ("Done", 200, 400) $sf_input1a = GUICtrlCreateInput ($zero,$v,$a, 35); left side box $sf_input1 = GUICtrlCreateInput ($zero,$z,$a, 35); right side box $sf_input2a = GUICtrlCreateInput ($zero,$v,$a + ($y), 35); left side box $sf_input2 = GUICtrlCreateInput ($zero,$z,$a + ($y), 35); right side box $sf_input3a = GUICtrlCreateInput ($zero,$v,$a + ($y)*2, 35); left side box $sf_input3 = GUICtrlCreateInput ($zero,$z,$a + ($y)*2, 35); right side box $CIS_inputa = GUICtrlCreateInput ($zero,$v,$a + ($y)*3, 35); left side box $CIS_input = GUICtrlCreateInput ($zero,$z,$a + ($y)*3, 35); right side box $DA_inputa = GUICtrlCreateInput ($zero,$v,$a + ($y)*4, 35); left side box $DA_input = GUICtrlCreateInput ($zero,$z,$a + ($y)*4, 35); right side box $FA_inputa = GUICtrlCreateInput ($zero,$v,$a + ($y)*5, 35); left side box $FA_input = GUICtrlCreateInput ($zero,$z,$a + ($y)*5, 35); right side box $SF1 = 2997 $SF2 = 2597 $SF3 = 2200 $FA = 97 $DA = .018 $CIS = 597 GUICtrlCreateLabel ("Total Price", $Z,310 ) $TotalLabelUpdatedInRealTime = GUICtrlCreateLabel ("", $Z,$b + 15,50 ); Here is where the 'Real-Time' should happen GUISetState(@SW_SHOW) ; will display an empty dialog box ; Run the GUI until the dialog is closed Do $msg = GUIGetMsg() ; $item = Not $item ; _GUICtrlTabSetCurFocus ($sf_input1a, "") $tempTotal = ((GUICtrlRead($sf_input1a) * $SF1) + (GUICtrlRead($sf_input2a) * $SF2) + (GUICtrlRead($sf_input3a) * $SF3) + _ (GUICtrlRead($CIS_inputa) * $CIS) + (GUICtrlRead($DA_inputa) * $DA) + (GUICtrlRead($FA_inputa) * $FA)) - _ ((GUICtrlRead($sf_input1a) * GUICtrlRead($sf_input1)) + (GUICtrlRead($sf_input2a) * GUICtrlRead($sf_input2)) + _ (GUICtrlRead($sf_input3a) * GUICtrlRead($sf_input3)) + _ (GUICtrlRead($CIS_inputa) * GUICtrlRead($CIS_input)) + (GUICtrlRead($DA_inputa) * GUICtrlRead($DA_input)) + _ (GUICtrlRead($FA_inputa) * GUICtrlRead($FA_input))) If $tempTotal <> $total Then $total = $tempTotal GuiCtrlSetData($TotalLabelUpdatedInRealTime, $total) ElseIf $tempTotal == 0 Then GuiCtrlSetData($TotalLabelUpdatedInRealTime, $tempTotal) EndIf If $msg = $Calc Then ;WriteProposal() GUISetState(@SW_HIDE) Return EndIf If $msg = $sf_input1 Then GUICtrlRead($sf_input1); get the value ;GUICtrlRead($discount); get the value EndIf If $msg = $sf_input2 Then GUICtrlRead($sf_input2); get the value ;GUICtrlRead($discount); get the value EndIf If $msg = $sf_input3 Then GUICtrlRead($sf_input3); get the value ;GUICtrlRead($discount); get the value EndIf If $msg = $CIS_input Then GUICtrlRead($CIS_input) EndIf If $msg = $DA_input Then GUICtrlRead($DA_input) EndIf If $msg = $FA_input Then GUICtrlRead($FA_input) EndIf If $msg = $sf_input1a Then GUICtrlRead($sf_input1a) EndIf If $msg = $sf_input2a Then GUICtrlRead($sf_input2a) EndIf If $msg = $sf_input3a Then GUICtrlRead($sf_input3a) EndIf If $msg = $CIS_inputa Then GUICtrlRead($CIS_inputa) EndIf If $msg = $DA_inputa Then GUICtrlRead($DA_inputa) EndIf If $msg = $FA_inputa Then GUICtrlRead($FA_inputa) EndIf Until $msg = $GUI_EVENT_CLOSE Return EndFunc _ArrayPermute()_ArrayUnique()Excel.au3 UDF
GaryFrost Posted March 15, 2006 Posted March 15, 2006 I don't have the IE.au3 at the moment but try adding the line right after the guisetstate GUISetState(@SW_SHOW) ; will display an empty dialog box GUICtrlSetState($sf_input1,$GUI_FOCUS) SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
litlmike Posted March 15, 2006 Author Posted March 15, 2006 I don't have the IE.au3 at the moment but try adding the line right after the guisetstate GUISetState(@SW_SHOW) ; will display an empty dialog box GUICtrlSetState($sf_input1,$GUI_FOCUS)Thank you very much! Works like a charm!I had no idea that $GUI_FOCUS existed. _ArrayPermute()_ArrayUnique()Excel.au3 UDF
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