Jump to content

Recommended Posts

Posted

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

 

 

  • Moderators
Posted (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 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!

Posted

"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 = 1

What do you mean "grey out"

 

-sorry, I'm a noob

 

Posted (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 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

  • Moderators
Posted (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 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!

Posted

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" button

II tested with adding

GUICtrlSetOnEvent(-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

Posted

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

Posted

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

Posted

thanks

I 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

Posted

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

    WEnd

Now, i should mention, this was done at work, so you have to adapt this

$SomeRadio1=$GUI_CHECKED

To 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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...