Jump to content

check to see all gui are disabled


AntiVirusGuy
 Share

Recommended Posts

I am writing a student registartion program My program checks for the presance of our required software and if the software is found the coresponding button is disables so only the steps they need are enabled. At the very end when there are no more steps I want to enable a finish button. The first registartion we had all buttons enabled and they disapeared in order. This time around most students should be compliant so each student may have a little different requirements. Any ideas how to do this so nobody can skip to the end (they will) I am greatful to all who help on this forum

$1button = GUICtrlCreateButton ("1. Set network ID",50,100,200,40,$BS_LEFT)

$2button = GUICtrlCreateButton ("2. Remove old antivirus",50,150,200,40,$BS_LEFT)

$3button = GUICtrlCreateButton ("3. Install NOD32 Antivirus",50,200,200,40,$BS_LEFT)

$4button = GUICtrlCreateButton ("4. Install and run CCleaner",50,250,200,40,$BS_LEFT)

$5button = GUICtrlCreateButton ("5. Full virus scan",50,300,200,40,$BS_LEFT)

$6button = GUICtrlCreateButton ("6. Install Spy Sweeper",50,350,200,40,$BS_LEFT)

$7button = GUICtrlCreateButton ("7. Reboot your computer",50,400,200,40,$BS_LEFT)

GUICtrlSetState($2button,$GUI_DISABLE)

GUICtrlSetState($3button,$GUI_DISABLE)

GUICtrlSetState($4button,$GUI_DISABLE)

GUICtrlSetState($5button,$GUI_DISABLE)

GUICtrlSetState($6button,$GUI_DISABLE)

GUICtrlSetState($7button,$G

Link to comment
Share on other sites

Any ideas how to do this so nobody can skip to the end

Perhaps create a variable that is the sum of all "un-disabled" checkboxes. As long as that is >0 have the "FINISH" button disabled. Or, check the value of the variable whenever the "FINISH" button is pressed, and if it is >0, do nothing.
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
Share on other sites

zum beispiel:

#include <GUIConstants.au3>
GUICreate("My GUI state") ; will create a dialog box that when displayed is centered
GUICtrlCreateCheckbox ("My checkbox", 10,20)
$button = GUICtrlCreateButton ("my button", 50,50)
GUISetState ()
; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    If $msg = $button Then
        $var = GUICtrlRead(3); + GUICtrlRead(4)+GUICtrlRead(5)....
    ;MsgBox(1,"$var=",$var)
        if $var < 4 then MsgBox(1,"Not done","More to install"); if $var < n*4 where n is the number of checkboxes
        if $var = 4 then MsgBox(1,"All done","Finished!")
    EndIf
Wend
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
Share on other sites

maybe like this

#include <GuiConstants.au3>


Dim $button_[8], $buttons = 7

GUICreate("my gui", 400, 600)

$button_[1] = GUICtrlCreateButton ("1. Set network ID",50,100,200,40,$BS_LEFT)
$button_[2] = GUICtrlCreateButton ("2. Remove old antivirus",50,150,200,40,$BS_LEFT)
$button_[3] = GUICtrlCreateButton ("3. Install NOD32 Antivirus",50,200,200,40,$BS_LEFT)
$button_[4] = GUICtrlCreateButton ("4. Install and run CCleaner",50,250,200,40,$BS_LEFT)
$button_[5] = GUICtrlCreateButton ("5. Full virus scan",50,300,200,40,$BS_LEFT)
$button_[6] = GUICtrlCreateButton ("6. Install Spy Sweeper",50,350,200,40,$BS_LEFT)
$button_[7] = GUICtrlCreateButton ("7. Reboot your computer",50,400,200,40,$BS_LEFT)

$closer = GUICtrlCreateButton ("Close",150,500,100,30)
GUICtrlSetState( -1, $GUI_DISABLE)

For $x = 3 to $buttons
    GUICtrlSetState($button_[$x], $GUI_DISABLE)
Next


GUISetState()

While 1
    $msg = GUIGetMsg()

     If $msg = $GUI_EVENT_CLOSE Or $msg = $closer Then ExitLoop
         
    If $msg = $button_[1] Then
    ; do this
    ; then
        GUICtrlSetState($button_[1], $GUI_DISABLE)
        check_closer()
    EndIf
    
    If $msg = $button_[2] Then
    ; do this
    ; then
        GUICtrlSetState($button_[2], $GUI_DISABLE)
        check_closer()
    EndIf
    
    
WEnd

Func check_closer()
    Sleep(50)
    For $t = 1 to $buttons
        If GUICtrlGetState($button_[$t]) = 80 Then Return
    Next
    GUICtrlSetState($closer, $GUI_ENABLE)
EndFunc

8)

NEWHeader1.png

Link to comment
Share on other sites

Dim $click,$button[7],$buttonfinish

$button[0] = GUICtrlCreateButton ("1. Set network ID",50,100,200,40,$BS_LEFT)

$button[1] = GUICtrlCreateButton ("2. Remove old antivirus",50,150,200,40,$BS_LEFT)

$button[2] = GUICtrlCreateButton ("3. Install NOD32 Antivirus",50,200,200,40,$BS_LEFT)

$button[3] = GUICtrlCreateButton ("4. Install and run CCleaner",50,250,200,40,$BS_LEFT)

$button[4] = GUICtrlCreateButton ("5. Full virus scan",50,300,200,40,$BS_LEFT)

$button[5] = GUICtrlCreateButton ("6. Install Spy Sweeper",50,350,200,40,$BS_LEFT)

$button[6] = GUICtrlCreateButton ("7. Reboot your computer",50,400,200,40,$BS_LEFT)

$buttonfinish=GUICtrlCreateButton ("Finish",xx,xx,xx,xx)

While 1

$click = GUIGetMsg()

Select

Case $click=$GUI_EVENT_CLOSE

ExitLoop

Case $click=$button[0]

... Things you want to do when button 0 pressed

GUICtrlSetState($button[0],$GUI_DISABLE) ; Disable the button 0when finish

Case $click=$button[1]

... Things you want to do when button 1 pressed

GUICtrlSetState($button[1],$GUI_DISABLE) ; Disable the button 1 when finish

...

...

...

;;;; If all button are disabled, means all steps finish, set FINISH button enable

Case GUICtrlGetState($button[0])=$GUI_DISABLE And GUICtrlGetState($button[1])=$GUI_DISABLE And ... GUICtrlGetState($button[6])=$GUI_DISABLE

GUICtrlSetState($buttonfinish,$GUI_ENABLE)

EndSelect

WEnd

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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