flagg777 Posted January 5, 2016 Share Posted January 5, 2016 Another easy question.What is the best way to refuse closing a windows (Or hitting the "ok" button on the msg box) if the radio button and/or input box is not filled in? Thanks again Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted January 5, 2016 Moderators Share Posted January 5, 2016 (edited) Grey out the control until the radio button is checked, or until input box <> ""Edit: Hit submit too quickly. I am assuming you mean on a GUI form you have created, not an external application? Edited January 5, 2016 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
flagg777 Posted January 5, 2016 Author Share Posted January 5, 2016 "grey out the control";Date $Date = GUICtrlCreateInput("", 72, 80, 97, 24) GUICtrlSetFont(-1, 10, 400, 0, "Arial") Global $DateFLD = GUICtrlRead($Date) and If (GUICtrlRead($Radio1pos) = $GUI_CHECKED) Then $sString &= "1|" ;Get Score $Script1 = 1What do you mean "grey out" -sorry, I'm a noob Link to comment Share on other sites More sharing options...
careca Posted January 5, 2016 Share Posted January 5, 2016 (edited) Means disable, problem i see is that i can't think of a way to check the input until it's closed, i'd do it in a custom GUI. Edited January 5, 2016 by careca Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted January 5, 2016 Moderators Share Posted January 5, 2016 (edited) There are a couple of ways you could do it. Below is a quick and dirty (and I do mean that, am typing in notepad) using GUIOnEventMode. It should work to give you an idea of how to accomplish what you're after:#include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) $hGUI = GUICreate("Test", 300, 300) GUISetOnEvent($GUI_EVENT_CLOSE, "GetOut") $btnGo = GUICtrlCreateButton("Next", 200, 250, 80, 40) GUICtrlSetState($btnGo, $GUI_DISABLE) $rbtnTest = GUICtrlCreateRadio("Test", 10, 10, 40, 30) GUICtrlSetOnEvent(-1, "_enable") GUISetState() While 1 Sleep(100) WEnd Func _enable() GUICtrlSetState($btnGo, $GUI_ENABLE) EndFunc Func GetOut() Exit EndFunc Edit: You could also do it like this, much easier:#include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 300, 300) $btnGo = GUICtrlCreateButton("Next", 200, 250, 80, 40) GUICtrlSetState($btnGo, $GUI_DISABLE) $cbxTest = GUICtrlCreateCheckbox("Test", 10, 10, 40, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cbxTest $i = GUICtrlRead($cbxTest) GUICtrlSetState($btnGo, ($i = 1) ? $GUI_ENABLE : $GUI_DISABLE) EndSwitch WEnd Edited January 5, 2016 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
flagg777 Posted January 5, 2016 Author Share Posted January 5, 2016 having trouble figuring this one out.. I tried to Frankenstein that code but it still does not disable the close button (or in my case the submit" buttonII tested with addingGUICtrlSetOnEvent(-1, "_enable")to one of my buttons, I was able to close it out. I also added to the submit button as you specified and the button was not disabled.GUICtrlSetState($btnGo, $GUI_DISABLE) Alpha-v028.au3 Link to comment Share on other sites More sharing options...
careca Posted January 5, 2016 Share Posted January 5, 2016 So what are the conditions you want, for the submit button to be enabled? only the radiocheck's? Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
flagg777 Posted January 5, 2016 Author Share Posted January 5, 2016 yes.I would love to understand the code so I can add it to the text boxes. Thanks for the help! Link to comment Share on other sites More sharing options...
careca Posted January 6, 2016 Share Posted January 6, 2016 So you want the submit button to be disabled until one of the checkboxes is selected? Code has to be adapted but what i would do is check the radio buttons state in loop, and state a condition of if one is checked, enable submit. But it raises questions like if radios have to be on the enabled or disabled sides. Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
flagg777 Posted January 6, 2016 Author Share Posted January 6, 2016 thanksI will try that.would you have an example?I tried to digest Logan3013's example but can't see how to incorporate into my script. Thanks again Link to comment Share on other sites More sharing options...
careca Posted January 6, 2016 Share Posted January 6, 2016 Of course you have to adapt the code to yours.While 1 $SomeRadio1 = GUICtrlRead($cbxTest) If $SomeRadio1=$GUI_CHECKED Then GUICtrlSetState($btnGo, $GUI_ENABLE) Else GUICtrlSetState($btnGo, $GUI_DISABLE) EndIf WEndNow, i should mention, this was done at work, so you have to adapt this$SomeRadio1=$GUI_CHECKEDTo something else, $SomeRadio1 will retrieve a number when checked, another when unchecked, or you can compare it with GUICtrlGetState.But it should give you an idea, it's basically what JLogan3o13 posted, but maybe you can understand it better.Best regards. Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe 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