Jump to content

GUI checkbox


shornw
 Share

Recommended Posts

This is very odd (well I think so). This script will publish a disclaimer when a user runs a program which they will have to acknowledge before the program will run. The window opens fine but the checkbox is invisible until the cursor is rolled over it, which will cause issues for users.

Can anyone offer any suggestion as to why.

#include <file.au3>
#include <process.au3>
#include <GuiConstants.au3>
#include <GUIbutton.au3>

$head = FileRead("\\pdc001\scripts\run\head.txt")
$read = FileRead("\\pdc001\scripts\run\read.txt")

GUICreate("== IMPORTANT MESSAGE ==", 450, 360)

;create checkbox
$ACCEPT = GUICtrlCreateCheckbox("ACCEPT", 200, 270)

;Create Text
GUICtrlCreateLabel("Text will go here", 10, 20, 400, 300, 0001)

;Create Buttons
$exit = GUICtrlCreateButton("Exit", 270, 320, 70, 30)
$OK = GUICtrlCreateButton("OK", 90, 320, 70, 30)

;WinActivate("** ")
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Or $msg = $exit Then Exit
    If $msg = $OK Then
        _RunProg()
    EndIf
    ;   Exit
WEnd

Func _RunProg()
    If GUICtrlRead($ACCEPT) = $GUI_CHECKED Then
        Run("C:\Program Files\Internet Explorer\IEXPLORE.EXE http://google.co.uk")
        Exit
    EndIf
EndFunc   ;==>_RunProg

[font='Comic Sans MS']Eagles may soar high but weasels dont get sucked into jet engines[/font]

Link to comment
Share on other sites

The size of GUICtrlCreateLabel() was too large, it just painted over the checkbox....

#include <file.au3>
#include <process.au3>
#include <GuiConstants.au3>
#include <GUIbutton.au3>

$head = FileRead("\\pdc001\scripts\run\head.txt")
$read = FileRead("\\pdc001\scripts\run\read.txt")

GUICreate("== IMPORTANT MESSAGE ==", 450, 360)

;create checkbox
$ACCEPT = GUICtrlCreateCheckbox("ACCEPT", 200, 270)

;Create Text
GUICtrlCreateLabel("Text will go here", 10, 20, 400, 250)

;Create Buttons
$exit = GUICtrlCreateButton("Exit", 270, 320, 70, 30)
$OK = GUICtrlCreateButton("OK", 90, 320, 70, 30)

;WinActivate("** ")
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Or $msg = $exit Then Exit
    If $msg = $OK Then
        _RunProg()
    EndIf
    ;   Exit
WEnd

Func _RunProg()
    If GUICtrlRead($ACCEPT) = $GUI_CHECKED Then
        Run("C:\Program Files\Internet Explorer\IEXPLORE.EXE http://google.co.uk")
        Exit
    EndIf
EndFunc   ;==>_RunProg
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...