Zodiak Posted May 21, 2009 Share Posted May 21, 2009 (edited) Hi, I'm trying to make a gui, but I have a problem about $GUI_ENABLE and $GUI_DISABLE of a GUICtrlCreateInput. I'd like to enable it if $radioBz1 is $GUI_CHECKED and to disable it if $radioBz2 or $radioBz3 are $GUI_CHECKED. As I have written in the code below, I see the GUICtrlCreateInput refresh and I don't like it.. This is my gui code expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Local $msg, $tab Local $tabA Local $radioAx1, $radioAx2 Local $radioAy1, $radioAy2 Local $tabB Local $radioBx1, $radioBx2 Local $radioBy1, $radioBy2 Local $radioBz1, $radioBz2, $radioBz3 Local $inputNAME ;##########|=> .: GUI START :. <=|############################################## GUICreate("asd", 400, 300) $tab = GUICtrlCreateTab(10, 10, 200, 230) $tabA = GUICtrlCreateTabItem("A") GUICtrlCreateGroup("x", 15, 35, 90, 70) $radioAx1 = GUICtrlCreateRadio("1", 20, 55, 80, 20) $radioAx2 = GUICtrlCreateRadio("2", 20, 75, 80, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup("y", 110, 35, 90, 70) $radioAy1 = GUICtrlCreateRadio("1", 115, 55, 80, 20) $radioAy2 = GUICtrlCreateRadio("2", 115, 75, 80, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) $tabB = GUICtrlCreateTabItem("B") GUICtrlCreateGroup("x", 15, 35, 90, 70) $radioBx1 = GUICtrlCreateRadio("1", 20, 55, 80, 20) $radioBx2 = GUICtrlCreateRadio("2", 20, 75, 80, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup("y", 110, 35, 90, 70) $radioBy1 = GUICtrlCreateRadio("1", 115, 55, 80, 20) $radioBy2 = GUICtrlCreateRadio("2", 115, 75, 80, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup("z", 15, 110, 90, 90) $radioBz1 = GUICtrlCreateRadio("1", 20, 130, 80, 20) $radioBz2 = GUICtrlCreateRadio("2", 20, 150, 80, 20) $radioBz3 = GUICtrlCreateRadio("3", 20, 170, 80, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup("N", 110, 110, 90, 50) $inputNAME = GUICtrlCreateInput("", 115, 130, 80, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) GUICtrlCreatePic("800x600.jpg", 0, 0, 400, 300, $WS_CLIPSIBLINGS) GUISetState(-1,$GUI_ONTOP) ;##########|=> .: GUI END :. <=|################################################ ;##########|=> .: GUI FUNCTION :. <=|########################################### _GUI() Func _GUI() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If BitAnd(GUICtrlRead($radioBz1), $GUI_CHECKED) Then GUICtrlSetState($inputNAME, $GUI_ENABLE) If BitAnd(GUICtrlRead($radioBz2), $GUI_CHECKED) Then GUICtrlSetState($inputNAME, $GUI_DISABLE) If BitAnd(GUICtrlRead($radioBz3), $GUI_CHECKED) Then GUICtrlSetState($inputNAME, $GUI_DISABLE) WEnd EndFunc Edited May 21, 2009 by Zodiak Link to comment Share on other sites More sharing options...
Yashied Posted May 21, 2009 Share Posted May 21, 2009 Hi, I'm trying to make a gui, but I have a problem about $GUI_ENABLE and $GUI_DISABLE of a GUICtrlCreateInput. I'd like to enable it if $radioBz1 is $GUI_CHECKED and to disable it if $radioBz2 or $radioBz3 are $GUI_CHECKED. As I have written in the code below, I see the GUICtrlCreateInput refresh and I don't like it.. This is my gui code expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Local $msg, $tab Local $tabA Local $radioAx1, $radioAx2 Local $radioAy1, $radioAy2 Local $tabB Local $radioBx1, $radioBx2 Local $radioBy1, $radioBy2 Local $radioBz1, $radioBz2, $radioBz3 Local $inputNAME ;##########|=> .: GUI START :. <=|############################################## GUICreate("asd", 400, 300) $tab = GUICtrlCreateTab(10, 10, 200, 230) $tabA = GUICtrlCreateTabItem("A") GUICtrlCreateGroup("x", 15, 35, 90, 70) $radioAx1 = GUICtrlCreateRadio("1", 20, 55, 80, 20) $radioAx2 = GUICtrlCreateRadio("2", 20, 75, 80, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup("y", 110, 35, 90, 70) $radioAy1 = GUICtrlCreateRadio("1", 115, 55, 80, 20) $radioAy2 = GUICtrlCreateRadio("2", 115, 75, 80, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) $tabB = GUICtrlCreateTabItem("B") GUICtrlCreateGroup("x", 15, 35, 90, 70) $radioBx1 = GUICtrlCreateRadio("1", 20, 55, 80, 20) $radioBx2 = GUICtrlCreateRadio("2", 20, 75, 80, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup("y", 110, 35, 90, 70) $radioBy1 = GUICtrlCreateRadio("1", 115, 55, 80, 20) $radioBy2 = GUICtrlCreateRadio("2", 115, 75, 80, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup("z", 15, 110, 90, 90) $radioBz1 = GUICtrlCreateRadio("1", 20, 130, 80, 20) $radioBz2 = GUICtrlCreateRadio("2", 20, 150, 80, 20) $radioBz3 = GUICtrlCreateRadio("3", 20, 170, 80, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup("N", 110, 110, 90, 50) $inputNAME = GUICtrlCreateInput("", 115, 130, 80, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) GUICtrlCreatePic("800x600.jpg", 0, 0, 400, 300, $WS_CLIPSIBLINGS) GUISetState(-1,$GUI_ONTOP) ;##########|=> .: GUI END :. <=|################################################ ;##########|=> .: GUI FUNCTION :. <=|########################################### _GUI() Func _GUI() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If BitAnd(GUICtrlRead($radioBz1), $GUI_CHECKED) Then GUICtrlSetState($inputNAME, $GUI_ENABLE) If BitAnd(GUICtrlRead($radioBz2), $GUI_CHECKED) Then GUICtrlSetState($inputNAME, $GUI_DISABLE) If BitAnd(GUICtrlRead($radioBz3), $GUI_CHECKED) Then GUICtrlSetState($inputNAME, $GUI_DISABLE) WEnd EndFuncFunc _GUI() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $radioBz1 If BitAND(GUICtrlRead($radioBz1), $GUI_CHECKED) Then GUICtrlSetState($inputNAME, $GUI_ENABLE) Case $radioBz2 If BitAND(GUICtrlRead($radioBz2), $GUI_CHECKED) Then GUICtrlSetState($inputNAME, $GUI_DISABLE) Case $radioBz3 If BitAND(GUICtrlRead($radioBz3), $GUI_CHECKED) Then GUICtrlSetState($inputNAME, $GUI_DISABLE) EndSwitch WEnd EndFunc ;==>_GUI My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
martin Posted May 21, 2009 Share Posted May 21, 2009 (edited) As Yashied has shown. Your problem was simply that you kept setting the state even when there was no need. Here is a chnage to your code which uses the same approach but remembers if the state needs to be changed or not. expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Local $msg, $tab Local $tabA Local $radioAx1, $radioAx2 Local $radioAy1, $radioAy2 Local $tabB Local $radioBx1, $radioBx2 Local $radioBy1, $radioBy2 Local $radioBz1, $radioBz2, $radioBz3 Local $inputNAME Global $IPen = True ;##########|=> .: GUI START :. <=|############################################## GUICreate("asd", 400, 300) $tab = GUICtrlCreateTab(10, 10, 200, 230) $tabA = GUICtrlCreateTabItem("A") GUICtrlCreateGroup("x", 15, 35, 90, 70) $radioAx1 = GUICtrlCreateRadio("1", 20, 55, 80, 20) $radioAx2 = GUICtrlCreateRadio("2", 20, 75, 80, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup("y", 110, 35, 90, 70) $radioAy1 = GUICtrlCreateRadio("1", 115, 55, 80, 20) $radioAy2 = GUICtrlCreateRadio("2", 115, 75, 80, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) $tabB = GUICtrlCreateTabItem("B") GUICtrlCreateGroup("x", 15, 35, 90, 70) $radioBx1 = GUICtrlCreateRadio("1", 20, 55, 80, 20) $radioBx2 = GUICtrlCreateRadio("2", 20, 75, 80, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup("y", 110, 35, 90, 70) $radioBy1 = GUICtrlCreateRadio("1", 115, 55, 80, 20) $radioBy2 = GUICtrlCreateRadio("2", 115, 75, 80, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup("z", 15, 110, 90, 90) $radioBz1 = GUICtrlCreateRadio("1", 20, 130, 80, 20) $radioBz2 = GUICtrlCreateRadio("2", 20, 150, 80, 20) $radioBz3 = GUICtrlCreateRadio("3", 20, 170, 80, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateGroup("N", 110, 110, 90, 50) $inputNAME = GUICtrlCreateInput("", 115, 130, 80, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) GUICtrlCreatePic("800x600.jpg", 0, 0, 400, 300, $WS_CLIPSIBLINGS) GUISetState(-1, $GUI_ONTOP) ;##########|=> .: GUI END :. <=|################################################ ;##########|=> .: GUI FUNCTION :. <=|########################################### _GUI() Func _GUI() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If BitAND(GUICtrlRead($radioBz1), $GUI_CHECKED) Then If Not $IPen Then GUICtrlSetState($inputNAME, $GUI_ENABLE) $IPen = True EndIf Else If $IPen Then GUICtrlSetState($inputNAME, $GUI_DISABLE) $IPen = False EndIf EndIf WEnd EndFunc ;==>_GUI Welcome to the AutoIt forums Edit: Corrected spelling of Yashied! Edited May 22, 2009 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Zodiak Posted May 21, 2009 Author Share Posted May 21, 2009 Thanks ^^ 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