kcvinu Posted October 23, 2015 Posted October 23, 2015 Hi all,I have a form with 15 textboxes. I need to set all of them disabled when i press a button. So i decided to use a loop. But how can i do it. Any idea ? Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only)
Developers Jos Posted October 23, 2015 Developers Posted October 23, 2015 Use an array for the control handles so you can use a For..Next loop,Jos kcvinu 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
kcvinu Posted October 23, 2015 Author Posted October 23, 2015 Thank you @Jos. So simple answer. Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only)
smithan Posted October 31, 2015 Posted October 31, 2015 Use an array for the control handles so you can use a For..Next loop,Joshow can we use array ....can u give one small example?i am new to autoiti want to select checkbox using IE function how can i use array there ??
Developers Jos Posted October 31, 2015 Developers Posted October 31, 2015 There is a big difference between the question raised here, using your own gui with controls and using the IE functions.Why did you think they are related so I understand what you mean?Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
smithan Posted November 1, 2015 Posted November 1, 2015 hey,Already i have one webpage i want select checkbox ,i just want to know how can i do it ??which functions can be used
Developers Jos Posted November 1, 2015 Developers Posted November 1, 2015 Again, this thread is related to an AutoIt3 GUI, not a webpage.Create your own thread with the question in the appropriate forum.Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Danyfirex Posted November 1, 2015 Posted November 1, 2015 You can do something like this.expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 595, 375, 192, 124) $Input1 = GUICtrlCreateInput("Input1", 144, 24, 289, 21) $Label1 = GUICtrlCreateLabel("Label1", 160, 64, 36, 17) $Input2 = GUICtrlCreateInput("Input2", 152, 88, 281, 21) $Button1 = GUICtrlCreateButton("Button1", 208, 136, 129, 17) $Input3 = GUICtrlCreateInput("Input3", 32, 24, 89, 21) $Input4 = GUICtrlCreateInput("Input4", 400, 168, 129, 21) $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 72, 136, 97, 33) $Button2 = GUICtrlCreateButton("Button2", 488, 72, 65, 33) $Input5 = GUICtrlCreateInput("Input5", 176, 184, 193, 21) $Input6 = GUICtrlCreateInput("Input6", 416, 240, 129, 21) $Input7 = GUICtrlCreateInput("Input7", 40, 208, 217, 21) $Input8 = GUICtrlCreateInput("Input8", 96, 256, 193, 21) $Button3 = GUICtrlCreateButton("Disable Just Inputs", 200, 304, 209, 49) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button3 For $i=$Input1 to $Button3 if _WinAPI_GetClassName(GUICtrlGetHandle($i))="Edit" Then GUICtrlSetState($i,$GUI_DISABLE) EndIf Next EndSwitch WEndSaludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
kcvinu Posted November 1, 2015 Author Posted November 1, 2015 @Danyfirex , I am confuced. You are looping through what ? just through control IDs ?. Please clarify the for loop. Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only)
Danyfirex Posted November 1, 2015 Posted November 1, 2015 Yes I'm looping through all controls ID and check if is a Edit box. starting from first control ID (the first before the GUI) till last one. this case $button3. Saludos kcvinu 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
kcvinu Posted November 1, 2015 Author Posted November 1, 2015 Thanks. That is new knowledge for me to loop through declared control IDs. Then AutoIt considering control IDs as a list or range. Isn't it ? Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only)
Developers Jos Posted November 1, 2015 Developers Posted November 1, 2015 Look inside SciTEConfig for the code that set's up the the "Edit Colors" window. I use a For..Next loop to create the 3 columns of CheckBoxes and also a For..Next loop to see which are checked/Jos kcvinu 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Moderators Melba23 Posted November 1, 2015 Moderators Posted November 1, 2015 kcvinu,AutoIt ControlIDs are actually the index numbers of the internal array that AutoIt uses to track the native created controls. They are usually in numerical order, but to save space, the first empty index is used - this means that deleting controls will allow the same ControlID to be reused, as you can see here:#include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) For $i = 0 To 9 $cCID = GUICtrlCreateLabel("", 10, 10 + (20 * $i), 200, 20) GUICtrlSetData($cCID, $cCID) Next $cReuse = GUICtrlCreateButton("Delete/Recreate", 10, 450, 100, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cReuse GUICtrlDelete(5) $cCID = GUICtrlCreateLabel("", 10, 10 + (20 * $i), 200, 20) GUICtrlSetData($cCID, $cCID) EndSwitch WEndM23 kcvinu 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
kcvinu Posted November 1, 2015 Author Posted November 1, 2015 @Melba23 Interesting !. So if you delete a control, it's ID will be allotted to a new control. But why did this example only shows labels with number 3 ?. I expect it should start from zero. Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only)
kcvinu Posted November 1, 2015 Author Posted November 1, 2015 (edited) @Jos , Did you meant these lines ?For $x = 1 To 17 $H_Syn_Label[$x] = GUICtrlCreateLabel($Syn_Label[$x], $BaseX + 5, $BaseY + 20 * $x, 150, 20) $H_Syn_Bold[$x] = GUICtrlCreateCheckbox("", $BaseX + 170, $BaseY + 20 * $x, 20, 20) $H_Syn_Italic[$x] = GUICtrlCreateCheckbox("", $BaseX + 195, $BaseY + 20 * $x, 20, 20) $H_Syn_Underline[$x] = GUICtrlCreateCheckbox("", $BaseX + 220, $BaseY + 20 * $x, 20, 20) $H_Syn_fColor[$x] = GUICtrlCreateButton("Fore", $BaseX + 245, $BaseY + 20 * $x, 40, 20) $H_Syn_bColor_Standard[$x] = GUICtrlCreateCheckbox("", $BaseX + 295, $BaseY + 20 * $x, 20, 20) $H_Syn_bColor[$x] = GUICtrlCreateButton("Back", $BaseX + 320, $BaseY + 20 * $x, 40, 20) NextAnd these are the lines in which you checked for the control stateexpandcollapse popup; Check if one of the checkboxes is clicked For $x = 1 To 17 If $Msg = $H_Syn_bColor_Standard[$x] Then $Syn_bColor_Default[$x] = GUICtrlRead($H_Syn_bColor_Standard[$x]) If GUICtrlRead($H_Syn_bColor_Standard[$x]) = $GUI_CHECKED Then GUICtrlSetState($H_Syn_bColor[$x], $GUI_DISABLE) $Syn_bColor[$x] = $Background_Color GUICtrlSetBkColor($H_Syn_Label[$x], $Syn_bColor[$x]) Else GUICtrlSetState($H_Syn_bColor[$x], $GUI_ENABLE) EndIf $NeedsSave = 1 EndIf If $Msg = $H_Syn_Bold[$x] Then $Syn_Bold[$x] = Not $Syn_Bold[$x] $NeedsSave = 1 EndIf If $Msg = $H_Syn_Italic[$x] Then $Syn_Italic[$x] = Not $Syn_Italic[$x] $NeedsSave = 1 EndIf If $Msg = $H_Syn_Underline[$x] Then $Syn_Underline[$x] = Not $Syn_Underline[$x] $NeedsSave = 1 EndIf If $Msg = $H_Syn_fColor[$x] Then $tempcolor = SelectColor($Syn_fColor[$x]) $Syn_fColor[$x] = $tempcolor GUICtrlSetColor($H_Syn_Label[$x], $Syn_fColor[$x]) $NeedsSave = 1 EndIf If $Msg = $H_Syn_bColor[$x] Then $tempcolor = SelectColor($Syn_bColor[$x]) $Syn_bColor[$x] = $tempcolor GUICtrlSetBkColor($H_Syn_Label[$x], $Syn_bColor[$x]) $NeedsSave = 1 EndIf If $Msg = $H_Syn_Bold[$x] Or $Msg = $H_Syn_Italic[$x] Or $Msg = $H_Syn_Underline[$x] _ Or $Msg = $H_Syn_fColor[$x] Or $Msg = $H_Syn_bColor[$x] Then GUICtrlSetFont($H_Syn_Label[$x], $SYN_Font_Size, 400 + $Syn_Bold[$x] * 200, $Syn_Italic[$x] * 2 + $Syn_Underline[$x] * 4, $SYN_Font_Type) $NeedsSave = 1 EndIf Next Edited November 1, 2015 by kcvinu Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only)
Moderators Melba23 Posted November 1, 2015 Moderators Posted November 1, 2015 kcvinu,why did this example only shows labels with number 3 ?.The first ControlID returned has always been 3 since I started using AutoIt - you will have to ask Jon why, but I imagine that the earlier elements are used for other things that AutoIt needs to track.M23 kcvinu 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
kcvinu Posted November 1, 2015 Author Posted November 1, 2015 @Melba23 Oh. I deleted label number 2 for a test. But nothing happened and label number 14 created. Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only)
Moderators Melba23 Posted November 1, 2015 Moderators Posted November 1, 2015 kcvinu,As I explained above, the control ControlIDs start from 3, so using a lower value in a ControlID parameter will not affect any existing control. Thus in this case nothing is deleted and the next created control will follow on from the earlier sequence.M23 kcvinu 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
kcvinu Posted November 1, 2015 Author Posted November 1, 2015 Melba23,But the earlier sequence was ended at 12. So, new control should be created as 13. But it indicates 14. Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only)
Danyfirex Posted November 1, 2015 Posted November 1, 2015 kcvinu,The first ControlID returned has always been 3 since I started using AutoIt - you will have to ask Jon why, but I imagine that the earlier elements are used for other things that AutoIt needs to track.M23always is 3 because autoit create two hidden controls internally. maybe internally use a counter for HMENU parameter of CreateWindowEx. Saludos kcvinu 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
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