Jump to content

checkbox and button


Recommended Posts

Hello my friends! ;)

I made something like this:

#include <GUIConstants.au3>

GUICreate("My GUI Checkbox"); will create a dialog box that when displayed is centered

$checkCN = GUICtrlCreateCheckbox ("CHECKBOX 1", 10, 10, 120, 20)
$checkCN = GUICtrlCreateCheckbox ("CHECKBOX 2", 10, 30, 120, 20)
$checkCN = GUICtrlCreateCheckbox ("CHECKBOX 3", 10, 50, 120, 20)
$checkCN = GUICtrlCreateCheckbox ("CHECKBOX 4", 10, 70, 120, 20)
$checkCN = GUICtrlCreateCheckbox ("CHECKBOX 5", 10, 90, 120, 20)
$checkCN = GUICtrlCreateCheckbox ("CHECKBOX 6", 10, 110, 120, 20)

Opt("GUICoordMode",2)
GUICtrlCreateButton ("next",  10, 30, 50)

GUISetState ()      ; will display an  dialog box with 1 checkbox

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

Posted Image

How can I do that, when I mark some of this "checkbox", for example three of them checkbox1, checkbox3, checkbox5, than I press button "next" this "checkbox1, checkbox3, checkbox5" will be write on some file checkbox.txt or checkbox.cmd

Sorry for my English, I hope so U now what I mean.

10x 4 help!! :P

Regards!!!

Edited by silencexx
Link to comment
Share on other sites

How can I do that, when I mark some of this "checkbox", for example three of them checkbox1, checkbox3, checkbox5, than I press button "next" this "checkbox1, checkbox3, checkbox5" will be write on some file checkbox.txt or checkbox.cmd

Sorry for my English, I hope so U now what I mean.

10x 4 help!! ;)

Regards!!!

i think this is what you're looking for: (new code in red)

$checkCN1 = GUICtrlCreateCheckbox ("CHECKBOX 1", 10, 10, 120, 20)

$checkCN2 = GUICtrlCreateCheckbox ("CHECKBOX 2", 10, 30, 120, 20)

$checkCN3 = GUICtrlCreateCheckbox ("CHECKBOX 3", 10, 50, 120, 20)

$checkCN4 = GUICtrlCreateCheckbox ("CHECKBOX 4", 10, 70, 120, 20)

$checkCN5 = GUICtrlCreateCheckbox ("CHECKBOX 5", 10, 90, 120, 20)

$checkCN6 = GUICtrlCreateCheckbox ("CHECKBOX 6", 10, 110, 120, 20)

Opt("GUICoordMode",2)

$ThisIsTheButton = GUICtrlCreateButton ("next",  10, 30, 50)

While 1

    $msg = GUIGetMsg()

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop

    if $msg = $ThisIsTheButton then

        $output = ""

        for $x = 1 To 6

            If GUICtrlRead(Eval("$checkcn" & $x)) = $GUI_CHECKED Then $output = $output & "checkbox" & $x & ","

        Next

        FileWrite("C:\output.txt",$output)

        MsgBox(0,"done","Checkboxes output to text file")

        Exit

    EndIf

WEnd

***edit*** sorry for no codebox, but i wasn't able to do color in the code box...

Edited by cameronsdad
Link to comment
Share on other sites

yes, looks great!! ;)

but is this working??? :P

I had problem to run this, thats mean I run script and no new window is opened.

I think It exaclly what I look for, but don't now why its not start :/

EDIT:

Ok, now it's working I added GUISetState() :oops:

Your file create new file but do not put text (4 example: checkbox1, checkbox2, etc when I mark it, and than push "next" button...:mad2:

Any way thx for fast halp :dance:

Edited by silencexx
Link to comment
Share on other sites

yes, looks great!! ;)

but is this working??? :P

I had problem to run this, thats mean I run script and no new window is opened.

I think It exaclly what I look for, but don't now why its not start :/

that's not a full script, just a modification of the script segment that you posted...you still need to create and display your gui with other code that you probably already have. just open your original code, and put my segment in where your segment was.

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...