mtmartis Posted September 2, 2010 Share Posted September 2, 2010 I would like the default active control to be my input control, it's defaulting to the Connect Button, any suggestions?#include <ButtonConstants.au3>#include <EditConstants.au3>#include <GUIConstantsEx.au3>#include <StaticConstants.au3>#include <WindowsConstants.au3>#include <GuiIPAddress.au3>Global $Info$Form1_1 = GUICreate("Connect", 381, 144, -1, -1)$Img_Header = GUICtrlCreatePic(@ScriptDir & "\Header.bmp", 0, 0, 381, 63, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))$Label1 = GUICtrlCreateLabel("IP Address :", 8, 80, 88, 20)GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")$Connect = GUICtrlCreateButton("Connect", 110, 113, 75, 25, 0)$Cancel = GUICtrlCreateButton("Cancel", 190, 113, 75, 25, 0)$Clear = GUICtrlCreateButton("Clear IP", 280, 77, 75, 25, 0)$IPAddress1 = _GUICtrlIpAddress_Create($Form1_1, 110, 80, 155, 21)_GUICtrlIpAddress_Set($IPAddress1, "")$IP = _GUICtrlIpAddress_Get($IPAddress1)Pointer()While 1$nMsg = GUIGetMsg()Switch $nMsg Case $GUI_EVENT_CLOSE ExitCase $Connect MsgBox(0,'',$IP)Case $Cancel ExitCase $Clear _GUICtrlIpAddress_ClearAddress($IPAddress1)Case $Info SplashTextOn("Technical Support","Support Info","300","75","-1","-1",6,"Courier New","10","700") Sleep(4000) SplashOff()EndSwitchWEndFunc Pointer()$Info = GUICtrlCreateLabel("í", 360, 120, 20, 20)GUICtrlSetFont(-1, 16, 800, 0, "Times New Roman")GUICtrlSetColor(-1, 0x000080)GUICtrlSetCursor(-1,0)GUISetState(@SW_SHOW)EndFunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 2, 2010 Moderators Share Posted September 2, 2010 mtmartis,Add _WinAPI_SetFocus($IPAddress1) once the control is created. M23P.S. When you post code please use Code tags and not quotes. Put [autoit ] before and [/autoit ] after your posted code (but omit the trailing space - it is only there so the tags display here). Or press the blue button just under the BOLD toolbar button. 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...
Mat Posted September 2, 2010 Share Posted September 2, 2010 ControlFocus is what I would use... I like to use the internal functions where possible. Melba... The blue button is a pain - I wish it would be like the code button instead. When you edit in place it only gives me a single line input, and I lose all my line breaks. When it does work it puts the text at the top rather than at the caret. Maybe It's just me but I always add them manually now. AutoIt Project Listing Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 3, 2010 Moderators Share Posted September 3, 2010 Mat, You are right about the blue button - I always put the tags in manually as well. But some people seem unable to grasp the whole "tag" concept. 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...
somdcomputerguy Posted September 3, 2010 Share Posted September 3, 2010 (edited) I've used this function, GUICtrlSetState, to do that.Edit: I add the autoit tags manually too, because of that 'one-liner' thing.. Edited September 3, 2010 by somdcomputerguy - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 3, 2010 Moderators Share Posted September 3, 2010 somdcomputerguy,GUICtrlSetState will not work here because _GUICtrlIpAddress_Create returns a handle and not a ControlID. As a general rule, the GUICtrl* commands only work on controls created by the built-in GUICtrlCreate* functions as they require the internal AutoIt ControlIDs as parameters.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...
Mat Posted September 3, 2010 Share Posted September 3, 2010 (edited) I've used this function, GUICtrlSetState, to do that.Edit: I add the autoit tags manually too, because of that 'one-liner' thing..IP address is a non standard control (needs include) that means you won't be able to use that function in this case.Edit: Melba... How are you so fast? You always beat me to the reply button. Edited September 3, 2010 by Mat AutoIt Project Listing Link to comment Share on other sites More sharing options...
somdcomputerguy Posted September 3, 2010 Share Posted September 3, 2010 I didn't fully read the OP's code, so that's the excuse for my fault this time.. I should've realized that when you two posted (M23 and Mat), there was probably a good reason why that particular function wasn't being used.. Oh well, another lesson learned.. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
mtmartis Posted September 3, 2010 Author Share Posted September 3, 2010 mtmartis, Add _WinAPI_SetFocus($IPAddress1) once the control is created. M23 P.S. When you post code please use Code tags and not quotes. Put [autoit ] before and [/autoit ] after your posted code (but omit the trailing space - it is only there so the tags display here). Or press the blue button just under the BOLD toolbar button. Tnx Melba, that was exactly what I was looking for! Sorry about posting code in quotes, that's what I get for posting with a migraine! lol Link to comment Share on other sites More sharing options...
Mat Posted September 3, 2010 Share Posted September 3, 2010 I didn't fully read the OP's code, so that's the excuse for my fault this time.. I should've realized that when you two posted (M23 and Mat), there was probably a good reason why that particular function wasn't being used.. Oh well, another lesson learned.. The $IPAddress1 in Melba's snippet gave it away for me... I didn't look at the OP's code either AutoIt Project Listing Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 3, 2010 Moderators Share Posted September 3, 2010 Mat,I didn't look at the OP's code either 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...
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