SpecialK Posted November 23, 2008 Share Posted November 23, 2008 (edited) Hello, i try to create a little gui with a combo box. The bombo box should only be active when a checkbox is set. When the checkbox is not set, the combo box should be disabled. I tried it with this piece of code: GUICreate("Stryker Domain Tool", 250, 700) GUISetState(@SW_SHOW) $guimail = GUICtrlCreateCheckbox ("Mailaccount erstellen", 5, 400) GUICtrlSetState (-1, $Gui_checked) GUICtrlCreateLabel ("Größe der Mailbox:", 5, 432) $mailboxgroesse = GUICtrlCreateCombo ("Bis 25 MB", 110, 430) GUICtrlSetData (-1, "Bis 300 MB|Bis 1000 MB") $guiweiter = GUICtrlCreateButton ("User erstellen", 5, 550, 80) $guiabbrechen = GUICtrlCreateButton ("Abbrechen", 100, 550,80) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $guiabbrechen then Exit if GUICtrlRead ($guimail) = $Gui_Unchecked Then GUICtrlSetState ($mailboxgroesse, $Gui_Disable) else GUICtrlSetState ($mailboxgroesse, $Gui_Disable) endif WEnd GUIDelete() This code works, but the combox is alway blinking. It seems that it get refreshed in eyery loop. Is there a way to realise the enable / disable situation without a blinking combo box? Thank you SpecialK Edited November 23, 2008 by SpecialK Link to comment Share on other sites More sharing options...
rasim Posted November 23, 2008 Share Posted November 23, 2008 Hello, i try to create a little gui with a combo box. The bombo box should only be active when a checkbox is set. When the checkbox is not set, the combo box should be disabled. I tried it with this piece of code: expandcollapse popupGUICreate("Stryker Domain Tool", 250, 700) GUISetState(@SW_SHOW) $guimail = GUICtrlCreateCheckbox ("Mailaccount erstellen", 5, 400) GUICtrlSetState (-1, $Gui_checked) GUICtrlCreateLabel ("Größe der Mailbox:", 5, 432) $mailboxgroesse = GUICtrlCreateCombo ("Bis 25 MB", 110, 430) GUICtrlSetData (-1, "Bis 300 MB|Bis 1000 MB") $guiweiter = GUICtrlCreateButton ("User erstellen", 5, 550, 80) $guiabbrechen = GUICtrlCreateButton ("Abbrechen", 100, 550,80) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $guiabbrechen then Exit if GUICtrlRead ($guimail) = $Gui_Unchecked Then GUICtrlSetState ($mailboxgroesse, $Gui_Disable) else GUICtrlSetState ($mailboxgroesse, $Gui_Disable) endif WEnd GUIDelete()oÝ÷ Ù8b±Ê{ +Æî¶Ø^r£¬jɹbH§ly鬶ض·ë!yا{'«ÊZ(¤-êÞk²¶ÞjX¬zØ^zvïÝÆë"¶æðØhºÖ)äx¢fènS©äÊ¥ç"jR¿ªê-xLZ^jëh×6#include <GuiConstantsEx.au3> GUICreate("Stryker Domain Tool", 250, 700) $guimail = GUICtrlCreateCheckbox("Mailaccount erstellen", 5, 400) GUICtrlSetState(-1, $Gui_checked) GUICtrlCreateLabel("Gro?e der Mailbox:", 5, 432) $mailboxgroesse = GUICtrlCreateCombo("Bis 25 MB", 110, 430) GUICtrlSetData(-1, "Bis 300 MB|Bis 1000 MB") $guiweiter = GUICtrlCreateButton("User erstellen", 5, 550, 80) $guiabbrechen = GUICtrlCreateButton("Abbrechen", 100, 550, 80) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE, $guiabbrechen Exit Case $guimail If BitAND(GUICtrlRead($guimail), $GUI_CHECKED) Then GUICtrlSetState($mailboxgroesse, $GUI_ENABLE) Else GUICtrlSetState($mailboxgroesse, $GUI_DISABLE) EndIf EndSwitch WEnd GUIDelete() Link to comment Share on other sites More sharing options...
SpecialK Posted November 23, 2008 Author Share Posted November 23, 2008 Thank you very much!! Now it works. But i changed the code a little bite to this: While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE, $guiabbrechen Exit Case $guimail If GUICtrlRead ($guimail) = $GUI_CHECKED Then GUICtrlSetState($mailboxgroesse, $GUI_ENABLE) Else GUICtrlSetState($mailboxgroesse, $GUI_DISABLE) EndIf EndSwitch Because i never used BitAnd before it was new for me so i changed the code to this solution which also works. Or is it better to use the BitAnd solution? SpecialK Link to comment Share on other sites More sharing options...
rasim Posted November 23, 2008 Share Posted November 23, 2008 SpecialKOr is it better to use the BitAnd solution?For a checkbox control - unnecessary. 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