dirty Posted November 12, 2011 Posted November 12, 2011 (edited) expandcollapse popup#include <GUIConstantsEx.au3> #include <EditConstants.au3> #Include <GuiListView.au3> $WindowTitle = "Title" $Gui = GUICreate ($WindowTitle,1024,768) GUICtrlCreateTab (0,0,1024,768) $CreateTab = GUICtrlCreateTabItem ("Create") GUICtrlCreateGroup ("Name your Project",5,25,240,65) $CreateNameInput = GUICtrlCreateInput ("__Name....",10,40,190,20) GUICtrlSetTip ($CreateNameInput,"This will be your Project Name","Information",1) $CreateNumberCombo = GUICtrlCreateCombo ("",10,60,190,20) GUICtrlSetData ($CreateNumberCombo,"Select Project number pattern|0123456789","Select Project number pattern") $CreateNameButton = GUICtrlCreateButton ("Create",200,40,40,40) GUICtrlCreateTabItem ("") $DecontamTAB = GUICtrlCreateTabItem ("Decontam") GUICtrlCreateGroup ("Scan your Project",5,25,240,40) $DeconScanInput = GUICtrlCreateInput ("__Scan....",10,40,190,20) GUICtrlSetTip ($DeconScanInput,"You can select this field and scan an item or you can manualy enter whole number.","Information",1) $AddToDecontamListButton = GUICtrlCreateButton ("Add",200,40,40,20) GUICtrlCreateTabItem ("") $AssemblyTAB = GUICtrlCreateTabItem ("Assembly") GUICtrlCreateTabItem ("") $SterilizationTAB = GUICtrlCreateTabItem ("Sterilization") GUICtrlCreateTabItem ("") $CenterCoreTAB = GUICtrlCreateTabItem ("Center Core") GUICtrlCreateTabItem ("") $CaseCartTAB = GUICtrlCreateTabItem ("Case Cart") GUICtrlCreateTabItem ("") $ORTAB = GUICtrlCreateTabItem ("OR") GUICtrlCreateTabItem ("") IniWrite ("SetNames.ini","All","","") $ListView = GUICtrlCreateListView ("Project Name|Project number|Location|Quantity|",10,110,350,200) GUISetState (@SW_SHOW,$Gui) _GUICtrlListView_RegisterSortCallBack($ListView) Global $NumberFromINI,$NameFromINI While 1 $MSG = GUIGetMsg() If $MSG = $GUI_EVENT_CLOSE Then ExitLoop If $MSG = $CreateTab Then GUICtrlSetState ($CreateNameInput,$GUI_FOCUS) ControlClick ($WindowTitle,"","Edit1","primary",2) EndIf If $MSG = $CreateNameButton Then $CreateName = GUICtrlRead ($CreateNameInput) $CreateNumber = GUICtrlRead ($CreateNumberCombo) IniWrite ("SetNames.ini","All",$CreateNumber,$CreateName) EndIf If $MSG = $DecontamTAB Then GUICtrlSetState ($DeconScanInput,$GUI_FOCUS) ControlClick ($WindowTitle,"","Edit3","primary",2) EndIf If $MSG = $AddToDecontamListButton Then $ReadDeconScanInput = GUICtrlRead ($DeconScanInput) If $ReadDeconScanInput > "" Then FindAssociatedName() GUICtrlCreateListViewItem ($NameFromINI & '|' & $NumberFromINI,$ListView) MsgBox(0,'',$NumberFromINI) MsgBox(0,'',$NameFromINI) Else MsgBox(0,'Error','dont use blank') EndIf EndIf WEnd Func FindAssociatedName() $NumberFromINI = IniRead ("SetNames.ini","All",$ReadDeconScanInput,"No Project associated with this number.") $NameFromINI = IniRead ("SetNames.ini","All",$ReadDeconScanInput,"No Project associated with this number.") EndFunc i am trying to highlight input control and double click it so that all text in it is highlighted ready for user input. If $MSG = $CreateTab Then GUICtrlSetState ($CreateNameInput,$GUI_FOCUS) ControlClick ($WindowTitle,"","Edit1","primary",2) EndIf is not working. am i doing it wrong ? thanks Edited November 12, 2011 by dirty
Moderators Melba23 Posted November 12, 2011 Moderators Posted November 12, 2011 dirty, am i doing it wrong ?Yes! Firstly you will never detect the click on the TabItem - you need to detect the click on the main Tab control and then use GUICtrlRead to find out which TabItem has been selected. Look at this: While 1 $MSG = GUIGetMsg() If $MSG = $GUI_EVENT_CLOSE Then ExitLoop If $MSG = $Tab Then ; Was a tab control header clicked? Switch GUICtrlRead($Tab, 1) ; Here we find out which one - using the advanced parameter returns the ControlID Case $CreateTab ; And so we can now check if it was the Create TabItem You will have to adjust the code so that all the TabItems are included in the Switch structure. Now we have correctly identified the TabItem we can select the text in the input - like this: Case $CreateTab GUICtrlSetState($CreateNameInput, $GUI_FOCUS) ; Focus the input Send("+{END}") ; Send Shift-End to highlight the content All clear? 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
Zedna Posted November 12, 2011 Posted November 12, 2011 #Include <GuiEdit.au3> _GUICtrlEdit_SetSel($hWnd, $iStart, $iEnd) Resources UDF ResourcesEx UDF AutoIt Forum Search
dirty Posted November 12, 2011 Author Posted November 12, 2011 yes thanks i got it. one thing was confusing that i didnt know what you meant by $Tab After creating variable $Tab for GUICtrlCreateTab it worked. Thanks
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