dzlee Posted April 17, 2015 Share Posted April 17, 2015 hi autoit developers i would like to ask .. if there is any way to use "GUICtrlSetStyle" function to set style "$ES_READONLY" for all inputs in my script thanks Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 17, 2015 Moderators Share Posted April 17, 2015 dzlee,You will have to set that style for each input as it is created. But you could shorten the process by using a wrapper function like this:#include <GUIConstantsEx.au3> #include <EditConstants.au3> $hGUI = GUICreate("Test", 500, 500) $cInput1 =_CreateInput("Input 1", 10, 10, 200, 20) ; Use the wrapper function to create the input $cInput2 =_CreateInput("Input 2", 10, 50, 200, 20) $cInput3 =_CreateInput("Input 3", 10, 90, 200, 20) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _CreateInput($sText, $iX, $iY, $iW, $iH) Local $cID = GUICtrlCreateInput($sText, $iX, $iY, $iW, $iH) ; Create input GUICtrlSetStyle($cID, BitOr($ES_LEFT, $ES_AUTOHSCROLL, $ES_READONLY)) ; Set required style Return $cID EndFuncHow does that suit your requirements? M23 dzlee 1 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...
dzlee Posted April 17, 2015 Author Share Posted April 17, 2015 (edited) Melba23 thanks for the fast reply i have about 100 input in my script i would like to make all inputs read only when the user press a button and restore them bake when the user press that button again is there an easy way to do that ? Edited April 17, 2015 by dzlee Link to comment Share on other sites More sharing options...
Moderators Solution Melba23 Posted April 17, 2015 Moderators Solution Share Posted April 17, 2015 dzlee,That is not what you asked the first time - please try and be specific when you ask questions so we do not waste our time writing code which will obviously not meet the requirement. I suggest you store the input ControlIDs in an array and then loop through it like this:expandcollapse popup#include <GUIConstantsEx.au3> #include <EditConstants.au3> Global $aInput[3] $hGUI = GUICreate("Test", 500, 500) $aInput[0] =_CreateInput("Input 0", 10, 10, 200, 20) $aInput[1] =_CreateInput("Input 1", 10, 50, 200, 20) $aInput[2] =_CreateInput("Input 2", 10, 90, 200, 20) $cToggle = GUICtrlCreateButton("Editable", 10, 200, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cToggle Switch GUICtrlRead($cToggle) Case "Editable" For $i = 0 To 2 GUICtrlSetStyle($aInput[$i], BitOr($ES_LEFT, $ES_AUTOHSCROLL)) Next GUICtrlSetData($cToggle, "Read Only") Case Else For $i = 0 To 2 GUICtrlSetStyle($aInput[$i], BitOr($ES_LEFT, $ES_AUTOHSCROLL, $ES_READONLY)) Next GUICtrlSetData($cToggle, "Editable") EndSwitch EndSwitch WEnd Func _CreateInput($sText, $iX, $iY, $iW, $iH) Local $cID = GUICtrlCreateInput($sText, $iX, $iY, $iW, $iH) GUICtrlSetStyle($cID, BitOr($ES_LEFT, $ES_AUTOHSCROLL, $ES_READONLY)) Return $cID EndFuncBetter? M23 dzlee 1 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...
dzlee Posted April 17, 2015 Author Share Posted April 17, 2015 (edited) thanks , and sorry for unclear question solved Edited April 17, 2015 by dzlee 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