Sign in to follow this  
Followers 0
Zithen

little checkbox question

3 posts in this topic

i'm kinda new to the gui thing and didnt see anything on this but i could be searching for the wrong thing.

I have a ini file

[section1]

key1=value1

[section2]

key2=value2

I know i would do the IniReadSectionNames to get the sections into a array and i know that i can use a for loop to get the section names out with $var[$i], but this is about as far as i can get. i dont know how to make it so that i can auto generate checkboxes out from them and then after that retrive the data from them. I have tried using $var[$i] = GuiCtrlCreateCheckbox($var[$i], and the rest of the info) but as you can guess and i thought that didnt work well. When it comes to getting the information from the check boxes everything that i have seen looks like u need to know exactly the id for the checkbox, but for the autogenerating of them there always going to be different....

anyone have any ideas?

PS i do know that i am bad at explaing myself at time, if you dont understand feel free to say so LOL

Share this post


Link to post
Share on other sites



maybe you should do 2 script! 1 who read the ini and make a second file au3 and then be excuted! you know you ask something like koda who do gui interface from user intervention, the only difference with you is you wanna make it from a ini!

big job in front of you hehe B)


GreenseedMCSE+I, CCNA, A+Canada, QuebecMake Love Around You.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

your.ini example

[section One]

Run program=Run What Program?

Command Promp=cmd

Key is the text in the check box, value is what you work with when it is checked

#include <GuiConstants.au3>

Dim $check_boxes, $x = 10, $y = 10
GUICreate("Check Boxes", 500, 500)

$vars = IniReadSection(@ScriptDir & "\your.ini", "Section One")
If @error Then
    MsgBox(4096, "", "Error occured, probably no INI file.")
Else
    For $i = 1 To $vars[0][0]
        If Not IsArray($check_boxes) Then
            Dim $check_boxes[1][2]
        EndIf
        ReDim $check_boxes[$i + 1][2]
        $check_boxes[0][0] = $i
        $check_boxes[$i][0] = GUICtrlCreateCheckbox($vars[$i][0], $x, $y, 120, 20)
        $check_boxes[$i][1] = $vars[$i][1]
        $y = $y + 25
    Next
EndIf

$button = GUICtrlCreateButton("Do Something", 220, 450, 120, 20)
GUISetState()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $button
            For $i = 1 To $check_boxes[0][0]
                If BitAND(GUICtrlRead($check_boxes[$i][0]), $GUI_CHECKED) Then
                    $iMsgBoxAnswer = MsgBox(1, "Do Something", $check_boxes[$i][1])
                    Select
                        Case $iMsgBoxAnswer = 1;OK
                            
                        Case $iMsgBoxAnswer = 2;Cancel
                            
                    EndSelect
                EndIf
            Next
    EndSelect
WEnd
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
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
Sign in to follow this  
Followers 0