JayHawkfl Posted June 10, 2013 Share Posted June 10, 2013 There are two areas where I need my GUI to default to the "Enter/Submit/Total" buttons on their respective GUI's. I haven't found a way to make that happen. If I've missed something obvious, like a help file, please point me that direction. I've been stuck on this for a few days now and its the LAST feature request before I can lunch this. I tried to use _IsPressed to Cue the same commands, which is nasty looking and sloppy, but if that's the final answer and I've just done something wrong then that's fine too. I do plan on posting the full code on the example scripts for general use/review when I'm done. Thanks in advance for your time/help with this. expandcollapse popup#region ### START Koda GUI section ### ;Form=C:\Documents and Settings\Administrator\Desktop\Doug's AutoIT\Dev\TigerTool\TimeDateAdjust.kxf Local $TmpDate = _NowDate() Local $Hour = @HOUR If $Hour < 10 Then $Hour = String($Hour) $Hour = StringMid($Hour, "2", "1") EndIf Local $Minute = @MIN Local $AMorPM = "PM" $Form1 = GUICreate("Time", 275, 280, 192, 114) $MonthCal1 = GUICtrlCreateMonthCal($TmpDate, 24, 64, 225, 175) $HourInput = GUICtrlCreateCombo($Hour, 24, 24, 57, 21, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "1|2|3|4|5|6|7|8|9|10|11|12") $Label1 = GUICtrlCreateLabel("Hours", 24, 8, 32, 17) $MinuteInput = GUICtrlCreateCombo($Minute, 104, 24, 57, 21, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "00|05|10|15|20|25|30|35|40|45|50|55") $Label2 = GUICtrlCreateLabel("Minutes", 104, 8, 41, 17) $Label3 = GUICtrlCreateLabel("AM/PM", 184, 8, 41, 17) $Combo9 = GUICtrlCreateCombo("AM", 184, 24, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "PM") $UpDown1 = GUICtrlCreateUpdown($HourInput) $UpDown2 = GUICtrlCreateUpdown($MinuteInput) $Button17 = GUICtrlCreateButton("Submit", 24, 245, 225, 25) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### Local $hDLL = DllOpen("user32.dll") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete($Form1) ExitLoop Case $Button17 GUISetState(@SW_HIDE) $CapsLockTest = _GetCapsLock() If $CapsLockTest = 1 Then Send("{CAPSLOCK OFF}") $CapsLockReSet = 1 EndIf $TmpHour = GUICtrlRead($HourInput) $TmpMinute = GUICtrlRead($MinuteInput) $TmpAMorPM = GUICtrlRead($Combo9) $TmpDate = GUICtrlRead($MonthCal1) $TmpDate = StringMid($TmpDate, "6", "2") & "-" & StringMid($TmpDate, "9", "2") & "-" & StringMid($TmpDate, "1", "4") If $TmpHour < 10 Then $TmpHour = "0" & $TmpHour EndIf Sleep(50) Send($TmpDate & "---" & $TmpHour & ":" & $TmpMinute & " " & $TmpAMorPM & "--" & $TechName & "{ENTER}{ENTER}Hrs- {ENTER}{ENTER}{ENTER}{ENTER}{UP}{UP}{UP}{UP}{UP}") GUIDelete($Form1) If $CapsLockReSet = 1 Then Send("{CAPSLOCK ON}") $CapsLockReSet = 0 EndIf ExitLoop If _IsPressed("0D", $hDLL) Then ConsoleWrite("test test test test" & @CRLF) GUISetState(@SW_HIDE) $CapsLockTest = _GetCapsLock() If $CapsLockTest = 1 Then Send("{CAPSLOCK OFF}") $CapsLockReSet = 1 EndIf $TmpHour = GUICtrlRead($HourInput) $TmpMinute = GUICtrlRead($MinuteInput) $TmpAMorPM = GUICtrlRead($Combo9) $TmpDate = GUICtrlRead($MonthCal1) $TmpDate = StringMid($TmpDate, "6", "2") & "-" & StringMid($TmpDate, "9", "2") & "-" & StringMid($TmpDate, "1", "4") If $TmpHour < 10 Then $TmpHour = "0" & $TmpHour EndIf Sleep(50) Send($TmpDate & "---" & $TmpHour & ":" & $TmpMinute & " " & $TmpAMorPM & "--" & $TechName & "{ENTER}{ENTER}Hrs- {ENTER}{ENTER}{ENTER}{ENTER}{UP}{UP}{UP}{UP}{UP}") GUIDelete($Form1) If $CapsLockReSet = 1 Then Send("{CAPSLOCK ON}") $CapsLockReSet = 0 EndIf EndIf ExitLoop EndSwitch WEnd Thanks for your time Link to comment Share on other sites More sharing options...
FireFox Posted June 10, 2013 Share Posted June 10, 2013 (edited) Hi,I'm not sure to understand your issue, have you tried the HotKeySet function? Ah, got it. thanks Melba Br, FireFox. Edited June 10, 2013 by FireFox Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 10, 2013 Moderators Share Posted June 10, 2013 JayHawkfl,There are several ways to get a button set to default to "Press on Enter" - the $BS_DEFPUSHBUTTON style, the $GUI_DEFBUTTON state, and linking it to an Accelerator key. I seem to remember that you can only have one button styled as the default per GUI (or even script), so as you seem to want several instances you might want to look at the style or the Accelerator key options (I would use the latter myself). Give it a go and see what you can come up with - you know where we are if you run into difficulties. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Solution DW1 Posted June 10, 2013 Solution Share Posted June 10, 2013 (edited) You can just put this in right after declaring $Button17 Local $AccelKeys[1][2] = [["{enter}", $Button17]] GUISetAccelerators($AccelKeys) EDIT: I'm late to the party Edited June 10, 2013 by danwilli AutoIt3 Online Help Link to comment Share on other sites More sharing options...
JayHawkfl Posted June 10, 2013 Author Share Posted June 10, 2013 (edited) Thank you so much everyone, for the answer and the quick replies, means SO MUCH that I can get this pushed out to everyone today. I'll post the full script on the example boards later today EDIT: Just had the oppurtunity to try it and that worked perfectly! THANK YOU THANK YOU THANK YOU Edited June 10, 2013 by JayHawkfl Thanks for your time 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