tommytx Posted March 3, 2012 Posted March 3, 2012 Can someone help me with this code... I got all of it working with exception of 2 things. 1. Upon loading I want to set the cursor in the input box ready to type. 2. add the additional method of submit by hitting enter to submit also as speed is improtant. Thanks I am sure this is a piece of cake for most of you pros.. if you need to see an image which I doubt just place any image named image\image.jpg width=300 and height=70 .. but you should not need that.... Thanks... expandcollapse popup#include <GUIConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <SendMessage.au3> Global Const $SC_DRAGMOVE = 0xF012 $title="" $width = 330 $height = 130 $left = 600 $top = 100 $gui = GUICreate($title, $width, $height, $left, $top, $WS_POPUP) GUISetBkColor(0xE0FFFF) $n = GUICtrlCreatePic(@ScriptDir & "\image\image.jpg", 10, 10, 310, 75) GUISetState() $title="" $width = 200 $height = 20 $left = 10 $top = 95 $str = GUICtrlCreateInput($title, $left, $top, $width, $height) $title="Submit" $width = 80 $height = 20 $left = 240 $top = 95 $press=GUICtrlCreateButton($title, $left, $top, $width, $height) _WinAPI_SetLayeredWindowAttributes($gui, 0x01, 255) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_MINIMIZE GUISetState(@SW_RESTORE) Case $press MsgBox(4096, "No Drag Drop.", GUICtrlRead($str)) Exit Case $GUI_EVENT_PRIMARYDOWN _SendMessage($gui, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndSwitch WEnd
Kyan Posted March 3, 2012 Posted March 3, 2012 ControlFocus ($gui, "", $str)I don't read all the topic, if you want to send something use ControlSend Heroes, there is no such thing One day I'll discover what IE.au3 has of special for so many users using it.C'mon there's InetRead and WinHTTP, way better
Moderators Melba23 Posted March 3, 2012 Moderators Posted March 3, 2012 tommytx,Add these lines between the GUISetState and While lines:; Set the keyboard focus to the input GUICtrlSetState($str, $GUI_FOCUS) ; Set an accelerator key - ENTER will fire $press Local $aAccelKeys[1][2] = [["{ENTER}", $press]] GUISetAccelerators($aAccelKeys)Look at the functions in the Help file and ask if you still have questions. 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
tommytx Posted March 3, 2012 Author Posted March 3, 2012 Thanks Diogo.. that worked great for the first question.. the attention to the input box... I just thought of a way to do item 2. Make the input box submit when enter is hit also.. Not sure if its the correct or best way but here it is.. If anyone has a simpler or better idea please chime in.. meantime this will work.. but I doubt its the official Autoit way...anyway see it below... < HotKeySet("{ENTER}", "Submit") Func Submit() MsgBox(4096, "No Drag Drop.", GUICtrlRead($str)) Exit EndFunc >
Moderators Melba23 Posted March 3, 2012 Moderators Posted March 3, 2012 tommytx,Take a look at my post above - you were close but Accelerator keys work better for this sort of thing as they are only active when your GUI is active. Making an input fire on an ENTER key press is not as easy as you might think, but it can be done - search the forum. 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
tommytx Posted March 5, 2012 Author Posted March 5, 2012 Thanks for that Melba, you are right.. the Accelerator works much better... can you tell me how to Dim this so I can add it to my Dim's at the top of the page.. Since it would not work till I place it far down into the code... how do i add the sucker to my Dim maybe like this.. Dim $aAccelKeys or Dim $aAccelKeys[][] etc? Then just use this down later... $aAccelKeys[2][2]=[["{ENTER}", $press] When I put it toward the top it did not work... _WinAPI_SetLayeredWindowAttributes($gui, 0x01, 255) GUISetState(@SW_SHOW) Dim $aAccelKeys[2][2]=[["{ENTER}", $press] GUISetAccelerators($aAccelKeys)
tommytx Posted March 5, 2012 Author Posted March 5, 2012 Oh.. DiGo can you tell me what to add to keep this GUI always on top... Thanks..
Moderators Melba23 Posted March 5, 2012 Moderators Posted March 5, 2012 tommytx,You just need to declare the name at the top of the script - no need for [ ][ ]: Global $aAccelKeysDo not use Dim - it is essentially deprecated. The Variables - using Global, Local and ByRef tutorial in the Wiki explains why. As to keeping the GUI on top - either use the $WS_EX_TOPMOST style or the WinSetOnTop function. 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
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