shai Posted January 31, 2011 Share Posted January 31, 2011 (edited) it possible set button to $GUI_DISABLE and if user fill the input this button auto change to $GUI_ENABLE? Edited January 31, 2011 by shai Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 31, 2011 Moderators Share Posted January 31, 2011 shai,That is quite easy to do. Use GUICtrlSetState(Button_ControlID, $GUI_DISABLE) immediately after the button is created.Then you can either use GUICtrlRead on the input within your idle loop or, more sexily, look for an $EN_CHANGE message from the input - either will show that data has been entered into the input. Once you have data in the input, use GUICtrlSetState(Button_ControlID, $GUI_ENABLE) to enable the button.Piece of cake! Try it and see how you get on. 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...
shai Posted January 31, 2011 Author Share Posted January 31, 2011 this is my code. Func uninstallmode() GUICreate ("remove tool", 150, 165, 0, 0, $WS_CAPTION) $serial = GUICtrlCreateInput("", 10, 10, 130, 20, $ES_NUMBER+$ES_PASSWORD) $ok_btn = GUICtrlCreateButton("ok", 10, 35, 130, 20) $next_next = GUICtrlCreateButton("next...", 10, 85, 130, 20) $after_uninstall = GUICtrlCreateButton("clear", 10, 110, 130, 20) GUICtrlSetState($ok_btn,$GUI_DISABLE) GUISetBkColor(0xFFFFFF) GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $cancel_btn GUIDelete() Case $ok_btn If GUICtrlRead($serial) = "000000" Then uninstall() exit EndIf Case $next_next aotuuninstall() Case $after_uninstall afteruninstall() EndSwitch WEnd EndFunc you can show my example? thanks Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 1, 2011 Moderators Share Posted February 1, 2011 (edited) shai,After giving you a step-by-step explanation, I would have expected you to make at least an attempt at coding this yourself! However, if I must:Using GUICtrlRead:expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> uninstallmode() Func uninstallmode() GUICreate("remove tool", 150, 165, 0, 0, $WS_CAPTION) $serial = GUICtrlCreateInput("", 10, 10, 130, 20, $ES_NUMBER + $ES_PASSWORD) $ok_btn = GUICtrlCreateButton("ok", 10, 35, 130, 20) $next_next = GUICtrlCreateButton("next...", 10, 85, 130, 20) $after_uninstall = GUICtrlCreateButton("clear", 10, 110, 130, 20) $cancel_btn = GUICtrlCreateButton("cancel", 10, 135, 130, 20) GUICtrlSetState($ok_btn, $GUI_DISABLE) GUISetBkColor(0xFFFFFF) GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $cancel_btn GUIDelete() Exit Case $ok_btn If GUICtrlRead($serial) = "000000" Then ConsoleWrite("uninstall()" & @CRLF) Exit EndIf Case $next_next ConsoleWrite("aotuuninstall()" & @CRLF) Case $after_uninstall ConsoleWrite("afteruninstall()" & @CRLF) EndSwitch If GUICtrlRead($serial) <> "" And Not BitAnd(GUICtrlGetState($ok_Btn), $GUI_ENABLE) Then GUICtrlSetState($ok_btn, $GUI_ENABLE) WEnd EndFunc ;==>uninstallmodeUsing GUIRegisterMsg (look at the GUIRegisterMsg tutorial in the Wiki if you are unsure about what this function does ):expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> Global $serial, $ok_btn uninstallmode() Func uninstallmode() GUICreate("remove tool", 150, 165, 0, 0, $WS_CAPTION) $serial = GUICtrlCreateInput("", 10, 10, 130, 20, $ES_NUMBER + $ES_PASSWORD) ConsoleWrite($serial & @CRLF) $ok_btn = GUICtrlCreateButton("ok", 10, 35, 130, 20) $next_next = GUICtrlCreateButton("next...", 10, 85, 130, 20) $after_uninstall = GUICtrlCreateButton("clear", 10, 110, 130, 20) $cancel_btn = GUICtrlCreateButton("cancel", 10, 135, 130, 20) GUICtrlSetState($ok_btn, $GUI_DISABLE) GUISetBkColor(0xFFFFFF) GUISetState() GUIRegisterMsg($WM_COMMAND, "On_WM_COMMAND") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $cancel_btn GUIDelete() Exit Case $ok_btn If GUICtrlRead($serial) = "000000" Then ConsoleWrite("uninstall()" & @CRLF) Exit EndIf Case $next_next ConsoleWrite("aotuuninstall()" & @CRLF) Case $after_uninstall ConsoleWrite("afteruninstall()" & @CRLF) EndSwitch WEnd EndFunc ;==>uninstallmode Func On_WM_COMMAND($hWnd, $Msg, $wParam, $lParam) $nNotifyCode = BitShift($wParam, 16) $nID = BitAND($wParam, 0x0000FFFF) If $nNotifyCode = $EN_UPDATE And $nID = $serial Then If Not BitAND(GUICtrlGetState($ok_btn), $GUI_ENABLE) Then GUICtrlSetState($ok_btn, $GUI_ENABLE) EndIf EndFunc ;==>On_WM_COMMANDNote in both cases you need to check that the button is not already enabled before enabling it - if you do not do this you get "flashing" of the control, particularly when the mouse moves. M23P.S. And next time, please post code that runs so I do not have to add a bunch of lines to get it to work. Edit: Typnig! Edited February 1, 2011 by Melba23 Silas 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 Link to comment Share on other sites More sharing options...
shai Posted February 1, 2011 Author Share Posted February 1, 2011 thank you very match 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