Jump to content

Mass Control Disable


Recommended Posts

Few days ago, I saw somewhere in forum that someone posted a solution to someone's problem that you can disable all the controls & labels in GUI using the loop and do not disable 1 or 2 buttons (like Stop button) and I cant find it in forum's search funtion. Can someone show me the links or post how it was done?

Edited by Blackstar
Link to comment
Share on other sites

You mean like this ?

#include <GUIConstants.au3>

GUICreate("", 120, 160)
$button1 = GUICtrlCreateButton("Button1", 10, 10, 100, 20)
$button2 = GUICtrlCreateButton("Button2", 10, 40, 100, 20)
$button3 = GUICtrlCreateButton("Button3", 10, 70, 100, 20)
$button4 = GUICtrlCreateButton("Button4", 10, 100, 100, 20)
$button5 = GUICtrlCreateButton("Button5", 10, 130, 100, 20)
GUISetState()

For $ctrl = $button1 To $button5
    Sleep(500)
    If $ctrl <> $button3 Then GUICtrlSetState($ctrl, $GUI_DISABLE)
Next

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
Link to comment
Share on other sites

Close but all kinds of controls to disable...not just buttons. I'm talking about everything you see on GUI, labels, menus, textboxes, combo, buttons, etc etc but only want 1 or 2 button to remain enabled.

It works with othert controls as well. Just change one the

the GUICtrlCreateButton to for example GUICtrlCreateLabel.

Link to comment
Share on other sites

This isnt what I expect. My controls does not go something like "Button1", "Button2", etc. Example, my textboxes controls named $InputNameText, $InputUsernameText, $InputPassword, $Intervalcbo. This has to be another way but I like this part of code and not the $button1 to $button5 line:

For $ctrl = $button1 To $button5
    Sleep(500)
    If $ctrl <> $button3 Then GUICtrlSetState($ctrl, $GUI_DISABLE)
Next
Link to comment
Share on other sites

This isnt what I expect. My controls does not go something like "Button1", "Button2", etc. Example, my textboxes controls named $InputNameText, $InputUsernameText, $InputPassword, $Intervalcbo. This has to be another way but I like this part of code and not the $button1 to $button5 line

Not too hard to customize it....

For $ctrl = $guictrl1 To $guictrl5
    Sleep(500)
    If $ctrl <> $guictrl3 Then GUICtrlSetState($ctrl, $GUI_DISABLE)
Next

You just need to remember what each variable holds. Name them whatever you want... :D

Link to comment
Share on other sites

You can create an array of control handles and then disable them like so:

Local $aH_Ctrls = _ArrayCreate( $InputNameText, $InputUsernameText, $InputPassword, $Intervalcbo,$Pic, $Graphic, $Label, $Radio, $Edit, $Button, $Group, $Check[2])
;Disable the controls
_CtrlDisable($aH_Ctrls)
sleep(5000)
;Enable controls
_CtrlEnable($aH_Ctrls)
;--------------------------------------------------------
Func _CtrlDisable($aCtrls)
    If IsArray($aCtrls) Then
        Local $x
        For $x = 0 To UBound($aCtrls) - 1
            GUICtrlSetState($aCtrls[$x], $GUI_DISABLE)
            ;_ConsoleWriteLn($ctrl[$x])
        Next
    Else
        GUICtrlSetState($aCtrls, $GUI_DISABLE)
    EndIf
    
EndFunc   ;==>_CtrlDisable

Func _CtrlEnable($aCtrls)
    If IsArray($aCtrls) Then
        Local $x
        For $x = 0 To UBound($aCtrls) - 1
            GUICtrlSetState($aCtrls[$x], $GUI_ENABLE)
            ;_ConsoleWriteLn($ctrl[$x])
        Next
    Else
        GUICtrlSetState($aCtrls, $GUI_ENABLE)
    EndIf
EndFunc   ;==>_CtrlEnable
;--------------------------------------------------------
 oÝ÷ Ú'ò¢æ¬²('yÛÚ®&ëµÊ'¶º%r·¶*')!ùè¶Ø^*.ßÙe粶§È¦V«¶aÁÞ­íý°,z´¥º
ý²§w'ZÜ º+^b~'jX­¶Wæ©g­Z)Ý£®Ýø¥yÊ'µ¨§²Ø^~éܶ*'²Ú zÖ¥Ø^rí®Hwlb·öYgyç['$¶¢%x+kÆî¶Ú'¶§i¹^v+nW­ç(ÚèÊ'¶¢¹ºÚ"µÍÚ[ÛYH ÑÝZPÛÛÝ[Ë]LÉÝÂÚ[ÛYH  Ð^K]LÉÝÂÚ[ÛYH ][ÝØQÙ]Ú[ÝË]LÉ][ÝÂÈÕRBÌÍÙÝZHHÕRPÜX]J   ][ÝÔØ[HÕRI][ÝË


BÌÍÚÛÙÝZHHÚ[Ù][J    ][ÝÔØ[HÕRI][ÝÊBÕRTÙ]XÛÛÞÝ[Q [È ][ÝÛÜZ[^I][ÝË
BÈQSBÌÍÛY[LHHÕRPÝÜX]SY[J ][ÝÓY[I[ÓÛI][ÝÊBÕRPÝÜX]SY[Z][J ][ÝÔÝX][I][ÝË  ÌÍÛY[LJBÕRPÝÜX]SY[J   ][ÝÓY[I[ÕÛÉ][ÝÊBÕRPÝÜX]SY[J   ][ÝÓY[U   [ÜYI][ÝÊBÕRPÝÜX]SY[J  ][ÝÓY[I[ÑÝ][ÝÊBÈÓÓVQSBÌÍØÛÛ^Y[HHÕRPÝÜX]PÛÛ^Y[J
BÕRPÝÜX]SY[R][J  ][ÝÐÛÛ^Y[I][ÝË    ÌÍØÛÛ^Y[JBÕRPÝÜX]SY[R][J    ][ÝÉ][ÝË    ÌÍØÛÛ^Y[JHÜÙ]ÜÕRPÝÜX]SY[R][J ][ÝÉ[ÔÜYÉ][ÝË    ÌÍØÛÛ^Y[JBÈPÂÕRPÝÜX]TXÊ  ][ÝÛÙÛÍÚY][ÝËMË

BÕRPÝÜX]SX[
    ][ÝÔØ[HXÉ][ÝË
ÍKK
LËMJBÈUBÕRPÝÜX]P]J ][ÝÜØ[PUK]I][ÝËNLÌÌ  ÌÍÐPÔ×ÐUUÔVJBÕRPÝÜX]SX[
    ][ÝÔØ[H]I][ÝËMÌ
L
BÈPÌÍÚÝXÛÛÛHÕRPÝÜX]UXML
Ì
BÕRPÝÜX]UX][J    ][ÝÓÛI][ÝÊBÕRPÝÜX]SX[
    ][ÝÔØ[HXÚ]X][É][ÝËL

BÕRPÝÜX]UX][J    ][ÝÕÛÉ][ÝÊBÕRPÝÜX]UX][J    ][ÝÕYI][ÝÊBÕRPÝÜX]UX][J  ][ÝÉ][ÝÊBÈÓÓPÂÕRPÝÜX]PÛÛXÊ    ][ÝÔØ[HÛÛXÉ][ÝËLLL
BÈÑÔTÔÂÕRPÝÜX]TÙÜÜÊ
ML
BÕRPÝÙ]]JLK

BÕRPÝÜX]SX[
    ][ÝÔÙÜÜÎ][ÝË
KBÈQUÌÍÚÑY]HÕRPÝÜX]QY]
Ô  [È ][ÝÈØ[HY]ÛÛÛ  ][ÝËLLLML
Ì
BÈTÕÌÍÚÓÝHÕRPÝÜX]SÝ
    ][ÝÉ][ÝË
KNLLL
BÕRPÝÙ]]JLK  ][ÝØKØ[_ÝËÛÛÛI][ÝË    ][ÝØÝ    ][ÝÊBÈPÓÓÕRPÝÜX]RXÛÛ  ][ÝÜÚ[Ì ][ÝËKMÍKL
BÕRPÝÜX]SX[
    ][ÝÒXÛÛ][ÝËNM
L
BÈTÕQUÂÌÍÛÝY]ÈHÕRPÝÜX]SÝY]Ê    ][ÝÔØ[_ÝY]ß    ][ÝËLLNLLL
BÛÛÛÛUÜ]J  ÌÍÛÝY]È    [ÈBÕRPÝÜX]SÝY]Ò][J    ][ÝÐ_ÛI][ÝË    ÌÍÛÝY]ÊBÕRPÝÜX]SÝY]Ò][J   ][ÝÐÛÉ][ÝË    ÌÍÛÝY]ÊBÕRPÝÜX]SÝY]Ò][J   ][ÝÐßYI][ÝË    ÌÍÛÝY]ÊBÈÔÕTÒUQSÈUÓÂÕRPÝÜX]QÜÝ
    ][ÝÔØ[HÜÝ  ][ÝËÌL
BÌÍÚÔY[ÌHHÕRPÝÜX]TY[Ê  ][ÝÔY[ÈÛI][ÝËLM
BÕRPÝÙ]Ý]JLK    ÌÍÑÕRWÐÒPÒÑQ
BÌÍÚÔY[ÌHÕRPÝÜX]TY[Ê   ][ÝÔY[ÈÛÉ][ÝËLMK
BÕRPÝÜX]QÜÝ
    ][ÝÉ][ÝËNNKNNKKJHØÛÜÙHÜÝÈTÕÓÕRPÝÜX]SX[
    ][ÝÕÝÛ][ÝËÍLLMJBÌÍÚÕÝÛHÕRPÝÜX]R[]
    ][ÝÍ][ÝËÍLLÌ

BÕRPÝÜX]UÝÛLJBÈPSÕRPÝÜX]SX[
    ][ÝÑÜY[][ÝÈ    [ÈÔ   [È ][ÝÓX[    ][ÝËÍLMK


BÕRPÝÙ]ÐÛÛÜLK
BÈÓQTÕRPÝÜX]SX[
    ][ÝÔÛY][ÝËÍKMJBÌÍÚÔÛYHÕRPÝÜX]TÛYÌLLÌ
BÕRPÝÙ]]JLKÌ
BÈSUÌÍÚÒ[]HÕRPÝÜX]R[]
    ][ÝÔØ[H[]Þ  ][ÝËÍKMKLÌ
BÈUBÕRPÝÜX]Q]J  ][ÝÉ][ÝË
K
BÕRPÝÜX]SX[
    ][ÝÊ]HÛÛÛ^[È[ÈHØ[[I][ÝËLÌ
K
BÈUÓÌÍØ]ÛHÕRPÝÜX]P]Û  ][ÝÕÙÙÛHÝÉ][ÝËLÌÌLÌ
BÈÒPÒÐÖÌÍÚÐÚXÚÈHÕRPÝÜX]PÚXÚØÞ
    ][ÝÐÚXÚØÞ ][ÝËLÌÌÍK
BÕRPÝÙ]Ý]JLK    ÌÍÑÕRWÐÒPÒÑQ
BÈQUQUÈÓBÌÍÝYSÛHHÕRPÝÜX]UYUY]ÊLL
BÌÍÝYR][HHÕRPÝÜX]UYUY]Ò][J   ][ÝÕYUY]É][ÝË  ÌÍÝYSÛJBÕRPÝÜX]UYUY]Ò][J    ][ÝÒ][LI][ÝË    ÌÍÝYR][JBÕRPÝÜX]UYUY]Ò][J    ][ÝÒ][L][ÝË ÌÍÝYR][JBÕRPÝÜX]UYUY]Ò][J    ][ÝÑÛÉ][ÝËLJBÕRPÝÙ]Ý]J    ÌÍÝYR][K ÌÍÑÕRWÑVS
BÈQUQUÈÓÂ[H ÌÍÝÛÖÍWBÌÍÝYUÛÈHÕRPÝÜX]UYUY]ÊMKLLË  ÌÍÕ×ÐÒPÒÐÖTÊBÌÍÝÛÖÌWHHÕRPÝÜX]UYUY]Ò][J  ][ÝÕYUY]É][ÝË  ÌÍÝYUÛÊBÌÍÝÛÖÌHHÕRPÝÜX]UYUY]Ò][J ][ÝÕÚ]   ][ÝË  ÌÍÝYUÛÊBÌÍÝÛÖÌ×HHÕRPÝÜX]UYUY]Ò][J   ][ÝÝ×ØÚXÚØÞÉ][ÝË ÌÍÝYUÛÊBÕRPÝÙ]Ý]JLK    ÌÍÑÕRWÐÒPÒÑQ
BÌÍÝÛÖÍHHÕRPÝÜX]UYUY]Ò][J ][ÝÔÝ[I][ÝË    ÌÍÝYUÛÊBßØYÙ][ÜÊ
BÕRTÙ]Ý]J
BÈÕRHQTÔÐQÑHÓÔÛÛÛÛUÜ]JLÌ
ÈLJBÚ[HB  ÌÍÛÙÈHÕRQÙ]ÙÊ
BÙ[XÝØÙH    ÌÍÛÙÈH ÌÍØ]ÛÙÙÛPÛÛÛÊ
BØÙH  ÌÍÛÙÈH ÌÍÑÕRWÑUSÐÓÔÑB^]ÛÜØÙH[ÙBÎÂ[Ù[XÝÑ[ÕRQ[]J
B^]Ñ[XHÜØXHÛÛÛÂ[ÈÙÙÛPÛÛÛÊ
BØØ[  ÌÍØÛÛÛ  ÌÍØÛÛÛÈHÙ]Ú[ÝÜÊ ÌÍÚÛÙÝZKJBÐ^QÜ^J    ÌÍØÛÛÛË  ][ÝÐÛÛÛÈÛÜÛ[YÉ][ÝÊBÈÐÛÛ^QÜ^J   ÌÍØÛÛÛË  ][ÝÐÛÛÛÉ][ÝÊB   ÌÍØÛÛÛÈHÙ]Ú[ÝÜÊ ÌÍÚÛÙÝZK
BÐ^QÜ^J   ÌÍØÛÛÛË  ][ÝÐÛÛÛÈÛÛÛY   ÌÎNÜÉ][ÝÊBÜ  ÌÍÞLHÈXÝ[
    ÌÍØÛÛÛÊKLB   ÌÍÜÝ]HHÕRPÝÙ]Ý]J    ÌÍØÛÛÛÖÉÌÍÞJBQ]S
    ÌÍÜÝ]K  ÌÍÑÕRWÑSPJHH   ÌÍÑÕRWÑSPH[ÕRPÝÙ]Ý]J   ÌÍØÛÛÛÖÉÌÍÞK ÌÍÑÕRWÑTÐPJB[ÙBÝZPÝÙ]Ý]J ÌÍØÛÛÛÖÉÌÍÞK ÌÍÑÕRWÑSPJB[Y^ÓX]H]Û[XYÈÙÙÛHÛÕRPÝÙ]Ý]J  ÌÍØ]Û   ÌÍÑÕRWÑSPJB[[oÝ÷ Ø[§rبƮ¶­s`£¶vWEvæF÷w2æS0£µ7FWfRöF¦V6¶¶VÇF÷'&õÒ7FWfTö6÷FÆÆòç7FW2ææW@¢6æ6ÇVFRfÇC´'&æS2fwC°¤vÆö&Â6öç7Bb33c´uuô4ÄBÒP¤vÆö&Â6öç7Bb33c´uuôtäDäUBÒ  £³ÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓУ²gVæ7FöâæÖS¢vWEvæF÷w0£²FW67&Föã¢vWG26ÆBvæF÷w26öçG&öÇ2öbvæF÷p£²&ÖWFW"2¢b33c¶væBæFÆRöbvæF÷rFòvWB6ÆG&Vࣲb33c¶fÆrÒvWB6öçG&öÂBb33·2ÂVÇ6RvWB6Æ76æÖP£²&WV&VÖVçB2¢&WF£²&WGW&âfÇVR2¢â'&öb6öçG&öÂBb33·2÷"6Æ76æÖR÷"öâfÇW&RࣲW6W"6ÆÅF £²WF÷"2¢7FWfRöF¦V6¶¶VÇF÷'&õÒ7FWfTö6÷FÆÆòç7FW2ææW@£²æ÷FR2¢FöW2æ÷BvWBFRÖVçR⣲vävWD6Æ74Æ7B2'VÇFâFB6â&WG&WfR6Æ76æÖW2FöòࣳÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓФgVæ2vWEvæF÷w2b33c¶væBÂb33c¶fÆrÒ¦bæ÷B4væBb33c¶væBFVâ&WGW&â¤Æö6Âb33c·væÆ7BÒgV÷C²gV÷C²Âb33c·&WGfÀ¥õôvWDÆ7Bb33c¶væBÂb33c·væÆ7BÂb33c¶fÆr¦bb33c·væÆ7BfÇC²fwC²gV÷C²gV÷C²FVà¢b33c·væÆ7BÒ7G&æu7ÆBb33c·væÆ7BÄÄb¢b4'&b33c·væÆ7BFVà¢Æö6Âb33c·&WEöÆ7EµT&÷VæBb33c·væÆ7BÓТf÷"b33c¶ÒFòT&÷VæBb33c·væÆ7BÓ¢b33c·&WEöÆ7E²b33c¶ÓÓÒb33c·væÆ7E²b33c¶Ð¢æW@¢&TFÒb33c·&WEöÆ7EµT&÷VæBb33c·&WEöÆ7BÓТ&WGW&âb33c·&WEöÆ7@¢VæD`¢&WGW&âb33c·væÆ7@¤VæD`¥&WGW&â¤VæDgVæ2³ÓÒfwC´vWEvæF÷w0  £³ÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓУ²gVæ7FöâæÖS¢vWD6Æ74æÖP£²FW67&Föã¢vWBvæF÷r÷"6öçG&öÇ26Æ76æÖP£²&ÖWFW"2¢b33c¶væBæFÆRöb6öçG&öÂ÷"væF÷rFòvWB6Æ76æÖP£²&WV&VÖVçB2¢&WFf÷"FÆÄ6Æ£²&WGW&âfÇVR2¢V×G7G&æröâfÇW&R÷"6Æ76æÖRöâ7V66W70£²W6W"6ÆÅF £²WF÷"2¢7FWfRöF¦V6¶¶VÇF÷'&õÒ7FWfTö6÷FÆÆòç7FW2ææW@£²æ÷FR2 £³ÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓФgVæ2vWD6Æ74æÖRb33c¶væB¢bæ÷B4væBb33c¶væBFVâb33c¶væBÒvæBb33c¶væB¢bæ÷B4væBb33c¶væBFVâ&WGW&â6WDW'&÷"¢Æö6Âb33c·G'7G ¢Æö6Âb33c¶6Æ76æÖRÒFÆÄ6ÆÂgV÷C·W6W#3"æFÆÂgV÷C²ÂgV÷C¶çBgV÷C²ÂgV÷C´vWD6Æ74æÖRgV÷C²ÂgV÷C¶væBgV÷C²Âb33c¶væBÂgV÷C·7G"gV÷C²Âb33c·G'7G"ÂgV÷C¶çBgV÷C²Â#SR¢&WGW&â7G&æu7G&u2b33c¶6Æ76æÖU³%ÒÂ2¤VæDgVæ2³ÓÒfwC´vWD6Æ74æÖP £³ÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓУ²gVæ7FöâæÖS¢vWDFÆt7G&Ä@£²FW67&Föã £²&ÖWFW"2¢b33c¶væBæFÆRöb6öçG&öÀ£²&WV&VÖVçB2¢&WFf÷"FÆÄ6Æ£²&WGW&âfÇVR2¢6öçG&öÂBöâ7V66W70£²WF÷"2 £³ÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓФgVæ2vWDFÆt7G&ÄBb33c¶væB¢b33c´BÒFÆÄ6ÆÂb33·W6W#3"æFÆÂb33²Âb33¶çBb33²Âb33´vWDFÆt7G&ÄBb33²Âb33¶væBb33²Âb33c¶væB¢&WGW&âb33c´E³Ð¤VæDgVæ2³ÓÒfwC´vWDFÆt7G&Ä@ £³ÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓУ²gVæ7FöâæÖS¢ô6öä'&F7Æ£²FW67&Föã¢'&F7ÆFò6öç6öÆP£²&ÖWFW"2¢b33c¶d'&'&FòF7Æ£²b33c·FFÆR÷FöæÂFFÆRFòF7Æ£²&WV&VÖVçB2 £²&WGW&âfÇVR2¢öâfÇW&RÂöâ7V66W72ࣳÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓФgVæ2ô6öä'&F7Æb33c¶d'&Âb33c·FFÆRÒgV÷C²gV÷C²¢Æö6Âb33c¶6÷VçFW"ÒÂb33c·4×6rÒgV÷C²gV÷C°¢bæ÷B4'&b33c¶d'&FVà¢6WDW'&÷"¢&WGW&â¢VæD`¢b33c·4×6rÒgV÷C²¢¢¢gV÷C²fײb33c·FFÆRfײgV÷C²¢¢¢gV÷C²fײ5 ¢f÷"b33c¶6÷VçFW"ÒFòT&÷VæBb33c¶d'&Ò¢²b33c·4×6rÒb33c·4×6rfײgV÷Cµ²gV÷C²fײb33c¶6÷VçFW"fײgV÷CµÒÒgV÷C²fײ7G&æu7G&5"b33c¶d'&²b33c¶6÷VçFW%ÒfײÄ`¢b33c·4×6rÒb33c·4×6rfײ7G&æu7G&5"b33c¶d'&²b33c¶6÷VçFW%ÒfײÄ`¢æW@¢b33c·4×6rÒb33c·4×6rfײgV÷C²ÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒÒgV÷C°¢6öç6öÆUw&FRb33c·4×6rfײÄb¢6WDW'&÷"¢&WGW&â¤VæDgVæ2³ÓÒfwCµô6öä'&F7Æ £³ÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓУ²gVæ7FöâæÖS¢õôvWDÆ7@£²FW67&Föã¢&V7W'6fRvæF÷r6V&6f÷"7G&ÂB÷"6Æ76æÖP£²&ÖWFW"2¢b33c¶væBæFÆRFòvæF÷r÷"6öçG&ö£²b33c¶Æ7B'&Vb6öçFæW""FF£²b33c¶fÆrFVfVÇBvWB7G&ÂBb33·2Âæ÷BvWB6Æ76æÖW0£²&WV&VÖVçB2¢&WFf÷"FÆÄ6Æ£²&WGW&âfÇVR2¢öâfæ6ÂöâW'&÷"ࣲW6W"6ÆÅF¢£²WF÷"2¢7FWfRöF¦V6¶¶VÇF÷'&õÒfÇC·7FWfTö6÷FÆÆòç7FW2ææWBfwC°£²æ÷FR2¢vävWD6Æ74Æ7BFöW2FR6ÖR2fÆræ÷B£³ÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓÓФgVæ2õôvWDÆ7Bb33c¶væBÄ'&Vbb33c¶Æ7BÂb33c¶fÆrÒ¢Æö6Âb33c´6ÆBÂb33c¶6÷VçFW"ÒÂb33c´6ÆD6ÆBÒgV÷C²gV÷C°¢¶vWBf'7B6ÆBæFÆRââà¢b33c´6ÆBÒFÆÄ6ÆÂgV÷C·W6W#3"æFÆÂgV÷C²ÂgV÷C¶çBgV÷C²ÂgV÷C´vWEvæF÷rgV÷C²ÂgV÷C¶væBgV÷C²Âb33c¶væBÂgV÷C¶çBgV÷C²Âb33c´uuô4ÄB¢bW'&÷"FVâ&WGW&â¢b4'&b33c´6ÆBFV⢶bfÆ@¢bb33c´6ÆE³ÒfÇC²fwC²FVâ¢vÆR¢bb33c¶fÆrFVࢶvWB6Æ76æÖP¢µvävWD6Æ74Æ7BÒÒ&WGW&ç2ÄbFVÆÖFVB7G&æröb6Æ72æÖW2à¢b33c¶6Æ72ÒvWD6Æ74æÖRb33c´6ÆE³Ò¢VÇ6P¢¶vWB7G&Ä@¢b33c¶6Æ72ÒvWDFÆt7G&ÄBb33c´6ÆE³Ò¢VæD`¢b33c¶Æ7BÒb33c¶Æ7Bfײb33c¶6Æ72fײÄ`¢õôvWDÆ7Bb33c´6ÆE³ÒÂb33c¶Æ7BÂb33c¶fÆr¢b33c´6ÆBÒFÆÄ6ÆÂgV÷C·W6W#3"æFÆÂgV÷C²ÂgV÷C¶çBgV÷C²ÂgV÷C´vWEvæF÷rgV÷C²ÂgV÷C¶væBgV÷C²Âb33c´6ÆE³ÒÂgV÷C¶çBgV÷C²Âb33c´uuôtäDäUB¢bW'&÷"FVâ&WGW&â¢b4'&b33c´6ÆBFVâ¢bb33c´6ÆE³ÒÒFVâWDÆö÷¢VæD`¢tVæ@¢VæD`¢VæD`¢&WGW&â¤VæDgVæ0¢

You can use customize the second method or you can combine both methods

To combine, set an array with the controls you want to remain enabled and call

_CtrlEnable($aYourArrayOfControlsToEnable) after mass disabling all the controls.

Edit: Added original posters var names to array in example, added note on combining scripts

Edited by eltorro
Link to comment
Share on other sites

Just a thought here. In GTK+ land (Linux or Windows) there is a concept of a "container" control object, its purpose is to contain "real" controls to enable amongst other things showing or hiding all the "real" controls within the container. I miss that in AutoIt, but maybe it's there in a different form. Wouldn't that greatly simplify all this?

Link to comment
Share on other sites

Sorry, forgot there is another nicety to GTK+ things like a Groups control are in and of themselves containers and thus any control within a group or tab page, etc can be hidden, shown, desensitized (grayed out) in ONE line of code. Nice huh?

Link to comment
Share on other sites

Sorry, forgot there is another nicety to GTK+ things like a Groups control are in and of themselves containers and thus any control within a group or tab page, etc can be hidden, shown, desensitized (grayed out) in ONE line of code. Nice huh?

I haven't tried, but it may be possible with GuiStartGroup

Edit: nope, it don't work.

#include <GUIconstants.au3>

Opt("GUICoordMode", 1)

GUICreate("Radio Box Grouping Demo", 400,280)

; Create the controls
$button_1 = GUICtrlCreateButton ("B&utton 1", 30, 20, 120, 40)
$group_1 = GUICtrlCreateGroup ("Group 1", 30, 90, 165, 160)
$group1 = GUIStartGroup()
$radio_1 = GUICtrlCreateRadio ("Radio &0", 50, 120, 70, 20)
$radio_2 = GUICtrlCreateRadio ("Radio &1", 50, 150, 60, 20)
$radio_3 = GUICtrlCreateRadio ("Radio &2", 50, 180, 60, 20)
$group2 = GUIStartGroup()
$radio_4 = GUICtrlCreateRadio ("Radio &A", 120, 120, 70, 20)
$radio_5 = GUICtrlCreateRadio ("Radio &B", 120, 150, 60, 20)
$radio_6 = GUICtrlCreateRadio ("Radio &C", 120, 180, 60, 20)
GUICtrlCreateGroup ("",-99,-99,1,1)  ;close group
$group3=GUIStartGroup()
$input_1 = GUICtrlCreateInput ("Input 1", 200, 20, 160, 30)
$input_2 = GUICtrlCreateInput ("Input 2", 200, 70, 160, 30)


; Set the defaults (radio buttons clicked, default button, etc)
GUICtrlSetState($radio_1, $GUI_CHECKED)
GUICtrlSetState($radio_6, $GUI_CHECKED)
GUICtrlSetState($button_1, $GUI_FOCUS + $GUI_DEFBUTTON)

; Init our vars that we will use to keep track of radio events
$radioval1 = 0    ; We will assume 0 = first radio button selected, 2 = last button
$radioval2 = 2

GUISetState ()

; In this message loop we use variables to keep track of changes to the radios, another
; way would be to use GUICtrlRead() at the end to read in the state of each control.  Both
; methods are equally valid
While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE
         Exit
         
      Case $msg = $button_1
         MsgBox(0, "Button", "Radio " & $radioval1 & @LF & "Radio " & Chr($radioval2 + Asc("A")) & @LF & GUICtrlRead($input_1) & @LF & GUICtrlRead($input_2))
            IF BitAND(GUICtrlGetState($group_1), $GUI_ENABLE) = $GUI_ENABLE Then
            GUICtrlSetState($group_1,$GUI_DISABLE)
        Else
            GuiCtrlSetState($group_1,$GUI_ENABLE)
        EndIf
      Case $msg = $radio_1 OR $msg = $radio_2 OR $msg = $radio_3
         $radioval1 = $msg - $radio_1
         
      Case $msg = $radio_4 OR $msg = $radio_5 OR $msg = $radio_6
         $radioval2 = $msg - $radio_4

   EndSelect
WEnd

The First method i posted works in that way though. The array is the container and one call to either enable or disable the controls. :D

Edited by eltorro
Link to comment
Share on other sites

You could use the control id, instead of array, all you do is look for the number id with autoit window info

#include <GUIConstants.au3>

GUICreate("", 120, 160)
$Thisis = GUICtrlCreateButton("Button1", 10, 10, 100, 20)
$A_random = GUICtrlCreateButton("Button2", 10, 40, 100, 20)
$Namingscheme = GUICtrlCreateButton("Button3", 10, 70, 100, 20)
$Forcontrl = GUICtrlCreateButton("Button4", 10, 100, 100, 20)
$disableenable = GUICtrlCreateButton("Button5", 10, 130, 100, 20)




GUISetState()



For $ctrl = 3 To 7
    Sleep(500)
    If $ctrl <> 5 Then GUICtrlSetState($ctrl, $GUI_DISABLE)
Next

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
Link to comment
Share on other sites

eltorro, that is the best post so far for this topic...thanks eltorro! It works the way I wanted to with those control names (the first code you posted with _ArrayCreate()). Just made little changes in it to make Stop button enabled while the rest is disabled. Unlike button1, button2, button3 which also is a poor naming coding that the route I rather not take and make it tedious to rename all my neatly controls names to poor's man code!

Edited by Blackstar
Link to comment
Share on other sites

  • 2 weeks later...

You mean like this ?

#include <GUIConstants.au3>

GUICreate("", 120, 160)
$button1 = GUICtrlCreateButton("Button1", 10, 10, 100, 20)
$button2 = GUICtrlCreateButton("Button2", 10, 40, 100, 20)
$button3 = GUICtrlCreateButton("Button3", 10, 70, 100, 20)
$button4 = GUICtrlCreateButton("Button4", 10, 100, 100, 20)
$button5 = GUICtrlCreateButton("Button5", 10, 130, 100, 20)
GUISetState()

For $ctrl = $button1 To $button5
    Sleep(500)
    If $ctrl <> $button3 Then GUICtrlSetState($ctrl, $GUI_DISABLE)
Next

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

I'm out of the suject but I nearly fall down of my chair :whistle:

Can you explain to me why and what are the rule that make this

For Next loop doing an itereation on var name instead of what they store ????

Where is the documentation about that ?

:-)

Link to comment
Share on other sites

Nope, there is not.

The control numbers increment by 1 for every control that you make. Simply loop through from the control id of your very first control to your control id of your very last control.

#)

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...