gte Posted May 18, 2009 Share Posted May 18, 2009 I have a drop down box made in koda, that triggers whether a button is greyed out or not. What happens is that when I highlight the menu option guictrlcreatecombo($menu1) out of the drop down menu box, it triggers the button ($button1) to be enabled and I'd like it to only be enabled when the drop down box item is clicked (not highlighted) ... any ideas? Also, I have a guictrlread($button1) to check and see if the button is enabled, and I have to use sleep(50) to keep it from being obnoxious like a strobe light (flickering), is there a better solution for this? Thanks HP OpenView ServiceCenter keep alive scriptRemote Desktop Login Script Link to comment Share on other sites More sharing options...
LurchMan Posted May 18, 2009 Share Posted May 18, 2009 I have a drop down box made in koda, that triggers whether a button is greyed out or not.What happens is that when I highlight the menu option guictrlcreatecombo($menu1) out of the drop down menu box, it triggers the button ($button1) to be enabled and I'd like it to only be enabled when the drop down box item is clicked (not highlighted) ... any ideas?Also, I have a guictrlread($button1) to check and see if the button is enabled, and I have to use sleep(50) to keep it from being obnoxious like a strobe light (flickering), is there a better solution for this?Thankscan we see some code so we know how you're doing this Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 18, 2009 Moderators Share Posted May 18, 2009 gte, I think this might be something like what you are looking for:#include <GUIConstantsEx.au3> #Include <GuiComboBox.au3> $hGUI = GUICreate("Test", 500, 500) $hCombo = GUICtrlCreateCombo("", 10, 10, 200, 20) GUICtrlSetData(-1, "Item 1|Enable Button|Item 2") $hButton = GUICtrlCreateButton("Test", 250, 10, 80, 30) GUICtrlSetState(-1, $GUI_DISABLE) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch If _GUICtrlComboBox_GetEditText($hCombo) = "Enable Button" Then If BitAnd(GUICtrlGetState($hButton), $GUI_DISABLE) Then GUICtrlSetState($hButton, $GUI_ENABLE) EndIf WEnd Only ENABLEs on selection and does not flicker. :-) M23 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...
Yashied Posted May 18, 2009 Share Posted May 18, 2009 Slightly corrected Melba23 examlple. expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiComboBox.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Test", 500, 500) $hCombo = GUICtrlCreateCombo("", 10, 10, 200, 20) GUICtrlSetData(-1, "Item 1|Enable Button|Item 2") $hButton = GUICtrlCreateButton("Test", 250, 10, 80, 30) GUICtrlSetState(-1, $GUI_DISABLE) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func WM_COMMAND($hWnd, $msgID, $wParam, $lParam) Switch BitAND($wParam, 0xFFFF) Case $hCombo Switch BitShift($wParam, 16) Case $CBN_SELCHANGE If GUICtrlRead($hCombo) = "Enable Button" Then If BitAND(GUICtrlGetState($hButton), $GUI_DISABLE) Then GUICtrlSetState($hButton, $GUI_ENABLE) EndIf Else If BitAND(GUICtrlGetState($hButton), $GUI_ENABLE) Then GUICtrlSetState($hButton, $GUI_DISABLE) EndIf EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND 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...
Moderators Melba23 Posted May 18, 2009 Moderators Share Posted May 18, 2009 Yashied,I would prefer "slightly different" to "slightly corrected". I thought my version worked quite nicely. ;-)M23 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...
gte Posted May 18, 2009 Author Share Posted May 18, 2009 Thanks all Melba, I'm having a heck of a time implementing this to my current script. I know I didn't post my current script because I think it would have been more confusing, but I can do that if necessary. Here is what I'm trying to replace with your style of code Switch GuiCtrlRead($updatenoworcreateschtask) Case 'Make update NOW in real time' GUICtrlSetState($updatelibrarylistbutton, $GUI_ENABLE) GUICtrlSetState($createtaskbutton, $gui_disable) Sleep(500) Case 'Create a scheduled task for later' GUICtrlSetState($createtaskbutton, $GUI_ENABLE) GUICtrlSetState($updatelibrarylistbutton, $gui_disable) Sleep(500) EndSwitch HP OpenView ServiceCenter keep alive scriptRemote Desktop Login Script Link to comment Share on other sites More sharing options...
Yashied Posted May 18, 2009 Share Posted May 18, 2009 Yashied,I would prefer "slightly different" to "slightly corrected". I thought my version worked quite nicely. ;-)M23OK 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...
Moderators Melba23 Posted May 18, 2009 Moderators Share Posted May 18, 2009 (edited) gte, What are you reading with this line:Switch GuiCtrlRead($updatenoworcreateschtask) M23 Edit: If it is the combo then this should work for you:#include <GUIConstantsEx.au3> #Include <GuiComboBox.au3> $hGUI = GUICreate("Test", 500, 500) $hCombo = GUICtrlCreateCombo("", 10, 10, 200, 20) GUICtrlSetData(-1, "Item 1|Update NOW|Schedule Task|Item 4") $hButton1 = GUICtrlCreateButton("Task", 250, 10, 80, 30) GUICtrlSetState(-1, $GUI_DISABLE) $hButton2 = GUICtrlCreateButton("Update", 250, 50, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch Switch _GUICtrlComboBox_GetEditText($hCombo) Case "Update NOW" If BitAnd(GUICtrlGetState($hButton2), $GUI_DISABLE) Then GUICtrlSetState($hButton2, $GUI_ENABLE) If BitAnd(GUICtrlGetState($hButton1), $GUI_ENABLE) Then GUICtrlSetState($hButton1, $GUI_DISABLE) Case "Schedule Task" If BitAnd(GUICtrlGetState($hButton1), $GUI_DISABLE) Then GUICtrlSetState($hButton1, $GUI_ENABLE) If BitAnd(GUICtrlGetState($hButton2), $GUI_ENABLE) Then GUICtrlSetState($hButton2, $GUI_DISABLE) EndSwitch WEnd Edited May 18, 2009 by Melba23 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...
gte Posted May 18, 2009 Author Share Posted May 18, 2009 That was it! Thanks! HP OpenView ServiceCenter keep alive scriptRemote Desktop Login Script Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 18, 2009 Moderators Share Posted May 18, 2009 gte, Glad I could help! M23 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...
gte Posted May 18, 2009 Author Share Posted May 18, 2009 If you don't mind ... another question on this topic I'm trying to apply this coding technique to other inputboxes and I'm failing Here is what I have, am I using the correct code? Switch _GUICtrlButton_GetCheck($passwordinputcheckbox) Case $passwordinputcheckbox if guictrlread($passwordinputcheckbox = $gui_checked Then GUICtrlSetState($passwordinput, $GUI_ENABLE) EndIf EndSwitch gte, Glad I could help! M23 HP OpenView ServiceCenter keep alive scriptRemote Desktop Login Script Link to comment Share on other sites More sharing options...
gte Posted May 18, 2009 Author Share Posted May 18, 2009 I think I figured it out!! Switch _GUICtrlButton_GetCheck($usernameinputcheckbox) Case $BST_CHECKED If BitAnd(GUICtrlGetState($usernameinput), $GUI_DISABLE) Then GUICtrlSetState($usernameinput, $GUI_ENABLE) Case $BST_UNCHECKED If BitAnd(GUICtrlGetState($usernameinput), $GUI_ENABLE) Then GUICtrlSetState($usernameinput, $GUI_DISABLE) EndSwitch HP OpenView ServiceCenter keep alive scriptRemote Desktop Login Script Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 18, 2009 Moderators Share Posted May 18, 2009 gte, That looks as if it should work. If you do not check the current state, you will apply the required state on each loop and get the dreaded "flickering". It is a pain, but worth the effort. :-) M23 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...
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