Jump to content

Reading file contents


 Share

Recommended Posts

Hi all,

Currently i'm busy with making a 'Mark Registration System' So I can keep track of the marks that I get at school. This script uses filefine functions to fund the files. And it adds them to the listview. But how to change the text displayed on the tab when its doubleclicked? I saw the GuiCtrlCreateTreeview() example and I see that there has been used cases to do so. But those TreeViewItems were already there, so how to do itt with 'generated' treeviewitems?

My Current Code:

#include <GUIConstants.au3>
#Include <GuiStatusBar.au3>

$main = GUICreate("Cijfer Registratie Systeem 3.2", 780, 425)  ; will create a dialog box that when displayed is centered
$treeview = GUICtrlCreateTreeView(5, 25, 120, 350)
$hdd1 = GUICtrlCreateTreeViewItem("Groepen", $treeview)
GUICtrlSetColor(-1, 0x0000C0)
$menu = GUICtrlCreateContextMenu($hdd1)
GUICtrlCreateMenuItem("Nieuwe groep", $menu)
GUICtrlCreateMenuItem("Verwijder groep", $menu)
$main_handle = WinGetHandle($main)
$statusbar = _GUIctrlstatusbar_Create($main_handle)
$menu_main = GUICtrlCreateMenu("Menu")
GUICtrlCreateMenuItem("Exit", $menu_main)
$menu_groups = GUICtrlCreateMenu("Groepen")
GUICtrlCreateMenuItem("Toevoegen", $menu_groups)
GUICtrlCreateMenuItem("Verwijderen", $menu_groups)
GUICtrlCreateMenuItem("Bewerken", $menu_groups)
$menu_users = GUICtrlCreateMenu("Gebruikers")
GUICtrlCreateMenuItem("Toevoegen", $menu_users)
GUICtrlCreateMenuItem("Verwijderen", $menu_users)
GUICtrlCreateMenuItem("Bewerken", $menu_users)
_GUICtrlStatusBar_SetText($statusbar, "Zoeken naar groepen....")
$search = FileFindFirstFile("Groepen\*.ini")  

; Check if the search was successful
If $search = -1 Then
 MsgBox(0, "Error", "Geen groepen gevonden!")
 Exit
EndIf

While 1
 $file = FileFindNextFile($search) 
 If @error Then ExitLoop
 $replace = StringReplace($file, ".ini", "")
 GUICtrlCreateTreeViewItem($replace, $hdd1)
WEnd

; Close the search handle
FileClose($search)

;-------------------------------------------------

$hdd2 = GUICtrlCreateTreeViewItem("Gebruikers", $treeview)
GUICtrlSetColor(-1, 0x0000C0)
$menu1= GUICtrlCreateContextMenu($hdd2)
GUICtrlCreateMenuItem("Nieuwe gebruiker", $menu1)
GUICtrlCreateMenuItem("Verwijder gebruiker", $menu1)
_GUICtrlStatusBar_SetText($statusbar, "Zoeken naar users....")
$search2 = FileFindFirstFile("Users\*.ini")  

; Check if the search was successful
If $search2 = -1 Then
 MsgBox(0, "Error", "Geen gebruikers gevonden!")
 Exit
EndIf

While 1
 $file2 = FileFindNextFile($search2) 
 If @error Then ExitLoop
 $replace2 = StringReplace($file2, ".ini", "")
 GUICtrlCreateTreeViewItem($replace2, $hdd2)
WEnd

; Close the search handle
FileClose($search2)

GUICtrlSetState($hdd1, $GUI_DEFBUTTON)
GUICtrlSetState($hdd2, $GUI_DEFBUTTON)

$tab = GUICtrlCreateTab(140, 20, 630, 370)
GUICtrlCreateTabItem("Algemeen")
GUICtrlCreateLabel("TEKST KOMT HIER", 190, 70)
GUICtrlCreateTabItem("Cijfers")
GUICtrlCreateTabItem("Beoordelingen")
_GUICtrlStatusBar_SetText($statusbar, "Ready...")
GUISetState (@SW_SHOW)       ; will display an empty dialog box

; Run the GUI until the dialog is closed
While 1
 $msg = GUIGetMsg()
 Select
 Case $msg = $GUI_EVENT_CLOSE
 ExitLoop 
 
 EndSelect
Wend

Thanks in advance.

Edit:

Oops I see I put my topic in the wrong forum, could a mod please move it to the right forum?

Edited by PcExpert
Link to comment
Share on other sites

I've changed my code a bit:

#include <GUIConstants.au3>
#Include <GuiStatusBar.au3>
#include <File.au3>

$main = GUICreate("Cijfer Registratie Systeem 3.2", 780, 425)  ; will create a dialog box that when displayed is centered
$treeview = GUICtrlCreateTreeView(5, 25, 120, 350)
$hdd1 = GUICtrlCreateTreeViewItem("Groepen", $treeview)
GUICtrlSetColor(-1, 0x0000C0)
$menu = GUICtrlCreateContextMenu($hdd1)
GUICtrlCreateMenuItem("Nieuwe groep", $menu)
GUICtrlCreateMenuItem("Verwijder groep", $menu)
$main_handle = WinGetHandle($main)
$statusbar = _GUIctrlstatusbar_Create($main_handle)
$menu_main = GUICtrlCreateMenu("Menu")
GUICtrlCreateMenuItem("Exit", $menu_main)
$menu_groups = GUICtrlCreateMenu("Groepen")
GUICtrlCreateMenuItem("Toevoegen", $menu_groups)
GUICtrlCreateMenuItem("Verwijderen", $menu_groups)
GUICtrlCreateMenuItem("Bewerken", $menu_groups)
$menu_users = GUICtrlCreateMenu("Gebruikers")
GUICtrlCreateMenuItem("Toevoegen", $menu_users)
GUICtrlCreateMenuItem("Verwijderen", $menu_users)
GUICtrlCreateMenuItem("Bewerken", $menu_users)
$hdd2 = GUICtrlCreateTreeViewItem("Gebruikers", $treeview)
GUICtrlSetColor(-1, 0x0000C0)
$menu1= GUICtrlCreateContextMenu($hdd2)
GUICtrlCreateMenuItem("Nieuwe gebruiker", $menu1)
GUICtrlCreateMenuItem("Verwijder gebruiker", $menu1)
_GUICtrlStatusBar_SetText($statusbar, "Zoeken naar users....")
GUICtrlSetState($hdd1, $GUI_DEFBUTTON)
GUICtrlSetState($hdd2, $GUI_DEFBUTTON)

$tab = GUICtrlCreateTab(140, 20, 630, 370)
GUICtrlCreateTabItem("Algemeen")
GUICtrlCreateLabel("TEKST KOMT HIER", 190, 70)
GUICtrlCreateTabItem("Cijfers")
GUICtrlCreateTabItem("Beoordelingen")
GUISetState (@SW_SHOW)       ; will display an empty dialog box
_GUICtrlStatusBar_SetText($statusbar, "Ready...")
_GUICtrlStatusBar_SetText($statusbar, "Zoeken naar groepen....")

$groepen_overview_filesArray=_FileListToArray("groepen\","*.ini")
For $i=1 To $groepen_overview_filesArray[0]
$groepen_overview_grnaam = StringTrimRight($groepen_overview_filesArray[$i], 4)
GUICtrlCreateTreeViewItem($groepen_overview_grnaam, $hdd1)
Next

$gebruikers_overview_filesArray=_FileListToArray("gebruikers\","*.ini")
For $b=1 To $gebruikers_overview_filesArray[0]
$gebruikers_overview_gbnaam = StringTrimRight($gebruikers_overview_filesArray[$b], 4)
GUICtrlCreateTreeViewItem($gebruikers_overview_gbnaam, $hdd2)
Next

 


; Run the GUI until the dialog is closed
While 1
 $msg = GUIGetMsg()
 Select
 Case $msg = $GUI_EVENT_CLOSE
 ExitLoop 
 EndSelect
Wend

But the question still is: How to update the info on the tabs when a item is selected/clicked?

Thanks

Link to comment
Share on other sites

OK, its done!:) Thanks all:)

Once this was done I moved on to the next step, but this also brings problems. I have an inifile that looks like this:

[algemeen]
vakken=this,is,my,text,separated,by,commas

I want to read the value of 'vakken' and then make checkboxes with the name of the splitted part where a comma is the delimiter.

My Code:

#include <GUIConstants.au3>
#include <EditConstants.au3>
#Include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Global $top = 50
Global $left = 15
Global $count = 0
Global $vtotal = 1
Opt("GUIOnEventMode", 1)


$Gui_addgroup = GUICreate("MyGui", 350, 175)
GUICtrlCreateLabel("Groepnaam:", 10, 10)
GUICtrlCreateInput("", 80, 7, 100, 20)
GUICtrlCreateGroup("Vakken", 10, 30, 330, 130)
GUISetState (@SW_SHOW, $Gui_addgroup)

$addgroup_vakken = IniRead("settings.ini", "Algemeen", "Vakken", "")
$addgroup_avakken = StringSplit($addgroup_vakken, ",")
$vtotal = $addgroup_avakken[0]
For $r=1 to  $addgroup_avakken[0]
If $count <5 Then
GUICtrlCreateCheckbox("TEST", $left, $top)
$count +=1
$top +=20
EndIf
Next

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
 ExitLoop
EndSelect
Wend

But this ofcourse only does the first five checkboxes and it doesnt give them the name found in the ini. Could you guys please help me with getting the right values for the boxes, and generating them? After 5 checkboxes I want a new row this continues until it has read all info from the ini. At the top I have also secified $left, wich I would like to get 65 pixels bigger each time a row has completed (the space between the rows;).

Edited by PcExpert
Link to comment
Share on other sites

OK, now after some time of think what went wrong, I figured it out. But now the thing is that Guictrlgetstate() returns numbers instead of a state, for example, the number 80 is returned. How can I check the state of each generated checkbox?

My Code:

#include <GUIConstants.au3>
#include <EditConstants.au3>
#Include <GuiTreeView.au3>
#include <WindowsConstants.au3>
Dim $CheckBox[16]


Global $top = 50
Global $left = 15
Global $count = 1
Global $vtotal = 1
Opt("GUIOnEventMode", 1)


$Gui_addgroup = GUICreate("Cijfer Registratie Systeem | Nieuwe groep", 350, 175)
GUICtrlCreateLabel("Groepnaam:", 10, 10)
GUICtrlCreateInput("", 80, 7, 100, 20)
GUICtrlCreateGroup("Vakken", 10, 30, 330, 130)
GUICtrlCreateButton("OK", 250, 135, 80, 35)
GUICtrlSetOnEvent(-1, "go")
GUISetState (@SW_SHOW, $Gui_addgroup)

$addgroup_vakken = IniRead("settings.ini", "Algemeen", "Vakken", "")
$addgroup_avakken = StringSplit($addgroup_vakken, ",")
$vtotal = $addgroup_avakken[0]
For $i = 0 To 4
 If $addgroup_avakken[$count] = "" Then
 ContinueLoop
 Else
    $Checkbox[$i] = GUICtrlCreateCheckbox($addgroup_avakken[$count], 45, $top, 50, 20) 
 $count +=1
 $top +=20
 EndIf
Next
$top = 50
For $i = 0 To 4
 If $addgroup_avakken[$count] = "" Then
 ContinueLoop
 Else 
    $Checkbox[$i] = GUICtrlCreateCheckbox($addgroup_avakken[$count], 110, $top, 50, 20) 
 $count +=1
 $top +=20
 EndIf
Next
$top = 50
For $i = 0 To 4
 If $addgroup_avakken[$count] = "" Then
 ContinueLoop
 Else
    $Checkbox[$i] = GUICtrlCreateCheckbox($addgroup_avakken[$count], 175, $top, 50, 20) 
 $count +=1
 $top +=20
 EndIf
Next

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
 ExitLoop
EndSelect
Wend


Func go()   
For $i = 0 To $count
 MsgBox(0, "", GUICtrlGetState($Checkbox[$i]))
Next
EndFunc
Link to comment
Share on other sites

  • Moderators

PcExpert,

Most of the constants are set out in the corresponding ?Constants.au3 file, in this case GUIConstantsEx.au3. If you use the full version of SciTE, place the cursor over the #Include line and press Alt-I to get it into the editor. You just add the various values together to get the result.

So 80 = $GUI_SHOW (16) + $GUI_ENABLE (64).

M23

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Thanks M23 for your reply.

The command I used seemed to be wrong, as I need to get the state of all the generated checkboxes. I'll try to explain it better.

I want it like this:

The program reads from an ini that looks like this:

[Algemeen]
Vakken=vk1,vk2,vk3,vk4,vk5,vk6,vk7,vk8,vk9,vk10,vk11,vk12,vk13,,

Generating checkboxes from the ini already works, as you can see here:

post-9750-1233508952_thumb.jpg

But when you press OK, it returns numbers which seem to be not right as a selected vk2 and it returned -1, that sort of things.

I want it to read the state of the checkboxes (checked or unchecked) and then if the box is checked, read the text of the selected boxes and write them to another ini.

My code:

#include <GUIConstants.au3>
#include <EditConstants.au3>
#Include <GuiTreeView.au3>
#include <WindowsConstants.au3>
Dim $CheckBox[16]


Global $top = 50
Global $left = 15
Global $count = 1
Global $vtotal = 1
Opt("GUIOnEventMode", 1)


$Gui_addgroup = GUICreate("Cijfer Registratie Systeem | Nieuwe groep", 350, 175)
GUICtrlCreateLabel("Groepnaam:", 10, 10)
GUICtrlCreateInput("", 80, 7, 100, 20)
GUICtrlCreateGroup("Vakken", 10, 30, 330, 130)
GUICtrlCreateButton("OK", 250, 135, 80, 35)
GUICtrlSetOnEvent(-1, "go")
GUISetState (@SW_SHOW, $Gui_addgroup)

$addgroup_vakken = IniRead("settings.ini", "Algemeen", "Vakken", "")
$addgroup_avakken = StringSplit($addgroup_vakken, ",")
$vtotal = $addgroup_avakken[0]
For $i = 0 To 4
 If $addgroup_avakken[$count] = "" Then
 ContinueLoop
 Else
    $Checkbox[$i] = GUICtrlCreateCheckbox($addgroup_avakken[$count], 45, $top, 50, 20) 
 $count +=1
 $top +=20
 EndIf
Next
$top = 50
For $i = 0 To 4
 If $addgroup_avakken[$count] = "" Then
 ContinueLoop
 Else 
    $Checkbox[$i] = GUICtrlCreateCheckbox($addgroup_avakken[$count], 110, $top, 50, 20) 
 $count +=1
 $top +=20
 EndIf
Next
$top = 50
For $i = 0 To 4
 If $addgroup_avakken[$count] = "" Then
 ContinueLoop
 Else
    $Checkbox[$i] = GUICtrlCreateCheckbox($addgroup_avakken[$count], 175, $top, 50, 20) 
 $count +=1
 $top +=20
 EndIf
Next

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
 ExitLoop
EndSelect
Wend


Func go()   
For $i = 0 To $count
 MsgBox(0, "", GUICtrlRead($Checkbox[$i]))
Next
EndFunc

I hope this explanation is clear about what I want and that you can/are willing to help me.

Thanks!

Edited by PcExpert
Link to comment
Share on other sites

  • Moderators

PcExpert,

First I assume you are creating the checkboxes one immediately after the other so that the control IDs are consecutive. If not - all bets are off!

You need to loop through the boxes and see if they are checked:

For $i = $ID_Checkbox_1 to $ID_Checkbox_n
    If BitAND(GUICtrlGetState($i), $GUI_CHECKED) = $GUI_CHECKED Then 
    ; Do whatever you need to do when that checkbox is checked
    EndIf
Next

You will have to develop some additional code to work out what to do when a box is checked. You could use a Switch depending on the value of $i within the For...Next loop, for example.

Hope that helps,

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

OK, its all done now, the checkboxes are made, now there came up a new problem: When I press the OK button to save the checked boxes it does not write my ini-file.

The current code:

#include <GUIConstants.au3>
#include <EditConstants.au3>
#Include <GuiTreeView.au3>
#include <WindowsConstants.au3>
Dim $CheckBox[16]


Global $top = 50
Global $left = 15
Global $count = 1
Global $vtotal = 1
Opt("GUIOnEventMode", 1)


$Gui_addgroup = GUICreate("MyGUI", 350, 175)
GUICtrlCreateLabel("Groepnaam:", 10, 10)
$newgroup = GUICtrlCreateInput("", 80, 7, 100, 20)
GUICtrlCreateGroup("Vakken", 10, 30, 330, 130)
GUICtrlCreateButton("OK", 250, 135, 80, 35)
GUICtrlSetOnEvent(-1, "GroupAddOK")
GUISetState (@SW_SHOW, $Gui_addgroup)

$vakken = IniReadSectionNames("vakken.ini")
If @error Then 
    MsgBox(4096, "", "Error occurred, probably no INI file.")
Else
    For $i = 1 To 5
        $Checkbox[$i] = GUICtrlCreateCheckbox($vakken[$i], 45, $top, 50, 20) 
  $count +=1
  $top +=20
    Next
$top = 50 
For $i = 1 To 5
        $Checkbox[$i] = GUICtrlCreateCheckbox($vakken[$i], 110, $top, 50, 20) 
  $count +=1
  $top +=20
    Next 
$top = 50 
For $i = 1 To 5
        $Checkbox[$i] = GUICtrlCreateCheckbox($vakken[$i], 175, $top, 50, 20) 
  $count +=1
  $top +=20
    Next 
 
EndIf

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
 ExitLoop
EndSelect
Wend


Func GroupAddOK()    
If GUICtrlRead($newgroup) = Not "" Then 
MsgBox(0, "", $count) 
For $f = 1 to $count
    $newgr1 = BitAnd(GUICtrlRead($Checkbox[$i]),$GUI_CHECKED)
 If $newgr1 = $GUI_CHECKED Then
 $newgr2 = GUICtrlRead(GUICtrlRead($Checkbox[$i]))
 IniWrite("groepen\" & GUICtrlRead($newgroup) & ".ini", "algemeen", "vakken", $newgr2  & ",")
    EndIf
Next
Else
MsgBox(64, "Cijfer Registratie Systeem | Melding" , "Vul AUB een geldige naam in voor de groep") 
EndIf
EndFunc

when I press the OK button it calls the 'GroupaddOK' function, the functioncall works, because if I dont type anything in the inputcontrol it gives me the error 'Vul AUB een geldige naam in voor de groep' which is right. The strange thing is that it does not write something to the inifile, it is not even being created. Does somebody know why this is happening?

Thanks!

Link to comment
Share on other sites

  • Moderators

PcExpert,

OK, where to start!!!!

In no particular order:

1. You cannot mix OnEvent mode and GetMsg mode in the same script. So if you want to use OnEvent for your 'OK' button, you must also use it to Exit your script - The While...GUIGetMsg()...Wend loop will never work! You need a GUISetOnEvent($GUI_EVENT_CLOSE, "Exit_function") line in there to action the red [X] being clicked (See code below).

2. You have 3 loops beginning:

For $i = 1 To 5

$Checkbox[$i] =

This means that in each loop, the 1-5 elements of the 16 element array you created to hold the ControlIds are being overwritten. You need to increase the looping variables each time (see the code below).

3. Your loop to read the checkbox names was, to be polite, not working. For example, you used $f in the For statement and then $i in the loop. And I am completely baffled by the $newgr2 = GUICtrlRead(GUICtrlRead($Checkbox[$i])) line!?!?!

As I understand your wishes, the idea is to loop through the boxes and each time a box is checked you add the name of the box to a string which is finally saved as an .ini file.

So create a null variable to start with, loop through the boxes and create your string. Then once you have the string, save it to the .ini file.

If you use the advanced version of GUICtrlRead it returns the name of the checkbox and not the state, so making the string is easy (see code below).

4. You must read the Help file carefully. In the IniWrite section it states:

If file does not exist, it is created. Any directories that do not exist, will not be created.

So adding your \groepen\ subdirectory to the .ini path doomed the write to failure even if the rest had worked! If you want to use a subdirectory then you must create it before using DirCreate.

5. I have no idea how you thought you could correctly read the .ini file to name your checkboxes. Your $vakken = IniReadSectionNames("vakken.ini") line returns nothing and the naming of your checkboxes needs an array. What you need to do is read in the Vakken key using IniRead, remove the "vk" letters and turn the string into an array. Then loop through the array to see which boxes should be ticked (see code below).

So after a fair bit of fiddling around (English understatement ;-)), I think this is close to what you want:

#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Global $CheckBox[16]

Global $top = 50
Global $left = 15
Global $count = 0
Global $vtotal = 1
Opt("GUIOnEventMode", 1)

$Gui_addgroup = GUICreate("MyGUI", 350, 175)
GUISetOnEvent($GUI_EVENT_CLOSE, "On_Exit") 
GUICtrlCreateLabel("Groepnaam:", 10, 10)
$newgroup = GUICtrlCreateInput("", 80, 7, 100, 20)
GUICtrlCreateGroup("Vakken", 10, 30, 330, 130)
GUICtrlCreateButton("OK", 250, 135, 80, 35)
GUICtrlSetOnEvent(-1, "GroupAddOK")
GUISetState(@SW_SHOW, $Gui_addgroup)

$vakken = IniRead("vakken.ini", "Algemeen", "Vakken", "")

If @error Then
    MsgBox(4096, "", "Error occurred, probably no INI file.")
Else
    
    For $i = 1 To 5
        $CheckBox[$i] = GUICtrlCreateCheckbox("vk" & $i, 45, $top, 50, 20) 
        $count += 1
        $top += 20
    Next
    $top = 50
    For $i = 6 To 10
        $CheckBox[$i] = GUICtrlCreateCheckbox("vk" & $i, 110, $top, 50, 20) 
        $count += 1
        $top += 20
    Next
    $top = 50
    For $i = 11 To 15
        $CheckBox[$i] = GUICtrlCreateCheckbox("vk" & $i, 175, $top, 50, 20) 
        $count += 1
        $top += 20
    Next

    $vakken = StringReplace($vakken, "vk", "")
    $vakken_array = StringSplit($vakken, ",")
    
    For $i = 1 To 15
        If $vakken_array[$i] <> "" Then
            GUICtrlSetState($CheckBox[$i], $GUI_CHECKED)
        EndIf
    Next

EndIf

While 1
    Sleep(100)
WEnd

Func On_Exit()
    ConsoleWrite("Exiting" & @CRLF)
    Exit
EndFunc

Func GroupAddOK()
    If GUICtrlRead($newgroup) = Not "" Then
        MsgBox(0, "", $count)
        $newgr2 = ""
        For $f = $CheckBox[1] To $CheckBox[25]
            $newgr1 = BitAND(GUICtrlRead($f), $GUI_CHECKED)
            If $newgr1 = $GUI_CHECKED Then
                $newgr2 &= GUICtrlRead($f, 1) & ","
            EndIf
        Next        
        $ini_File = @ScriptDir & "\" & GUICtrlRead($newgroup) & ".ini"
        IniWrite($ini_file, "algemeen", "vakken", $newgr2)
    Else
        MsgBox(64, "Cijfer Registratie Systeem | Melding", "Vul AUB een geldige naam in voor de groep")
    EndIf
EndFunc  ;==>GroupAddOK

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Melba23,

First I want to say thank you for all the help you have to me.There's one thing left I have menu's in my GUI, when I click one called 'groepen' and then click ' toevoegen' it should do something, but it does not do anything at all, why?

This is the code for the OnEvent Function:

$menu_groepen_toevoegen = GUICtrlCreateMenuItem("Toevoegen", $menu_groepen)
GUICtrlSetOnEvent(-1, "menu")oÝ÷ Ø   ݶ¬Ëayû§rبØZ¶ÈhºW[yÆ¥çZºÚ"µÍ[ÈY[J
BÝÚ]ÚÕRWÐÕQØÙH  ÌÍÛY[WÝZÚÙ[ÝÙ]ÙYÙ[^]ØÙH ÌÍÛY[WÙÜÙ[ÝÙ]ÙYÙ[ÙÐÞ
    ][ÝÛÝ]XÚ[   ][ÝË  ][ÝÞ[ÝIÌÎNÜHÛ[ÝÝÛ][ÝÊB[ÝÚ]Ú[[

I found this function here

Could you help me with this please? Thanks!

Edited by PcExpert
Link to comment
Share on other sites

  • Moderators

PcExpert,

Glad I could be of help.

About your new problem - what you have at the moment is a good example of how to use a single function for a number of OnEvent calls. You seem to want only one menu item ("Toevoegen") to activate this function - and so the function is overcomplicated for what you need.

Let me explain. When you make an GUICtrlSetOnEvent(ControlID, "function") statement, you are basically saying: When AutoIt sees that particular ControlID being activated, run "function". There is nothing to stop you telling every control to run that function - but you then have to write some code so that the function knows which control has called it. This is what is happening in your example function:

Switch @GUI_CTRLID                                  ; which control called me?
    Case $MenuItem3                                 ; if it was control $MenuItem3
        Exit                                        ; do this
    Case $MenuItem4                                 ; if it was control $MenuItem4
        MsgBox(0,"not much help", "you're on your own."); do this
EndSwitch

In fact, such a function is merely recreating the GUIGetMsg mode, where GUIGetMsg returns the ControlID of the control and you have to run a Switch or Select to choose what action to take. To me it seems a bit pointless to use the OnEvent mode and then be forced to recreate the same code as needed for GUIGetMsg mode.

So in your example, I would expect you to get a message box every time you pressed the "Toevoegen" menu item. Why? Your GUICtrlSetOnEvent(-1, "menu") line will run the "menu" function when you press your "Toevoegen" menu item and when you get into the function @GUI_CTRLID = $menu_groepen_toevoegen because that is the ControlID of the control clicked to call the function. The first check Case $menu_vakken_toevoegen is not true, but the second check Case $menu_groepen_toevoegen is true - and you get a message box!!

I hope that is all clear! I would strongly advise keeping to one function per OnEvent call - so just put the code you want to run when you click on "Toevoegen" in the "menu" function in place of what you have now. I believe "Toevoegen" means "Add", so put whatever you need to do to "Add" in there!

Ask if there is anything you would like me to explain further.

M23

Edited because I mixed up my "vakken"s and my "groepen"s!

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

It seems that everything works ok now; menu Items also work. I was wondering if for-next loops would work in on event mode, I now have a couple of them. And they dont seem to be working. When I click the menu Groepen and then go to 'Toevoegen' the right gui shows, but without the boxes generated by the for next-loop. This is the function:

Func group_vak_read()
 $vakken = IniRead("vakken.ini", "Algemeen", "Vakken", "")

If @error Then
    MsgBox(4096, "", "Error occurred, probably no INI file.")
Else
    
    For $i = 1 To 5
        $CheckBox[$i] = GUICtrlCreateCheckbox("vk" & $i, 45, $top, 50, 20) 
        $count += 1
        $top += 20
    Next
    $top = 50
    For $i = 6 To 10
        $CheckBox[$i] = GUICtrlCreateCheckbox("vk" & $i, 110, $top, 50, 20) 
        $count += 1
        $top += 20
    Next
    $top = 50
    For $i = 11 To 15
        $CheckBox[$i] = GUICtrlCreateCheckbox("vk" & $i, 175, $top, 50, 20) 
        $count += 1
        $top += 20
    Next

    $vakken = StringReplace($vakken, "vk", "")
    $vakken_array = StringSplit($vakken, ",")
    
    For $i = 1 To 15
        If $vakken_array[$i] <> "" Then
            GUICtrlSetData($CheckBox[$i], $vakken_array[$i])
        EndIf
    Next

EndIf
 GUISetState(@SW_SHOW, $Gui_addgroup) 
EndFunc

It seems that it immediately goes to the guisetstate part, I have got a separate au3-file with the gui and the loop and it works, it only does not when I put the main script and that script together. Any ideas why?

Link to comment
Share on other sites

  • Moderators

PcExpert,

Controls are created in the active GUI. From the Help file for GUISwitch:

Many of the GUI specific functions work on the "current" window - this is usually the last window created with GUICreate. This function allows you to make another window "current". That's does not mean that the referenced window will become active. You have to use WinActivate.

I notice that you are only showing the GUI (in which I presume you want to show the checkboxes) at at the end with GUISetState(@SW_SHOW, $Gui_addgroup). Perhaps if you used GUISwitch (and perhaps WinActivate) before the loops....

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

PcExpert,

Just attach it to a public post - others might be interested in learning something too.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

OK, here it goes:

I'll first show you the two script.

The first one is the main script:

#include <GUIConstants.au3>
#include <EditConstants.au3>
#Include <GuiTreeView.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#Include <GuiEdit.au3>

Local $avArray[120]
Global $CheckBox[16]
Global $newvak
Global $vakcount = 1
Global $top = 50
Global $left = 15
Global $count = 0
Global $vtotal = 1

Opt("GUIOnEventMode", 1)

Global $IniPath1 = @ScriptDir & "\Groepen\*.ini", $IniPath2 = @ScriptDir & "\Gebruikers\*.ini"

$Gui = GUICreate("Cijfer Registratie Systeem | Hoofdscherm", 780, 430)
GUISetOnEvent($GUI_EVENT_CLOSE, "Event", $Gui)
$menu_bestand = GUICtrlCreateMenu("&Bestand")
$menu_bestand_exit = GUICtrlCreateMenuItem("Afsluiten", $menu_bestand)
GUICtrlSetOnEvent(-1, "menu")
$menu_Groepen = GUICtrlCreateMenu("&Groepen")
$menu_groepen_toevoegen = GUICtrlCreateMenuItem("Toevoegen", $menu_groepen)
GUICtrlSetOnEvent(-1, "menu")
$menu_groepen_wijzigen = GUICtrlCreateMenuItem("Wijzigen", $menu_groepen)
GUICtrlSetOnEvent(-1, "menu")
$menu_groepen_verwijderen = GUICtrlCreateMenuItem("Verwijderen", $menu_groepen)
GUICtrlSetOnEvent(-1, "menu")
$menu_gebruikers = GUICtrlCreateMenu("&Gebruikers")
$menu_gebruikers_toevoegen = GUICtrlCreateMenuItem("Toevoegen", $menu_gebruikers)
GUICtrlSetOnEvent(-1, "menu")
$menu_gebruikers_wijzigen = GUICtrlCreateMenuItem("Wijzigen", $menu_gebruikers)
GUICtrlSetOnEvent(-1, "menu")
$menu_gebruikers_verwijderen = GUICtrlCreateMenuItem("Verwijderen", $menu_gebruikers)
GUICtrlSetOnEvent(-1, "menu")
$menu_vakken = GUICtrlCreateMenu("&Vakken")
$menu_vakken_toevoegen = GUICtrlCreateMenuItem("Toevoegen", $menu_vakken)
GUICtrlSetOnEvent(-1, "menu")
$menu_vakken_wijzigen = GUICtrlCreateMenuItem("Wijzigen", $menu_vakken)
GUICtrlSetOnEvent(-1, "menu")
$menu_vakken_verwijderen = GUICtrlCreateMenuItem("Verwijderen", $menu_vakken)
GUICtrlSetOnEvent(-1, "menu")
$menu_help = GUICtrlCreateMenu("&Help")
$menu_help_Help = GUICtrlCreateMenuItem("Help onderwerpen", $menu_help)
GUICtrlSetOnEvent(-1, "menu")
$menu_help_over = GUICtrlCreateMenuItem("Info", $menu_help)
GUICtrlSetOnEvent(-1, "menu")
$TV = GUICtrlCreateTreeView(5, 35, 120, 350)
$TVI1 = GUICtrlCreateTreeViewItem("Groepen", $TV)
GUICtrlSetColor(-1, 0x0000C0)
GUICtrlSetState(-1, $GUI_DEFBUTTON)
TVLoadIni($TVI1, $IniPath1)
$TVI2 = GUICtrlCreateTreeViewItem("Gebruikers", $TV)
GUICtrlSetColor(-1, 0x0000C0)
GUICtrlSetState(-1, $GUI_DEFBUTTON)
TVLoadIni($TVI2, $IniPath2)
$tab = GUICtrlCreateTab(140, 25, 630, 380)
GUICtrlCreateTabItem("Algemeen")
$Naam = GUICtrlCreateLabel("Naam:                  ", 150, 60, 300, 25)
$ovnr = GUICtrlCreateLabel("OV-Nummer:        ", 150, 80, 300, 25)
$adres = GUICtrlCreateLabel("Adres:                  ", 150, 100, 300, 25)
$postcode = GUICtrlCreateLabel("Postcode:            ", 150, 120, 300, 25)
$woonplaats = GUICtrlCreateLabel("Woonplaats:        ", 150, 140, 300, 25)
$telefoonnr = GUICtrlCreateLabel("Telefoonnummer: ", 150, 160, 300, 25)
$groep = GUICtrlCreateLabel("Groep:                  ", 150, 180, 300, 25)
GUICtrlSetBkColor(-1, 0xffffff)
GUICtrlCreateTabItem("Cijfers")
$vakken = GUICtrlCreateLabel("", 150, 60, 450, 25)
$toets1 = GUICtrlCreateLabel("Toets 1", 150, 90, 100, 25)
$toets2 = GUICtrlCreateLabel("Toets 2", 150, 110, 100, 25)
$toets3 = GUICtrlCreateLabel("Toets 3", 150, 130, 100, 25)
$toets4 = GUICtrlCreateLabel("Toets 4", 150, 150, 100, 25)
$rap1 = GUICtrlCreateLabel("Rapport 1", 150, 170, 100, 25)
$toets5 = GUICtrlCreateLabel("Toets 5", 150, 190, 100, 25)
$toets6 = GUICtrlCreateLabel("Toets 6", 150, 210, 100, 25)
$toets7 = GUICtrlCreateLabel("Toets 7", 150, 230, 100, 25)
$toets8 = GUICtrlCreateLabel("Toets 8", 150, 250, 100, 25)
$rap2 = GUICtrlCreateLabel("Rapport 2", 150, 270, 100, 25)
$toets9 = GUICtrlCreateLabel("Toets 9", 150, 290, 100, 25)
$toets10 = GUICtrlCreateLabel("Toets 10", 150, 310, 100, 25)
$toets11 = GUICtrlCreateLabel("Toets 11", 150, 330, 100, 25)
$toets12 = GUICtrlCreateLabel("Toets 12", 150, 350, 100, 25)
$rap3 = GUICtrlCreateLabel("Rapport 3", 150, 370, 100, 25)


$cijfer0 = GUICtrlCreateLabel("", 220, 90, 100, 25)
$cijfer1 = GUICtrlCreateLabel("", 220, 110, 100, 25)
$cijfer2 = GUICtrlCreateLabel("", 220, 130, 100, 25)
$cijfer3 = GUICtrlCreateLabel("", 220, 150, 100, 25)
$cijfer4 = GUICtrlCreateLabel("", 220, 170, 100, 25)
$cijfer5 = GUICtrlCreateLabel("", 220, 190, 100, 25)
$cijfer6 = GUICtrlCreateLabel("", 220, 210, 100, 25)
$cijfer7 = GUICtrlCreateLabel("", 220, 230, 100, 25)
$cijfer8 = GUICtrlCreateLabel("", 220, 250, 100, 25)
$cijfer9 = GUICtrlCreateLabel("", 220, 270, 100, 25)
$cijfer10 = GUICtrlCreateLabel("", 220, 290, 100, 25)
$cijfer11 = GUICtrlCreateLabel("", 220, 310, 100, 25)
$cijfer12 = GUICtrlCreateLabel("", 220, 330, 100, 25)
$cijfer13 = GUICtrlCreateLabel("", 220, 350, 100, 25)
$cijfer14 = GUICtrlCreateLabel("", 220, 370, 100, 25)

$cijfer15 = GUICtrlCreateLabel("", 270, 90, 100, 25)
$cijfer16 = GUICtrlCreateLabel("", 270, 110, 100, 25)
$cijfer17 = GUICtrlCreateLabel("", 270, 130, 100, 25)
$cijfer18 = GUICtrlCreateLabel("", 270, 150, 100, 25)
$cijfer19 = GUICtrlCreateLabel("", 270, 170, 100, 25)
$cijfer20 = GUICtrlCreateLabel("", 270, 190, 100, 25)
$cijfer21 = GUICtrlCreateLabel("", 270, 210, 100, 25)
$cijfer22 = GUICtrlCreateLabel("", 270, 230, 100, 25)
$cijfer23 = GUICtrlCreateLabel("", 270, 250, 100, 25)
$cijfer24 = GUICtrlCreateLabel("", 270, 270, 100, 25)
$cijfer25 = GUICtrlCreateLabel("", 270, 290, 100, 25)
$cijfer26 = GUICtrlCreateLabel("", 270, 310, 100, 25)
$cijfer27 = GUICtrlCreateLabel("", 270, 330, 100, 25)
$cijfer28 = GUICtrlCreateLabel("", 270, 350, 100, 25)
$cijfer29 = GUICtrlCreateLabel("", 270, 370, 100, 25)

$cijfer30 = GUICtrlCreateLabel("", 320, 90, 100, 25)
$cijfer31 = GUICtrlCreateLabel("", 320, 110, 100, 25)
$cijfer32 = GUICtrlCreateLabel("", 320, 130, 100, 25)
$cijfer33 = GUICtrlCreateLabel("", 320, 150, 100, 25)
$cijfer34 = GUICtrlCreateLabel("", 320, 170, 100, 25)
$cijfer35 = GUICtrlCreateLabel("", 320, 190, 100, 25)
$cijfer36 = GUICtrlCreateLabel("", 320, 210, 100, 25)
$cijfer37 = GUICtrlCreateLabel("", 320, 230, 100, 25)
$cijfer38 = GUICtrlCreateLabel("", 320, 250, 100, 25)
$cijfer39 = GUICtrlCreateLabel("", 320, 270, 100, 25)
$cijfer40 = GUICtrlCreateLabel("", 320, 290, 100, 25)
$cijfer41 = GUICtrlCreateLabel("", 320, 310, 100, 25)
$cijfer42 = GUICtrlCreateLabel("", 320, 330, 100, 25)
$cijfer43 = GUICtrlCreateLabel("", 320, 350, 100, 25)
$cijfer44 = GUICtrlCreateLabel("", 320, 370, 100, 25)

$cijfer45 = GUICtrlCreateLabel("", 370, 90, 100, 25)
$cijfer46 = GUICtrlCreateLabel("", 370, 110, 100, 25)
$cijfer47 = GUICtrlCreateLabel("", 370, 130, 100, 25)
$cijfer48 = GUICtrlCreateLabel("", 370, 150, 100, 25)
$cijfer49 = GUICtrlCreateLabel("", 370, 170, 100, 25)
$cijfer50 = GUICtrlCreateLabel("", 370, 190, 100, 25)
$cijfer51 = GUICtrlCreateLabel("", 370, 210, 100, 25)
$cijfer52 = GUICtrlCreateLabel("", 370, 230, 100, 25)
$cijfer53 = GUICtrlCreateLabel("", 370, 250, 100, 25)
$cijfer54 = GUICtrlCreateLabel("", 370, 270, 100, 25)
$cijfer55 = GUICtrlCreateLabel("", 370, 290, 100, 25)
$cijfer56 = GUICtrlCreateLabel("", 370, 310, 100, 25)
$cijfer57 = GUICtrlCreateLabel("", 370, 330, 100, 25)
$cijfer58 = GUICtrlCreateLabel("", 370, 350, 100, 25)
$cijfer59 = GUICtrlCreateLabel("", 370, 370, 100, 25)

$cijfer60 = GUICtrlCreateLabel("", 420, 90, 100, 25)
$cijfer61 = GUICtrlCreateLabel("", 420, 110, 100, 25)
$cijfer62 = GUICtrlCreateLabel("", 420, 130, 100, 25)
$cijfer63 = GUICtrlCreateLabel("", 420, 150, 100, 25)
$cijfer64 = GUICtrlCreateLabel("", 420, 170, 100, 25)
$cijfer65 = GUICtrlCreateLabel("", 420, 190, 100, 25)
$cijfer66 = GUICtrlCreateLabel("", 420, 210, 100, 25)
$cijfer67 = GUICtrlCreateLabel("", 420, 230, 100, 25)
$cijfer68 = GUICtrlCreateLabel("", 420, 250, 100, 25)
$cijfer69 = GUICtrlCreateLabel("", 420, 270, 100, 25)
$cijfer70 = GUICtrlCreateLabel("", 420, 290, 100, 25)
$cijfer71 = GUICtrlCreateLabel("", 420, 310, 100, 25)
$cijfer72 = GUICtrlCreateLabel("", 420, 330, 100, 25)
$cijfer73 = GUICtrlCreateLabel("", 420, 350, 100, 25)
$cijfer74 = GUICtrlCreateLabel("", 420, 370, 100, 25)

$cijfer75 = GUICtrlCreateLabel("", 470, 90, 100, 25)
$cijfer76 = GUICtrlCreateLabel("", 470, 110, 100, 25)
$cijfer77 = GUICtrlCreateLabel("", 470, 130, 100, 25)
$cijfer78 = GUICtrlCreateLabel("", 470, 150, 100, 25)
$cijfer79 = GUICtrlCreateLabel("", 470, 170, 100, 25)
$cijfer80 = GUICtrlCreateLabel("", 470, 190, 100, 25)
$cijfer81 = GUICtrlCreateLabel("", 470, 210, 100, 25)
$cijfer82 = GUICtrlCreateLabel("", 470, 230, 100, 25)
$cijfer83 = GUICtrlCreateLabel("", 470, 250, 100, 25)
$cijfer84 = GUICtrlCreateLabel("", 470, 270, 100, 25)
$cijfer85 = GUICtrlCreateLabel("", 470, 290, 100, 25)
$cijfer86 = GUICtrlCreateLabel("", 470, 310, 100, 25)
$cijfer87 = GUICtrlCreateLabel("", 470, 330, 100, 25)
$cijfer88 = GUICtrlCreateLabel("", 470, 350, 100, 25)
$cijfer89 = GUICtrlCreateLabel("", 470, 370, 100, 25)

$cijfer90 = GUICtrlCreateLabel("", 520, 90, 100, 25)
$cijfer91 = GUICtrlCreateLabel("", 520, 110, 100, 25)
$cijfer92 = GUICtrlCreateLabel("", 520, 130, 100, 25)
$cijfer93 = GUICtrlCreateLabel("", 520, 150, 100, 25)
$cijfer94 = GUICtrlCreateLabel("", 520, 170, 100, 25)
$cijfer95 = GUICtrlCreateLabel("", 520, 190, 100, 25)
$cijfer96 = GUICtrlCreateLabel("", 520, 210, 100, 25)
$cijfer97 = GUICtrlCreateLabel("", 520, 230, 100, 25)
$cijfer98 = GUICtrlCreateLabel("", 520, 250, 100, 25)
$cijfer99 = GUICtrlCreateLabel("", 520, 270, 100, 25)
$cijfer100 = GUICtrlCreateLabel("", 520, 290, 100, 25)
$cijfer101 = GUICtrlCreateLabel("", 520, 310, 100, 25)
$cijfer102 = GUICtrlCreateLabel("", 520, 330, 100, 25)
$cijfer103 = GUICtrlCreateLabel("", 520, 350, 100, 25)
$cijfer104 = GUICtrlCreateLabel("", 520, 370, 100, 25)

$cijfer105 = GUICtrlCreateLabel("", 570, 90, 100, 25)
$cijfer106 = GUICtrlCreateLabel("", 570, 110, 100, 25)
$cijfer107 = GUICtrlCreateLabel("", 570, 130, 100, 25)
$cijfer108 = GUICtrlCreateLabel("", 570, 150, 100, 25)
$cijfer109 = GUICtrlCreateLabel("", 570, 170, 100, 25)
$cijfer110 = GUICtrlCreateLabel("", 570, 190, 100, 25)
$cijfer111 = GUICtrlCreateLabel("", 570, 210, 100, 25)
$cijfer112 = GUICtrlCreateLabel("", 570, 230, 100, 25)
$cijfer113 = GUICtrlCreateLabel("", 570, 250, 100, 25)
$cijfer114 = GUICtrlCreateLabel("", 570, 270, 100, 25)
$cijfer115 = GUICtrlCreateLabel("", 570, 290, 100, 25)
$cijfer116 = GUICtrlCreateLabel("", 570, 310, 100, 25)
$cijfer117 = GUICtrlCreateLabel("", 570, 330, 100, 25)
$cijfer118 = GUICtrlCreateLabel("", 570, 350, 100, 25)
$cijfer119 = GUICtrlCreateLabel("", 570, 370, 100, 25)


GUICtrlCreateTabItem("Beoordelingen")
$beoordeling = GUICtrlCreateEdit("", 150, 60, 605, 330, $ES_READONLY + $ES_WANTRETURN)
_GUICtrlEdit_SetMargins($beoordeling, $EC_RIGHTMARGIN, 0, 10)
GUISetState (@SW_SHOW, $Gui)

$Gui_addvak = GUICreate("Cijfer Registratie Systeem | Nieuw vak", 350, 175)
GUICtrlCreateLabel("vak:", 10, 10)
$vak1 = GUICtrlCreateInput("", 55, 7, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 10, 35)
$vak2 = GUICtrlCreateInput("", 55, 32, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 10, 60)
$vak3 = GUICtrlCreateInput("", 55, 57, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 10, 85)
$vak4 = GUICtrlCreateInput("", 55, 82, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 10, 110)
$vak5 = GUICtrlCreateInput("", 55, 107, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 10, 135)
$vak6 = GUICtrlCreateInput("", 55, 132, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 110, 10)
$vak7 = GUICtrlCreateInput("", 155, 7, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 110, 35)
$vak8 = GUICtrlCreateInput("", 155, 32, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 110, 60)
$vak9 = GUICtrlCreateInput("", 155, 57, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 110, 85)
$vak10 = GUICtrlCreateInput("", 155, 82, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 110, 110)
$vak11 = GUICtrlCreateInput("", 155, 107, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 110, 135)
$vak12 = GUICtrlCreateInput("", 155, 132, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 210, 10)
$vak13 = GUICtrlCreateInput("", 255, 7, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 210, 35)
$vak14 = GUICtrlCreateInput("", 255, 32, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 210, 60)
$vak15 = GUICtrlCreateInput("", 255, 57, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateButton("OK", 250, 135, 80, 35)
GUICtrlSetOnEvent(-1, "addvak")
GUISetState (@SW_HIDE, $Gui_addvak)

 

 

 

 

 

 

 

 


While 1
    Sleep(100)
Wend

Func Event()
    Switch @GUI_CtrlId
        Case $GUI_EVENT_CLOSE
            Exit
        Case Else
            $rnaam = IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Algemeen", "naam", "")
   $rov = IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Algemeen", "OV", "")
   $radres = IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Algemeen", "adres", "")
   $rpostcode = IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Algemeen", "postcode", "")
   $rwoonplaats = IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Algemeen", "woonplaats", "")
   $rtelefoon = IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Algemeen", "telefoon", "")
   $rgroep = IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Algemeen", "groep", "")
   $rvakken = IniRead(@ScriptDir & "\groepen\" & $rgroep & ".ini", "Algemeen", "vakken", "")
   $rbeoordeling = IniReadSection(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "beoordeling")
   $rvakken1 = StringReplace($rvakken, ",", "         ")
   $avakken = StringSplit($rvakken, ",")
   $avakken1 = $avakken[1]
   $avakken2 = $avakken[2]
   $avakken3 = $avakken[3]
   $avakken4 = $avakken[4]
   $avakken5 = $avakken[5]
   $avakken6 = $avakken[6]
   $avakken7 = $avakken[7]
   $avakken8 = $avakken[8]
   
         If Not @error Then 
   GUICtrlSetData($Naam, "Naam:                  " & $rnaam)
   GUICtrlSetData($ovnr, "OV-Nummer:        " & $rov)
   GUICtrlSetData($adres, "Adres:                  " & $radres)
   GUICtrlSetData($postcode, "Postcode:            " & $rpostcode)
   GUICtrlSetData($woonplaats, "Woonplaats:        " & $rwoonplaats)
   GUICtrlSetData($telefoonnr, "Telefoonnummer: " & $rtelefoon)
   GUICtrlSetData($groep, "Groep:                  " & $rgroep)
   GUICtrlSetData($vakken, "                       " & $rvakken1)
   For $i = 1 To $rbeoordeling[0][0]
   _GUICtrlEdit_AppendText($beoordeling, $rbeoordeling[$i][0] & ":" & @CRLF & $rbeoordeling[$i][1] & @CRLF & @CRLF)
   Next
   $avk1 = StringSplit(IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Cijfers", $avakken1, ""), ",")
   GUICtrlSetData($cijfer0, $avk1[1])
   GUICtrlSetData($cijfer1, $avk1[2])
   GUICtrlSetData($cijfer2, $avk1[3])
   GUICtrlSetData($cijfer3, $avk1[4])
   GUICtrlSetData($cijfer4, $avk1[5])
   GUICtrlSetData($cijfer5, $avk1[6])
   GUICtrlSetData($cijfer6, $avk1[7])
   GUICtrlSetData($cijfer7, $avk1[8])
   GUICtrlSetData($cijfer8, $avk1[9])
   GUICtrlSetData($cijfer9, $avk1[10])
   GUICtrlSetData($cijfer10, $avk1[11])
   GUICtrlSetData($cijfer11, $avk1[12])
   GUICtrlSetData($cijfer12, $avk1[13])
   GUICtrlSetData($cijfer13, $avk1[14])
   GUICtrlSetData($cijfer14, $avk1[15])
   
   $avk2 = StringSplit(IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Cijfers", $avakken2, ""), ",")
   GUICtrlSetData($cijfer15, $avk2[1])
   GUICtrlSetData($cijfer16, $avk2[2])
   GUICtrlSetData($cijfer17, $avk2[3])
   GUICtrlSetData($cijfer18, $avk2[4])
   GUICtrlSetData($cijfer19, $avk2[5])
   GUICtrlSetData($cijfer20, $avk2[6])
   GUICtrlSetData($cijfer21, $avk2[7])
   GUICtrlSetData($cijfer22, $avk2[8])
   GUICtrlSetData($cijfer23, $avk2[9])
   GUICtrlSetData($cijfer24, $avk2[10])
   GUICtrlSetData($cijfer25, $avk2[11])
   GUICtrlSetData($cijfer26, $avk2[12])
   GUICtrlSetData($cijfer27, $avk2[13])
   GUICtrlSetData($cijfer28, $avk2[14])
   GUICtrlSetData($cijfer29, $avk2[15])
   
   $avk3 = StringSplit(IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Cijfers", $avakken3, ""), ",")
   GUICtrlSetData($cijfer30, $avk3[1])
   GUICtrlSetData($cijfer31, $avk3[2])
   GUICtrlSetData($cijfer32, $avk3[3])
   GUICtrlSetData($cijfer33, $avk3[4])
   GUICtrlSetData($cijfer34, $avk3[5])
   GUICtrlSetData($cijfer35, $avk3[6])
   GUICtrlSetData($cijfer36, $avk3[7])
   GUICtrlSetData($cijfer37, $avk3[8])
   GUICtrlSetData($cijfer38, $avk3[9])
   GUICtrlSetData($cijfer39, $avk3[10])
   GUICtrlSetData($cijfer40, $avk3[11])
   GUICtrlSetData($cijfer41, $avk3[12])
   GUICtrlSetData($cijfer42, $avk3[13])
   GUICtrlSetData($cijfer43, $avk3[14])
   GUICtrlSetData($cijfer44, $avk3[15])
   
   $avk4 = StringSplit(IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Cijfers", $avakken4, ""), ",")
   GUICtrlSetData($cijfer45, $avk4[1])
   GUICtrlSetData($cijfer46, $avk4[2])
   GUICtrlSetData($cijfer47, $avk4[3])
   GUICtrlSetData($cijfer48, $avk4[4])
   GUICtrlSetData($cijfer49, $avk4[5])
   GUICtrlSetData($cijfer50, $avk4[6])
   GUICtrlSetData($cijfer51, $avk4[7])
   GUICtrlSetData($cijfer52, $avk4[8])
   GUICtrlSetData($cijfer53, $avk4[9])
   GUICtrlSetData($cijfer54, $avk4[10])
   GUICtrlSetData($cijfer55, $avk4[11])
   GUICtrlSetData($cijfer56, $avk4[12])
   GUICtrlSetData($cijfer57, $avk4[13])
   GUICtrlSetData($cijfer58, $avk4[14])
   GUICtrlSetData($cijfer59, $avk4[15])
   
   $avk5 = StringSplit(IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Cijfers", $avakken5, ""), ",")
   GUICtrlSetData($cijfer60, $avk5[1])
   GUICtrlSetData($cijfer61, $avk5[2])
   GUICtrlSetData($cijfer62, $avk5[3])
   GUICtrlSetData($cijfer63, $avk5[4])
   GUICtrlSetData($cijfer64, $avk5[5])
   GUICtrlSetData($cijfer65, $avk5[6])
   GUICtrlSetData($cijfer66, $avk5[7])
   GUICtrlSetData($cijfer67, $avk5[8])
   GUICtrlSetData($cijfer68, $avk5[9])
   GUICtrlSetData($cijfer69, $avk5[10])
   GUICtrlSetData($cijfer70, $avk5[11])
   GUICtrlSetData($cijfer71, $avk5[12])
   GUICtrlSetData($cijfer72, $avk5[13])
   GUICtrlSetData($cijfer73, $avk5[14])
   GUICtrlSetData($cijfer74, $avk5[15])
   
   $avk6 = StringSplit(IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Cijfers", $avakken6, ""), ",")
   GUICtrlSetData($cijfer75, $avk6[1])
   GUICtrlSetData($cijfer76, $avk6[2])
   GUICtrlSetData($cijfer77, $avk6[3])
   GUICtrlSetData($cijfer78, $avk6[4])
   GUICtrlSetData($cijfer79, $avk6[5])
   GUICtrlSetData($cijfer80, $avk6[6])
   GUICtrlSetData($cijfer81, $avk6[7])
   GUICtrlSetData($cijfer82, $avk6[8])
   GUICtrlSetData($cijfer83, $avk6[9])
   GUICtrlSetData($cijfer84, $avk6[10])
   GUICtrlSetData($cijfer85, $avk6[11])
   GUICtrlSetData($cijfer86, $avk6[12])
   GUICtrlSetData($cijfer87, $avk6[13])
   GUICtrlSetData($cijfer88, $avk6[14])
   GUICtrlSetData($cijfer89, $avk6[15])
   
   $avk7 = StringSplit(IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Cijfers", $avakken7, ""), ",")
   GUICtrlSetData($cijfer90, $avk7[1])
   GUICtrlSetData($cijfer91, $avk7[2])
   GUICtrlSetData($cijfer92, $avk7[3])
   GUICtrlSetData($cijfer93, $avk7[4])
   GUICtrlSetData($cijfer94, $avk7[5])
   GUICtrlSetData($cijfer95, $avk7[6])
   GUICtrlSetData($cijfer96, $avk7[7])
   GUICtrlSetData($cijfer97, $avk7[8])
   GUICtrlSetData($cijfer98, $avk7[9])
   GUICtrlSetData($cijfer99, $avk7[10])
   GUICtrlSetData($cijfer100, $avk7[11])
   GUICtrlSetData($cijfer101, $avk7[12])
   GUICtrlSetData($cijfer102, $avk7[13])
   GUICtrlSetData($cijfer103, $avk7[14])
   GUICtrlSetData($cijfer104, $avk7[15])
      
   $avk8 = StringSplit(IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Cijfers", $avakken8, ""), ",")
   GUICtrlSetData($cijfer105, $avk8[1])
   GUICtrlSetData($cijfer106, $avk8[2])
   GUICtrlSetData($cijfer107, $avk8[3])
   GUICtrlSetData($cijfer108, $avk8[4])
   GUICtrlSetData($cijfer109, $avk8[5])
   GUICtrlSetData($cijfer110, $avk8[6])
   GUICtrlSetData($cijfer111, $avk8[7])
   GUICtrlSetData($cijfer112, $avk8[8])
   GUICtrlSetData($cijfer113, $avk8[9])
   GUICtrlSetData($cijfer114, $avk8[10])
   GUICtrlSetData($cijfer115, $avk8[11])
   GUICtrlSetData($cijfer116, $avk8[12])
   GUICtrlSetData($cijfer117, $avk8[13])
   GUICtrlSetData($cijfer118, $avk8[14])
   GUICtrlSetData($cijfer119, $avk8[15])
      
   
   
   
            EndIf
    EndSwitch
EndFunc

Func TVLoadIni($tviID, $iPath)
    Local $FFFF, $FFNF, $STR
    $FFFF = FileFindFirstFile($iPath)
    If $FFFF = -1 Then Return -1
    While 1
        $FFNF = FileFindNextFile($FFFF)
        If @error Then ExitLoop
        $STR = StringTrimRight($FFNF, 4)
        GUICtrlCreateTreeViewItem($STR, $tviID)
        GUICtrlSetOnEvent(-1, "Event")
        GUICtrlSetColor(-1, 0x0000C0)
    WEnd
    FileClose($FFFF)
    Return 0
EndFunc

Func _TVGetItemTree($i_treeview, $s_sep_char, $h_tv_item = 0)
    Local $szPath = "", $hParent, $h_item
    If $h_tv_item <> 0 Then
        $h_item = $h_tv_item
    Else
        $h_item = GUICtrlSendMsg($i_treeview, $TVM_GETNEXTITEM, $TVGN_CARET, 0)
    EndIf
    If $h_item > 0 Then
        $szPath = _TVGetItemText($i_treeview, $h_item)
        Do
            $hParent = GUICtrlSendMsg($i_treeview, $TVM_GETNEXTITEM, $TVGN_PARENT, $h_item)
            If $hParent > 0 Then $szPath = _TVGetItemText($i_treeview, $hParent) & $s_sep_char & $szPath
            $h_item = $hParent
        Until $h_item <= 0
    EndIf

    Return $szPath
EndFunc   ;==>_TVGetItemTree

Func _TVGetItemText($i_treeview, $h_item = 0) ; copy, name changed
    Local $s_txt = ""
    If $h_item = 0 Then Return ""
    Local $st_txt = DllStructCreate("char[4096]")
    Local $st_TVI = DllStructCreate("uint;uint;uint;uint;ptr;int;int;int;int;uint;int")
    DllStructSetData($st_TVI, 1, $TVIF_TEXT)
    DllStructSetData($st_TVI, 2, $h_item)
    DllStructSetData($st_TVI, 5, DllStructGetPtr($st_txt))
    DllStructSetData($st_TVI, 6, DllStructGetSize($st_txt))
    If GUICtrlSendMsg($i_treeview, $TVM_GETITEM, 0, DllStructGetPtr($st_TVI)) Then $s_txt = DllStructGetData($st_txt, 1)
    Return $s_txt
EndFunc   ;==>_TVGetText

Func On_Exit()
    GUISetState(@SW_HIDE, @GUI_CtrlId)
    Exit
EndFunc

Func menu()
    
    Switch @GUI_CTRLID
  Case $menu_bestand_exit
   Exit
  Case $menu_gebruikers_toevoegen
     
  Case $menu_gebruikers_wijzigen 
  Case $menu_gebruikers_verwijderen
  Case $menu_groepen_toevoegen
  Case $menu_groepen_wijzigen 
  Case $menu_groepen_verwijderen 
        Case $menu_vakken_toevoegen
   GUISetState(@SW_SHOW, $Gui_addvak)
  Case $menu_vakken_wijzigen
  Case $menu_vakken_verwijderen 
    EndSwitch
EndFunc


Func addvak()
$new_vak1 = "vk" & GUICtrlRead($vak1) & ","
$new_vak2 = "vk" & GUICtrlRead($vak2) & ","
$new_vak3 = "vk" & GUICtrlRead($vak3) & ","
$new_vak4 = "vk" & GUICtrlRead($vak4) & ","
$new_vak5 = "vk" & GUICtrlRead($vak5) & ","
$new_vak6 = "vk" & GUICtrlRead($vak6) & ","
$new_vak7 = "vk" & GUICtrlRead($vak7) & ","
$new_vak8 = "vk" & GUICtrlRead($vak8) & ","
$new_vak9 = "vk" & GUICtrlRead($vak9) & ","
$new_vak10 = "vk" & GUICtrlRead($vak10) & ","
$new_vak11 = "vk" & GUICtrlRead($vak11) & ","
$new_vak12 = "vk" & GUICtrlRead($vak12) & ","
$new_vak13 = "vk" & GUICtrlRead($vak13) & ","
$new_vak14 = "vk" & GUICtrlRead($vak14) & ","
$new_vak15 = "vk" & GUICtrlRead($vak15) & ","

$newvak = $new_vak1 & $new_vak2 & $new_vak3 & $new_vak4 & $new_vak5 & $new_vak6 & $new_vak7 & $new_vak8 & $new_vak9 & $new_vak10 & $new_vak11 & $new_vak12 & $new_vak13 & $new_vak14 & $new_vak15

IniWrite("vakken.ini", "algemeen", "vakken", $newvak)

MsgBox(64, "Cijfer Registratie Systeem | Melding", "Vak(ken) toegevoegd")
EndFunc

The second one is the other gui with the checkboxes:

#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Global $CheckBox[16]

Global $top = 50
Global $left = 15
Global $count = 0
Global $vtotal = 1
Opt("GUIOnEventMode", 1)

$Gui_addgroup = GUICreate("MyGUI", 350, 175)
GUISetOnEvent($GUI_EVENT_CLOSE, "On_Exit") 
GUICtrlCreateLabel("Groepnaam:", 10, 10)
$newgroup = GUICtrlCreateInput("", 80, 7, 100, 20)
GUICtrlCreateGroup("Vakken", 10, 30, 330, 130)
GUICtrlCreateButton("OK", 250, 135, 80, 35)
GUICtrlSetOnEvent(-1, "GroupAddOK")
GUISetState(@SW_SHOW, $Gui_addgroup)

$vakken = IniRead("vakken.ini", "Algemeen", "Vakken", "")

If @error Then
    MsgBox(4096, "", "Error occurred, probably no INI file.")
Else
    
    For $i = 1 To 5
        $CheckBox[$i] = GUICtrlCreateCheckbox("vk" & $i, 45, $top, 50, 20) 
        $count += 1
        $top += 20
    Next
    $top = 50
    For $i = 6 To 10
        $CheckBox[$i] = GUICtrlCreateCheckbox("vk" & $i, 110, $top, 50, 20) 
        $count += 1
        $top += 20
    Next
    $top = 50
    For $i = 11 To 15
        $CheckBox[$i] = GUICtrlCreateCheckbox("vk" & $i, 175, $top, 50, 20) 
        $count += 1
        $top += 20
    Next

    $vakken = StringReplace($vakken, "vk", "")
    $vakken_array = StringSplit($vakken, ",")
    
    For $i = 1 To 15
        If $vakken_array[$i] <> "" Then
            GUICtrlSetData($CheckBox[$i], $vakken_array[$i])
        EndIf
    Next

EndIf

While 1
    Sleep(100)
WEnd

Func On_Exit()
    ConsoleWrite("Exiting" & @CRLF)
    Exit
EndFunc

Func GroupAddOK()
    If GUICtrlRead($newgroup) = Not "" Then
        $newgr2 = ""
        For $f = $CheckBox[1] To $CheckBox[15]
            $newgr1 = BitAND(GUICtrlRead($f), $GUI_CHECKED)
            If $newgr1 = $GUI_CHECKED Then
                $newgr2 &= GUICtrlRead($f, 1) & ","
            EndIf
        Next        
        $ini_File = @ScriptDir & "\groepen\" & GUICtrlRead($newgroup) & ".ini"
        IniWrite($ini_file, "algemeen", "vakken", $newgr2)
    Else
        MsgBox(64, "Cijfer Registratie Systeem | Melding", "Vul AUB een geldige naam in voor de groep")
    EndIf
EndFunc  ;==>GroupAddOK

The separate scripts work fine. Now I want to add them together:

#include <GUIConstants.au3>
#include <EditConstants.au3>
#Include <GuiTreeView.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#Include <GuiEdit.au3>

Local $avArray[120]
Global $CheckBox[16]
Global $newvak
Global $vakcount = 1
Global $top = 50
Global $left = 15
Global $count = 0
Global $vtotal = 1

Opt("GUIOnEventMode", 1)

Global $IniPath1 = @ScriptDir & "\Groepen\*.ini", $IniPath2 = @ScriptDir & "\Gebruikers\*.ini"

$Gui = GUICreate("Cijfer Registratie Systeem | Hoofdscherm", 780, 430)
GUISetOnEvent($GUI_EVENT_CLOSE, "Event", $Gui)
$menu_bestand = GUICtrlCreateMenu("&Bestand")
$menu_bestand_exit = GUICtrlCreateMenuItem("Afsluiten", $menu_bestand)
GUICtrlSetOnEvent(-1, "menu")
$menu_Groepen = GUICtrlCreateMenu("&Groepen")
$menu_groepen_toevoegen = GUICtrlCreateMenuItem("Toevoegen", $menu_groepen)
GUICtrlSetOnEvent(-1, "menu")
$menu_groepen_wijzigen = GUICtrlCreateMenuItem("Wijzigen", $menu_groepen)
GUICtrlSetOnEvent(-1, "menu")
$menu_groepen_verwijderen = GUICtrlCreateMenuItem("Verwijderen", $menu_groepen)
GUICtrlSetOnEvent(-1, "menu")
$menu_gebruikers = GUICtrlCreateMenu("&Gebruikers")
$menu_gebruikers_toevoegen = GUICtrlCreateMenuItem("Toevoegen", $menu_gebruikers)
GUICtrlSetOnEvent(-1, "menu")
$menu_gebruikers_wijzigen = GUICtrlCreateMenuItem("Wijzigen", $menu_gebruikers)
GUICtrlSetOnEvent(-1, "menu")
$menu_gebruikers_verwijderen = GUICtrlCreateMenuItem("Verwijderen", $menu_gebruikers)
GUICtrlSetOnEvent(-1, "menu")
$menu_vakken = GUICtrlCreateMenu("&Vakken")
$menu_vakken_toevoegen = GUICtrlCreateMenuItem("Toevoegen", $menu_vakken)
GUICtrlSetOnEvent(-1, "menu")
$menu_vakken_wijzigen = GUICtrlCreateMenuItem("Wijzigen", $menu_vakken)
GUICtrlSetOnEvent(-1, "menu")
$menu_vakken_verwijderen = GUICtrlCreateMenuItem("Verwijderen", $menu_vakken)
GUICtrlSetOnEvent(-1, "menu")
$menu_help = GUICtrlCreateMenu("&Help")
$menu_help_Help = GUICtrlCreateMenuItem("Help onderwerpen", $menu_help)
GUICtrlSetOnEvent(-1, "menu")
$menu_help_over = GUICtrlCreateMenuItem("Info", $menu_help)
GUICtrlSetOnEvent(-1, "menu")
$TV = GUICtrlCreateTreeView(5, 35, 120, 350)
$TVI1 = GUICtrlCreateTreeViewItem("Groepen", $TV)
GUICtrlSetColor(-1, 0x0000C0)
GUICtrlSetState(-1, $GUI_DEFBUTTON)
TVLoadIni($TVI1, $IniPath1)
$TVI2 = GUICtrlCreateTreeViewItem("Gebruikers", $TV)
GUICtrlSetColor(-1, 0x0000C0)
GUICtrlSetState(-1, $GUI_DEFBUTTON)
TVLoadIni($TVI2, $IniPath2)
$tab = GUICtrlCreateTab(140, 25, 630, 380)
GUICtrlCreateTabItem("Algemeen")
$Naam = GUICtrlCreateLabel("Naam:                  ", 150, 60, 300, 25)
$ovnr = GUICtrlCreateLabel("OV-Nummer:        ", 150, 80, 300, 25)
$adres = GUICtrlCreateLabel("Adres:                  ", 150, 100, 300, 25)
$postcode = GUICtrlCreateLabel("Postcode:            ", 150, 120, 300, 25)
$woonplaats = GUICtrlCreateLabel("Woonplaats:        ", 150, 140, 300, 25)
$telefoonnr = GUICtrlCreateLabel("Telefoonnummer: ", 150, 160, 300, 25)
$groep = GUICtrlCreateLabel("Groep:                  ", 150, 180, 300, 25)
GUICtrlSetBkColor(-1, 0xffffff)
GUICtrlCreateTabItem("Cijfers")
$vakken = GUICtrlCreateLabel("", 150, 60, 450, 25)
$toets1 = GUICtrlCreateLabel("Toets 1", 150, 90, 100, 25)
$toets2 = GUICtrlCreateLabel("Toets 2", 150, 110, 100, 25)
$toets3 = GUICtrlCreateLabel("Toets 3", 150, 130, 100, 25)
$toets4 = GUICtrlCreateLabel("Toets 4", 150, 150, 100, 25)
$rap1 = GUICtrlCreateLabel("Rapport 1", 150, 170, 100, 25)
$toets5 = GUICtrlCreateLabel("Toets 5", 150, 190, 100, 25)
$toets6 = GUICtrlCreateLabel("Toets 6", 150, 210, 100, 25)
$toets7 = GUICtrlCreateLabel("Toets 7", 150, 230, 100, 25)
$toets8 = GUICtrlCreateLabel("Toets 8", 150, 250, 100, 25)
$rap2 = GUICtrlCreateLabel("Rapport 2", 150, 270, 100, 25)
$toets9 = GUICtrlCreateLabel("Toets 9", 150, 290, 100, 25)
$toets10 = GUICtrlCreateLabel("Toets 10", 150, 310, 100, 25)
$toets11 = GUICtrlCreateLabel("Toets 11", 150, 330, 100, 25)
$toets12 = GUICtrlCreateLabel("Toets 12", 150, 350, 100, 25)
$rap3 = GUICtrlCreateLabel("Rapport 3", 150, 370, 100, 25)


$cijfer0 = GUICtrlCreateLabel("", 220, 90, 100, 25)
$cijfer1 = GUICtrlCreateLabel("", 220, 110, 100, 25)
$cijfer2 = GUICtrlCreateLabel("", 220, 130, 100, 25)
$cijfer3 = GUICtrlCreateLabel("", 220, 150, 100, 25)
$cijfer4 = GUICtrlCreateLabel("", 220, 170, 100, 25)
$cijfer5 = GUICtrlCreateLabel("", 220, 190, 100, 25)
$cijfer6 = GUICtrlCreateLabel("", 220, 210, 100, 25)
$cijfer7 = GUICtrlCreateLabel("", 220, 230, 100, 25)
$cijfer8 = GUICtrlCreateLabel("", 220, 250, 100, 25)
$cijfer9 = GUICtrlCreateLabel("", 220, 270, 100, 25)
$cijfer10 = GUICtrlCreateLabel("", 220, 290, 100, 25)
$cijfer11 = GUICtrlCreateLabel("", 220, 310, 100, 25)
$cijfer12 = GUICtrlCreateLabel("", 220, 330, 100, 25)
$cijfer13 = GUICtrlCreateLabel("", 220, 350, 100, 25)
$cijfer14 = GUICtrlCreateLabel("", 220, 370, 100, 25)

$cijfer15 = GUICtrlCreateLabel("", 270, 90, 100, 25)
$cijfer16 = GUICtrlCreateLabel("", 270, 110, 100, 25)
$cijfer17 = GUICtrlCreateLabel("", 270, 130, 100, 25)
$cijfer18 = GUICtrlCreateLabel("", 270, 150, 100, 25)
$cijfer19 = GUICtrlCreateLabel("", 270, 170, 100, 25)
$cijfer20 = GUICtrlCreateLabel("", 270, 190, 100, 25)
$cijfer21 = GUICtrlCreateLabel("", 270, 210, 100, 25)
$cijfer22 = GUICtrlCreateLabel("", 270, 230, 100, 25)
$cijfer23 = GUICtrlCreateLabel("", 270, 250, 100, 25)
$cijfer24 = GUICtrlCreateLabel("", 270, 270, 100, 25)
$cijfer25 = GUICtrlCreateLabel("", 270, 290, 100, 25)
$cijfer26 = GUICtrlCreateLabel("", 270, 310, 100, 25)
$cijfer27 = GUICtrlCreateLabel("", 270, 330, 100, 25)
$cijfer28 = GUICtrlCreateLabel("", 270, 350, 100, 25)
$cijfer29 = GUICtrlCreateLabel("", 270, 370, 100, 25)

$cijfer30 = GUICtrlCreateLabel("", 320, 90, 100, 25)
$cijfer31 = GUICtrlCreateLabel("", 320, 110, 100, 25)
$cijfer32 = GUICtrlCreateLabel("", 320, 130, 100, 25)
$cijfer33 = GUICtrlCreateLabel("", 320, 150, 100, 25)
$cijfer34 = GUICtrlCreateLabel("", 320, 170, 100, 25)
$cijfer35 = GUICtrlCreateLabel("", 320, 190, 100, 25)
$cijfer36 = GUICtrlCreateLabel("", 320, 210, 100, 25)
$cijfer37 = GUICtrlCreateLabel("", 320, 230, 100, 25)
$cijfer38 = GUICtrlCreateLabel("", 320, 250, 100, 25)
$cijfer39 = GUICtrlCreateLabel("", 320, 270, 100, 25)
$cijfer40 = GUICtrlCreateLabel("", 320, 290, 100, 25)
$cijfer41 = GUICtrlCreateLabel("", 320, 310, 100, 25)
$cijfer42 = GUICtrlCreateLabel("", 320, 330, 100, 25)
$cijfer43 = GUICtrlCreateLabel("", 320, 350, 100, 25)
$cijfer44 = GUICtrlCreateLabel("", 320, 370, 100, 25)

$cijfer45 = GUICtrlCreateLabel("", 370, 90, 100, 25)
$cijfer46 = GUICtrlCreateLabel("", 370, 110, 100, 25)
$cijfer47 = GUICtrlCreateLabel("", 370, 130, 100, 25)
$cijfer48 = GUICtrlCreateLabel("", 370, 150, 100, 25)
$cijfer49 = GUICtrlCreateLabel("", 370, 170, 100, 25)
$cijfer50 = GUICtrlCreateLabel("", 370, 190, 100, 25)
$cijfer51 = GUICtrlCreateLabel("", 370, 210, 100, 25)
$cijfer52 = GUICtrlCreateLabel("", 370, 230, 100, 25)
$cijfer53 = GUICtrlCreateLabel("", 370, 250, 100, 25)
$cijfer54 = GUICtrlCreateLabel("", 370, 270, 100, 25)
$cijfer55 = GUICtrlCreateLabel("", 370, 290, 100, 25)
$cijfer56 = GUICtrlCreateLabel("", 370, 310, 100, 25)
$cijfer57 = GUICtrlCreateLabel("", 370, 330, 100, 25)
$cijfer58 = GUICtrlCreateLabel("", 370, 350, 100, 25)
$cijfer59 = GUICtrlCreateLabel("", 370, 370, 100, 25)

$cijfer60 = GUICtrlCreateLabel("", 420, 90, 100, 25)
$cijfer61 = GUICtrlCreateLabel("", 420, 110, 100, 25)
$cijfer62 = GUICtrlCreateLabel("", 420, 130, 100, 25)
$cijfer63 = GUICtrlCreateLabel("", 420, 150, 100, 25)
$cijfer64 = GUICtrlCreateLabel("", 420, 170, 100, 25)
$cijfer65 = GUICtrlCreateLabel("", 420, 190, 100, 25)
$cijfer66 = GUICtrlCreateLabel("", 420, 210, 100, 25)
$cijfer67 = GUICtrlCreateLabel("", 420, 230, 100, 25)
$cijfer68 = GUICtrlCreateLabel("", 420, 250, 100, 25)
$cijfer69 = GUICtrlCreateLabel("", 420, 270, 100, 25)
$cijfer70 = GUICtrlCreateLabel("", 420, 290, 100, 25)
$cijfer71 = GUICtrlCreateLabel("", 420, 310, 100, 25)
$cijfer72 = GUICtrlCreateLabel("", 420, 330, 100, 25)
$cijfer73 = GUICtrlCreateLabel("", 420, 350, 100, 25)
$cijfer74 = GUICtrlCreateLabel("", 420, 370, 100, 25)

$cijfer75 = GUICtrlCreateLabel("", 470, 90, 100, 25)
$cijfer76 = GUICtrlCreateLabel("", 470, 110, 100, 25)
$cijfer77 = GUICtrlCreateLabel("", 470, 130, 100, 25)
$cijfer78 = GUICtrlCreateLabel("", 470, 150, 100, 25)
$cijfer79 = GUICtrlCreateLabel("", 470, 170, 100, 25)
$cijfer80 = GUICtrlCreateLabel("", 470, 190, 100, 25)
$cijfer81 = GUICtrlCreateLabel("", 470, 210, 100, 25)
$cijfer82 = GUICtrlCreateLabel("", 470, 230, 100, 25)
$cijfer83 = GUICtrlCreateLabel("", 470, 250, 100, 25)
$cijfer84 = GUICtrlCreateLabel("", 470, 270, 100, 25)
$cijfer85 = GUICtrlCreateLabel("", 470, 290, 100, 25)
$cijfer86 = GUICtrlCreateLabel("", 470, 310, 100, 25)
$cijfer87 = GUICtrlCreateLabel("", 470, 330, 100, 25)
$cijfer88 = GUICtrlCreateLabel("", 470, 350, 100, 25)
$cijfer89 = GUICtrlCreateLabel("", 470, 370, 100, 25)

$cijfer90 = GUICtrlCreateLabel("", 520, 90, 100, 25)
$cijfer91 = GUICtrlCreateLabel("", 520, 110, 100, 25)
$cijfer92 = GUICtrlCreateLabel("", 520, 130, 100, 25)
$cijfer93 = GUICtrlCreateLabel("", 520, 150, 100, 25)
$cijfer94 = GUICtrlCreateLabel("", 520, 170, 100, 25)
$cijfer95 = GUICtrlCreateLabel("", 520, 190, 100, 25)
$cijfer96 = GUICtrlCreateLabel("", 520, 210, 100, 25)
$cijfer97 = GUICtrlCreateLabel("", 520, 230, 100, 25)
$cijfer98 = GUICtrlCreateLabel("", 520, 250, 100, 25)
$cijfer99 = GUICtrlCreateLabel("", 520, 270, 100, 25)
$cijfer100 = GUICtrlCreateLabel("", 520, 290, 100, 25)
$cijfer101 = GUICtrlCreateLabel("", 520, 310, 100, 25)
$cijfer102 = GUICtrlCreateLabel("", 520, 330, 100, 25)
$cijfer103 = GUICtrlCreateLabel("", 520, 350, 100, 25)
$cijfer104 = GUICtrlCreateLabel("", 520, 370, 100, 25)

$cijfer105 = GUICtrlCreateLabel("", 570, 90, 100, 25)
$cijfer106 = GUICtrlCreateLabel("", 570, 110, 100, 25)
$cijfer107 = GUICtrlCreateLabel("", 570, 130, 100, 25)
$cijfer108 = GUICtrlCreateLabel("", 570, 150, 100, 25)
$cijfer109 = GUICtrlCreateLabel("", 570, 170, 100, 25)
$cijfer110 = GUICtrlCreateLabel("", 570, 190, 100, 25)
$cijfer111 = GUICtrlCreateLabel("", 570, 210, 100, 25)
$cijfer112 = GUICtrlCreateLabel("", 570, 230, 100, 25)
$cijfer113 = GUICtrlCreateLabel("", 570, 250, 100, 25)
$cijfer114 = GUICtrlCreateLabel("", 570, 270, 100, 25)
$cijfer115 = GUICtrlCreateLabel("", 570, 290, 100, 25)
$cijfer116 = GUICtrlCreateLabel("", 570, 310, 100, 25)
$cijfer117 = GUICtrlCreateLabel("", 570, 330, 100, 25)
$cijfer118 = GUICtrlCreateLabel("", 570, 350, 100, 25)
$cijfer119 = GUICtrlCreateLabel("", 570, 370, 100, 25)


GUICtrlCreateTabItem("Beoordelingen")
$beoordeling = GUICtrlCreateEdit("", 150, 60, 605, 330, $ES_READONLY + $ES_WANTRETURN)
_GUICtrlEdit_SetMargins($beoordeling, $EC_RIGHTMARGIN, 0, 10)
GUISetState (@SW_SHOW, $Gui)

$Gui_addvak = GUICreate("Cijfer Registratie Systeem | Nieuw vak", 350, 175)
GUICtrlCreateLabel("vak:", 10, 10)
$vak1 = GUICtrlCreateInput("", 55, 7, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 10, 35)
$vak2 = GUICtrlCreateInput("", 55, 32, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 10, 60)
$vak3 = GUICtrlCreateInput("", 55, 57, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 10, 85)
$vak4 = GUICtrlCreateInput("", 55, 82, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 10, 110)
$vak5 = GUICtrlCreateInput("", 55, 107, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 10, 135)
$vak6 = GUICtrlCreateInput("", 55, 132, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 110, 10)
$vak7 = GUICtrlCreateInput("", 155, 7, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 110, 35)
$vak8 = GUICtrlCreateInput("", 155, 32, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 110, 60)
$vak9 = GUICtrlCreateInput("", 155, 57, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 110, 85)
$vak10 = GUICtrlCreateInput("", 155, 82, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 110, 110)
$vak11 = GUICtrlCreateInput("", 155, 107, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 110, 135)
$vak12 = GUICtrlCreateInput("", 155, 132, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 210, 10)
$vak13 = GUICtrlCreateInput("", 255, 7, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 210, 35)
$vak14 = GUICtrlCreateInput("", 255, 32, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 210, 60)
$vak15 = GUICtrlCreateInput("", 255, 57, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateButton("OK", 250, 135, 80, 35)
GUICtrlSetOnEvent(-1, "addvak")
GUISetState (@SW_HIDE, $Gui_addvak)

$Gui_addgroup = GUICreate("MyGUI", 350, 175)
GUISetOnEvent($GUI_EVENT_CLOSE, "On_Exit") 
GUICtrlCreateLabel("Groepnaam:", 10, 10)
$newgroup = GUICtrlCreateInput("", 80, 7, 100, 20)
GUICtrlCreateGroup("Vakken", 10, 30, 330, 130)
GUICtrlCreateButton("OK", 250, 135, 80, 35)
GUICtrlSetOnEvent(-1, "GroupAddOK")
GUISetState(@SW_HIDE, $Gui_addgroup)

While 1
    Sleep(100)
Wend

Func Event()
    Switch @GUI_CtrlId
        Case $GUI_EVENT_CLOSE
            Exit
        Case Else
            $rnaam = IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Algemeen", "naam", "")
   $rov = IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Algemeen", "OV", "")
   $radres = IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Algemeen", "adres", "")
   $rpostcode = IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Algemeen", "postcode", "")
   $rwoonplaats = IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Algemeen", "woonplaats", "")
   $rtelefoon = IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Algemeen", "telefoon", "")
   $rgroep = IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Algemeen", "groep", "")
   $rvakken = IniRead(@ScriptDir & "\groepen\" & $rgroep & ".ini", "Algemeen", "vakken", "")
   $rbeoordeling = IniReadSection(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "beoordeling")
   $rvakken1 = StringReplace($rvakken, ",", "         ")
   $avakken = StringSplit($rvakken, ",")
   $avakken1 = $avakken[1]
   $avakken2 = $avakken[2]
   $avakken3 = $avakken[3]
   $avakken4 = $avakken[4]
   $avakken5 = $avakken[5]
   $avakken6 = $avakken[6]
   $avakken7 = $avakken[7]
   $avakken8 = $avakken[8]
   
         If Not @error Then 
   GUICtrlSetData($Naam, "Naam:                  " & $rnaam)
   GUICtrlSetData($ovnr, "OV-Nummer:        " & $rov)
   GUICtrlSetData($adres, "Adres:                  " & $radres)
   GUICtrlSetData($postcode, "Postcode:            " & $rpostcode)
   GUICtrlSetData($woonplaats, "Woonplaats:        " & $rwoonplaats)
   GUICtrlSetData($telefoonnr, "Telefoonnummer: " & $rtelefoon)
   GUICtrlSetData($groep, "Groep:                  " & $rgroep)
   GUICtrlSetData($vakken, "                       " & $rvakken1)
   For $i = 1 To $rbeoordeling[0][0]
   _GUICtrlEdit_AppendText($beoordeling, $rbeoordeling[$i][0] & ":" & @CRLF & $rbeoordeling[$i][1] & @CRLF & @CRLF)
   Next
   $avk1 = StringSplit(IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Cijfers", $avakken1, ""), ",")
   GUICtrlSetData($cijfer0, $avk1[1])
   GUICtrlSetData($cijfer1, $avk1[2])
   GUICtrlSetData($cijfer2, $avk1[3])
   GUICtrlSetData($cijfer3, $avk1[4])
   GUICtrlSetData($cijfer4, $avk1[5])
   GUICtrlSetData($cijfer5, $avk1[6])
   GUICtrlSetData($cijfer6, $avk1[7])
   GUICtrlSetData($cijfer7, $avk1[8])
   GUICtrlSetData($cijfer8, $avk1[9])
   GUICtrlSetData($cijfer9, $avk1[10])
   GUICtrlSetData($cijfer10, $avk1[11])
   GUICtrlSetData($cijfer11, $avk1[12])
   GUICtrlSetData($cijfer12, $avk1[13])
   GUICtrlSetData($cijfer13, $avk1[14])
   GUICtrlSetData($cijfer14, $avk1[15])
   
   $avk2 = StringSplit(IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Cijfers", $avakken2, ""), ",")
   GUICtrlSetData($cijfer15, $avk2[1])
   GUICtrlSetData($cijfer16, $avk2[2])
   GUICtrlSetData($cijfer17, $avk2[3])
   GUICtrlSetData($cijfer18, $avk2[4])
   GUICtrlSetData($cijfer19, $avk2[5])
   GUICtrlSetData($cijfer20, $avk2[6])
   GUICtrlSetData($cijfer21, $avk2[7])
   GUICtrlSetData($cijfer22, $avk2[8])
   GUICtrlSetData($cijfer23, $avk2[9])
   GUICtrlSetData($cijfer24, $avk2[10])
   GUICtrlSetData($cijfer25, $avk2[11])
   GUICtrlSetData($cijfer26, $avk2[12])
   GUICtrlSetData($cijfer27, $avk2[13])
   GUICtrlSetData($cijfer28, $avk2[14])
   GUICtrlSetData($cijfer29, $avk2[15])
   
   $avk3 = StringSplit(IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Cijfers", $avakken3, ""), ",")
   GUICtrlSetData($cijfer30, $avk3[1])
   GUICtrlSetData($cijfer31, $avk3[2])
   GUICtrlSetData($cijfer32, $avk3[3])
   GUICtrlSetData($cijfer33, $avk3[4])
   GUICtrlSetData($cijfer34, $avk3[5])
   GUICtrlSetData($cijfer35, $avk3[6])
   GUICtrlSetData($cijfer36, $avk3[7])
   GUICtrlSetData($cijfer37, $avk3[8])
   GUICtrlSetData($cijfer38, $avk3[9])
   GUICtrlSetData($cijfer39, $avk3[10])
   GUICtrlSetData($cijfer40, $avk3[11])
   GUICtrlSetData($cijfer41, $avk3[12])
   GUICtrlSetData($cijfer42, $avk3[13])
   GUICtrlSetData($cijfer43, $avk3[14])
   GUICtrlSetData($cijfer44, $avk3[15])
   
   $avk4 = StringSplit(IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Cijfers", $avakken4, ""), ",")
   GUICtrlSetData($cijfer45, $avk4[1])
   GUICtrlSetData($cijfer46, $avk4[2])
   GUICtrlSetData($cijfer47, $avk4[3])
   GUICtrlSetData($cijfer48, $avk4[4])
   GUICtrlSetData($cijfer49, $avk4[5])
   GUICtrlSetData($cijfer50, $avk4[6])
   GUICtrlSetData($cijfer51, $avk4[7])
   GUICtrlSetData($cijfer52, $avk4[8])
   GUICtrlSetData($cijfer53, $avk4[9])
   GUICtrlSetData($cijfer54, $avk4[10])
   GUICtrlSetData($cijfer55, $avk4[11])
   GUICtrlSetData($cijfer56, $avk4[12])
   GUICtrlSetData($cijfer57, $avk4[13])
   GUICtrlSetData($cijfer58, $avk4[14])
   GUICtrlSetData($cijfer59, $avk4[15])
   
   $avk5 = StringSplit(IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Cijfers", $avakken5, ""), ",")
   GUICtrlSetData($cijfer60, $avk5[1])
   GUICtrlSetData($cijfer61, $avk5[2])
   GUICtrlSetData($cijfer62, $avk5[3])
   GUICtrlSetData($cijfer63, $avk5[4])
   GUICtrlSetData($cijfer64, $avk5[5])
   GUICtrlSetData($cijfer65, $avk5[6])
   GUICtrlSetData($cijfer66, $avk5[7])
   GUICtrlSetData($cijfer67, $avk5[8])
   GUICtrlSetData($cijfer68, $avk5[9])
   GUICtrlSetData($cijfer69, $avk5[10])
   GUICtrlSetData($cijfer70, $avk5[11])
   GUICtrlSetData($cijfer71, $avk5[12])
   GUICtrlSetData($cijfer72, $avk5[13])
   GUICtrlSetData($cijfer73, $avk5[14])
   GUICtrlSetData($cijfer74, $avk5[15])
   
   $avk6 = StringSplit(IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Cijfers", $avakken6, ""), ",")
   GUICtrlSetData($cijfer75, $avk6[1])
   GUICtrlSetData($cijfer76, $avk6[2])
   GUICtrlSetData($cijfer77, $avk6[3])
   GUICtrlSetData($cijfer78, $avk6[4])
   GUICtrlSetData($cijfer79, $avk6[5])
   GUICtrlSetData($cijfer80, $avk6[6])
   GUICtrlSetData($cijfer81, $avk6[7])
   GUICtrlSetData($cijfer82, $avk6[8])
   GUICtrlSetData($cijfer83, $avk6[9])
   GUICtrlSetData($cijfer84, $avk6[10])
   GUICtrlSetData($cijfer85, $avk6[11])
   GUICtrlSetData($cijfer86, $avk6[12])
   GUICtrlSetData($cijfer87, $avk6[13])
   GUICtrlSetData($cijfer88, $avk6[14])
   GUICtrlSetData($cijfer89, $avk6[15])
   
   $avk7 = StringSplit(IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Cijfers", $avakken7, ""), ",")
   GUICtrlSetData($cijfer90, $avk7[1])
   GUICtrlSetData($cijfer91, $avk7[2])
   GUICtrlSetData($cijfer92, $avk7[3])
   GUICtrlSetData($cijfer93, $avk7[4])
   GUICtrlSetData($cijfer94, $avk7[5])
   GUICtrlSetData($cijfer95, $avk7[6])
   GUICtrlSetData($cijfer96, $avk7[7])
   GUICtrlSetData($cijfer97, $avk7[8])
   GUICtrlSetData($cijfer98, $avk7[9])
   GUICtrlSetData($cijfer99, $avk7[10])
   GUICtrlSetData($cijfer100, $avk7[11])
   GUICtrlSetData($cijfer101, $avk7[12])
   GUICtrlSetData($cijfer102, $avk7[13])
   GUICtrlSetData($cijfer103, $avk7[14])
   GUICtrlSetData($cijfer104, $avk7[15])
      
   $avk8 = StringSplit(IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Cijfers", $avakken8, ""), ",")
   GUICtrlSetData($cijfer105, $avk8[1])
   GUICtrlSetData($cijfer106, $avk8[2])
   GUICtrlSetData($cijfer107, $avk8[3])
   GUICtrlSetData($cijfer108, $avk8[4])
   GUICtrlSetData($cijfer109, $avk8[5])
   GUICtrlSetData($cijfer110, $avk8[6])
   GUICtrlSetData($cijfer111, $avk8[7])
   GUICtrlSetData($cijfer112, $avk8[8])
   GUICtrlSetData($cijfer113, $avk8[9])
   GUICtrlSetData($cijfer114, $avk8[10])
   GUICtrlSetData($cijfer115, $avk8[11])
   GUICtrlSetData($cijfer116, $avk8[12])
   GUICtrlSetData($cijfer117, $avk8[13])
   GUICtrlSetData($cijfer118, $avk8[14])
   GUICtrlSetData($cijfer119, $avk8[15])
      
   
   
   
            EndIf
    EndSwitch
EndFunc

Func TVLoadIni($tviID, $iPath)
    Local $FFFF, $FFNF, $STR
    $FFFF = FileFindFirstFile($iPath)
    If $FFFF = -1 Then Return -1
    While 1
        $FFNF = FileFindNextFile($FFFF)
        If @error Then ExitLoop
        $STR = StringTrimRight($FFNF, 4)
        GUICtrlCreateTreeViewItem($STR, $tviID)
        GUICtrlSetOnEvent(-1, "Event")
        GUICtrlSetColor(-1, 0x0000C0)
    WEnd
    FileClose($FFFF)
    Return 0
EndFunc

Func _TVGetItemTree($i_treeview, $s_sep_char, $h_tv_item = 0)
    Local $szPath = "", $hParent, $h_item
    If $h_tv_item <> 0 Then
        $h_item = $h_tv_item
    Else
        $h_item = GUICtrlSendMsg($i_treeview, $TVM_GETNEXTITEM, $TVGN_CARET, 0)
    EndIf
    If $h_item > 0 Then
        $szPath = _TVGetItemText($i_treeview, $h_item)
        Do
            $hParent = GUICtrlSendMsg($i_treeview, $TVM_GETNEXTITEM, $TVGN_PARENT, $h_item)
            If $hParent > 0 Then $szPath = _TVGetItemText($i_treeview, $hParent) & $s_sep_char & $szPath
            $h_item = $hParent
        Until $h_item <= 0
    EndIf

    Return $szPath
EndFunc   ;==>_TVGetItemTree

Func _TVGetItemText($i_treeview, $h_item = 0) ; copy, name changed
    Local $s_txt = ""
    If $h_item = 0 Then Return ""
    Local $st_txt = DllStructCreate("char[4096]")
    Local $st_TVI = DllStructCreate("uint;uint;uint;uint;ptr;int;int;int;int;uint;int")
    DllStructSetData($st_TVI, 1, $TVIF_TEXT)
    DllStructSetData($st_TVI, 2, $h_item)
    DllStructSetData($st_TVI, 5, DllStructGetPtr($st_txt))
    DllStructSetData($st_TVI, 6, DllStructGetSize($st_txt))
    If GUICtrlSendMsg($i_treeview, $TVM_GETITEM, 0, DllStructGetPtr($st_TVI)) Then $s_txt = DllStructGetData($st_txt, 1)
    Return $s_txt
EndFunc   ;==>_TVGetText

Func On_Exit()
    GUISetState(@SW_HIDE, @GUI_CtrlId)
    Exit
EndFunc

Func menu()
    
    Switch @GUI_CTRLID
  Case $menu_bestand_exit
   Exit
  Case $menu_gebruikers_toevoegen
     
  Case $menu_gebruikers_wijzigen 
  Case $menu_gebruikers_verwijderen
  Case $menu_groepen_toevoegen
   group_vakadd()
  Case $menu_groepen_wijzigen 
  Case $menu_groepen_verwijderen 
        Case $menu_vakken_toevoegen
   GUISetState(@SW_SHOW, $Gui_addvak)
  Case $menu_vakken_wijzigen
  Case $menu_vakken_verwijderen 
    EndSwitch
EndFunc


Func addvak()
$new_vak1 = "vk" & GUICtrlRead($vak1) & ","
$new_vak2 = "vk" & GUICtrlRead($vak2) & ","
$new_vak3 = "vk" & GUICtrlRead($vak3) & ","
$new_vak4 = "vk" & GUICtrlRead($vak4) & ","
$new_vak5 = "vk" & GUICtrlRead($vak5) & ","
$new_vak6 = "vk" & GUICtrlRead($vak6) & ","
$new_vak7 = "vk" & GUICtrlRead($vak7) & ","
$new_vak8 = "vk" & GUICtrlRead($vak8) & ","
$new_vak9 = "vk" & GUICtrlRead($vak9) & ","
$new_vak10 = "vk" & GUICtrlRead($vak10) & ","
$new_vak11 = "vk" & GUICtrlRead($vak11) & ","
$new_vak12 = "vk" & GUICtrlRead($vak12) & ","
$new_vak13 = "vk" & GUICtrlRead($vak13) & ","
$new_vak14 = "vk" & GUICtrlRead($vak14) & ","
$new_vak15 = "vk" & GUICtrlRead($vak15) & ","

$newvak = $new_vak1 & $new_vak2 & $new_vak3 & $new_vak4 & $new_vak5 & $new_vak6 & $new_vak7 & $new_vak8 & $new_vak9 & $new_vak10 & $new_vak11 & $new_vak12 & $new_vak13 & $new_vak14 & $new_vak15

IniWrite("vakken.ini", "algemeen", "vakken", $newvak)

MsgBox(64, "Cijfer Registratie Systeem | Melding", "Vak(ken) toegevoegd")
EndFunc 

Func group_vakadd()
$vakken = IniRead("vakken.ini", "Algemeen", "Vakken", "")

If @error Then
    MsgBox(4096, "", "Error occurred, probably no INI file.")
Else
    
    For $i = 1 To 5
        $CheckBox[$i] = GUICtrlCreateCheckbox("vk" & $i, 45, $top, 50, 20) 
        $count += 1
        $top += 20
    Next
    $top = 50
    For $i = 6 To 10
        $CheckBox[$i] = GUICtrlCreateCheckbox("vk" & $i, 110, $top, 50, 20) 
        $count += 1
        $top += 20
    Next
    $top = 50
    For $i = 11 To 15
        $CheckBox[$i] = GUICtrlCreateCheckbox("vk" & $i, 175, $top, 50, 20) 
        $count += 1
        $top += 20
    Next

    $vakken = StringReplace($vakken, "vk", "")
    $vakken_array = StringSplit($vakken, ",")
    
    For $i = 1 To 15
        If $vakken_array[$i] <> "" Then
            GUICtrlSetData($CheckBox[$i], $vakken_array[$i])
        EndIf
    Next

EndIf
GUICtrlSetState($Gui_addgroup, @SW_SHOW)
EndFunc

Func GroupAddOK()
    If GUICtrlRead($newgroup) = Not "" Then
        $newgr2 = ""
        For $f = $CheckBox[1] To $CheckBox[15]
            $newgr1 = BitAND(GUICtrlRead($f), $GUI_CHECKED)
            If $newgr1 = $GUI_CHECKED Then
                $newgr2 &= GUICtrlRead($f, 1) & ","
            EndIf
        Next        
        $ini_File = @ScriptDir & "\groepen\" & GUICtrlRead($newgroup) & ".ini"
        IniWrite($ini_file, "algemeen", "vakken", $newgr2)
    Else
        MsgBox(64, "Cijfer Registratie Systeem | Melding", "Vul AUB een geldige naam in voor de groep")
    EndIf
EndFunc  ;==>GroupAddOK

But when I run the script now, It doesnt read the ini to create the checkboxes, it shows the GUI immediately. Can you tell me why?

Thanks!

Edited by PcExpert
Link to comment
Share on other sites

  • Moderators

PcExpert,

I think I have found the problem - you were using GUICtrlSetState instead of GUISetState to try and show your window! I have changed it in your combined script and now the window appears.

I also changed a number of areas where I suggested that you needed to change yesterday - did you understand why the changes were necessary? My sole aim is to get you to understand - not to show how clever I am (if indeed I am clever!!!) So please ask again if you do not understand something - I will not get angry until at least the third time!! ;-)

I also changed another small detail. For some reason your code was not picking up on the absence of "vakken.ini" so I have amended the code to give a default value if no .ini is found. This works much better - when I was testing yesterday I always had an .ini file so I did not notice.

So, here is the modified version of your combined file:

#include <GUIConstants.au3>
#include <EditConstants.au3>
#Include <GuiTreeView.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#Include <GuiEdit.au3>

Local $avArray[120]
Global $CheckBox[16]
Global $newvak
Global $vakcount = 1
Global $top = 50
Global $left = 15
Global $count = 0
Global $vtotal = 1

Opt("GUIOnEventMode", 1)

Global $IniPath1 = @ScriptDir & "\Groepen\*.ini", $IniPath2 = @ScriptDir & "\Gebruikers\*.ini"

$Gui = GUICreate("Cijfer Registratie Systeem | Hoofdscherm", 780, 430)
GUISetOnEvent($GUI_EVENT_CLOSE, "Event", $Gui)
$menu_bestand = GUICtrlCreateMenu("&Bestand")
$menu_bestand_exit = GUICtrlCreateMenuItem("Afsluiten", $menu_bestand)
GUICtrlSetOnEvent(-1, "menu")
$menu_Groepen = GUICtrlCreateMenu("&Groepen")
$menu_groepen_toevoegen = GUICtrlCreateMenuItem("Toevoegen", $menu_groepen)
GUICtrlSetOnEvent(-1, "menu")
$menu_groepen_wijzigen = GUICtrlCreateMenuItem("Wijzigen", $menu_groepen)
GUICtrlSetOnEvent(-1, "menu")
$menu_groepen_verwijderen = GUICtrlCreateMenuItem("Verwijderen", $menu_groepen)
GUICtrlSetOnEvent(-1, "menu")
$menu_gebruikers = GUICtrlCreateMenu("&Gebruikers")
$menu_gebruikers_toevoegen = GUICtrlCreateMenuItem("Toevoegen", $menu_gebruikers)
GUICtrlSetOnEvent(-1, "menu")
$menu_gebruikers_wijzigen = GUICtrlCreateMenuItem("Wijzigen", $menu_gebruikers)
GUICtrlSetOnEvent(-1, "menu")
$menu_gebruikers_verwijderen = GUICtrlCreateMenuItem("Verwijderen", $menu_gebruikers)
GUICtrlSetOnEvent(-1, "menu")
$menu_vakken = GUICtrlCreateMenu("&Vakken")
$menu_vakken_toevoegen = GUICtrlCreateMenuItem("Toevoegen", $menu_vakken)
GUICtrlSetOnEvent(-1, "menu")
$menu_vakken_wijzigen = GUICtrlCreateMenuItem("Wijzigen", $menu_vakken)
GUICtrlSetOnEvent(-1, "menu")
$menu_vakken_verwijderen = GUICtrlCreateMenuItem("Verwijderen", $menu_vakken)
GUICtrlSetOnEvent(-1, "menu")
$menu_help = GUICtrlCreateMenu("&Help")
$menu_help_Help = GUICtrlCreateMenuItem("Help onderwerpen", $menu_help)
GUICtrlSetOnEvent(-1, "menu")
$menu_help_over = GUICtrlCreateMenuItem("Info", $menu_help)
GUICtrlSetOnEvent(-1, "menu")
$TV = GUICtrlCreateTreeView(5, 35, 120, 350)
$TVI1 = GUICtrlCreateTreeViewItem("Groepen", $TV)
GUICtrlSetColor(-1, 0x0000C0)
GUICtrlSetState(-1, $GUI_DEFBUTTON)
TVLoadIni($TVI1, $IniPath1)
$TVI2 = GUICtrlCreateTreeViewItem("Gebruikers", $TV)
GUICtrlSetColor(-1, 0x0000C0)
GUICtrlSetState(-1, $GUI_DEFBUTTON)
TVLoadIni($TVI2, $IniPath2)
$tab = GUICtrlCreateTab(140, 25, 630, 380)
GUICtrlCreateTabItem("Algemeen")
$Naam = GUICtrlCreateLabel("Naam:                 ", 150, 60, 300, 25)
$ovnr = GUICtrlCreateLabel("OV-Nummer:      ", 150, 80, 300, 25)
$adres = GUICtrlCreateLabel("Adres:               ", 150, 100, 300, 25)
$postcode = GUICtrlCreateLabel("Postcode:           ", 150, 120, 300, 25)
$woonplaats = GUICtrlCreateLabel("Woonplaats:       ", 150, 140, 300, 25)
$telefoonnr = GUICtrlCreateLabel("Telefoonnummer: ", 150, 160, 300, 25)
$groep = GUICtrlCreateLabel("Groep:               ", 150, 180, 300, 25)
GUICtrlSetBkColor(-1, 0xffffff)
GUICtrlCreateTabItem("Cijfers")
$vakken = GUICtrlCreateLabel("", 150, 60, 450, 25)
$toets1 = GUICtrlCreateLabel("Toets 1", 150, 90, 100, 25)
$toets2 = GUICtrlCreateLabel("Toets 2", 150, 110, 100, 25)
$toets3 = GUICtrlCreateLabel("Toets 3", 150, 130, 100, 25)
$toets4 = GUICtrlCreateLabel("Toets 4", 150, 150, 100, 25)
$rap1 = GUICtrlCreateLabel("Rapport 1", 150, 170, 100, 25)
$toets5 = GUICtrlCreateLabel("Toets 5", 150, 190, 100, 25)
$toets6 = GUICtrlCreateLabel("Toets 6", 150, 210, 100, 25)
$toets7 = GUICtrlCreateLabel("Toets 7", 150, 230, 100, 25)
$toets8 = GUICtrlCreateLabel("Toets 8", 150, 250, 100, 25)
$rap2 = GUICtrlCreateLabel("Rapport 2", 150, 270, 100, 25)
$toets9 = GUICtrlCreateLabel("Toets 9", 150, 290, 100, 25)
$toets10 = GUICtrlCreateLabel("Toets 10", 150, 310, 100, 25)
$toets11 = GUICtrlCreateLabel("Toets 11", 150, 330, 100, 25)
$toets12 = GUICtrlCreateLabel("Toets 12", 150, 350, 100, 25)
$rap3 = GUICtrlCreateLabel("Rapport 3", 150, 370, 100, 25)


$cijfer0 = GUICtrlCreateLabel("", 220, 90, 100, 25)
$cijfer1 = GUICtrlCreateLabel("", 220, 110, 100, 25)
$cijfer2 = GUICtrlCreateLabel("", 220, 130, 100, 25)
$cijfer3 = GUICtrlCreateLabel("", 220, 150, 100, 25)
$cijfer4 = GUICtrlCreateLabel("", 220, 170, 100, 25)
$cijfer5 = GUICtrlCreateLabel("", 220, 190, 100, 25)
$cijfer6 = GUICtrlCreateLabel("", 220, 210, 100, 25)
$cijfer7 = GUICtrlCreateLabel("", 220, 230, 100, 25)
$cijfer8 = GUICtrlCreateLabel("", 220, 250, 100, 25)
$cijfer9 = GUICtrlCreateLabel("", 220, 270, 100, 25)
$cijfer10 = GUICtrlCreateLabel("", 220, 290, 100, 25)
$cijfer11 = GUICtrlCreateLabel("", 220, 310, 100, 25)
$cijfer12 = GUICtrlCreateLabel("", 220, 330, 100, 25)
$cijfer13 = GUICtrlCreateLabel("", 220, 350, 100, 25)
$cijfer14 = GUICtrlCreateLabel("", 220, 370, 100, 25)

$cijfer15 = GUICtrlCreateLabel("", 270, 90, 100, 25)
$cijfer16 = GUICtrlCreateLabel("", 270, 110, 100, 25)
$cijfer17 = GUICtrlCreateLabel("", 270, 130, 100, 25)
$cijfer18 = GUICtrlCreateLabel("", 270, 150, 100, 25)
$cijfer19 = GUICtrlCreateLabel("", 270, 170, 100, 25)
$cijfer20 = GUICtrlCreateLabel("", 270, 190, 100, 25)
$cijfer21 = GUICtrlCreateLabel("", 270, 210, 100, 25)
$cijfer22 = GUICtrlCreateLabel("", 270, 230, 100, 25)
$cijfer23 = GUICtrlCreateLabel("", 270, 250, 100, 25)
$cijfer24 = GUICtrlCreateLabel("", 270, 270, 100, 25)
$cijfer25 = GUICtrlCreateLabel("", 270, 290, 100, 25)
$cijfer26 = GUICtrlCreateLabel("", 270, 310, 100, 25)
$cijfer27 = GUICtrlCreateLabel("", 270, 330, 100, 25)
$cijfer28 = GUICtrlCreateLabel("", 270, 350, 100, 25)
$cijfer29 = GUICtrlCreateLabel("", 270, 370, 100, 25)

$cijfer30 = GUICtrlCreateLabel("", 320, 90, 100, 25)
$cijfer31 = GUICtrlCreateLabel("", 320, 110, 100, 25)
$cijfer32 = GUICtrlCreateLabel("", 320, 130, 100, 25)
$cijfer33 = GUICtrlCreateLabel("", 320, 150, 100, 25)
$cijfer34 = GUICtrlCreateLabel("", 320, 170, 100, 25)
$cijfer35 = GUICtrlCreateLabel("", 320, 190, 100, 25)
$cijfer36 = GUICtrlCreateLabel("", 320, 210, 100, 25)
$cijfer37 = GUICtrlCreateLabel("", 320, 230, 100, 25)
$cijfer38 = GUICtrlCreateLabel("", 320, 250, 100, 25)
$cijfer39 = GUICtrlCreateLabel("", 320, 270, 100, 25)
$cijfer40 = GUICtrlCreateLabel("", 320, 290, 100, 25)
$cijfer41 = GUICtrlCreateLabel("", 320, 310, 100, 25)
$cijfer42 = GUICtrlCreateLabel("", 320, 330, 100, 25)
$cijfer43 = GUICtrlCreateLabel("", 320, 350, 100, 25)
$cijfer44 = GUICtrlCreateLabel("", 320, 370, 100, 25)

$cijfer45 = GUICtrlCreateLabel("", 370, 90, 100, 25)
$cijfer46 = GUICtrlCreateLabel("", 370, 110, 100, 25)
$cijfer47 = GUICtrlCreateLabel("", 370, 130, 100, 25)
$cijfer48 = GUICtrlCreateLabel("", 370, 150, 100, 25)
$cijfer49 = GUICtrlCreateLabel("", 370, 170, 100, 25)
$cijfer50 = GUICtrlCreateLabel("", 370, 190, 100, 25)
$cijfer51 = GUICtrlCreateLabel("", 370, 210, 100, 25)
$cijfer52 = GUICtrlCreateLabel("", 370, 230, 100, 25)
$cijfer53 = GUICtrlCreateLabel("", 370, 250, 100, 25)
$cijfer54 = GUICtrlCreateLabel("", 370, 270, 100, 25)
$cijfer55 = GUICtrlCreateLabel("", 370, 290, 100, 25)
$cijfer56 = GUICtrlCreateLabel("", 370, 310, 100, 25)
$cijfer57 = GUICtrlCreateLabel("", 370, 330, 100, 25)
$cijfer58 = GUICtrlCreateLabel("", 370, 350, 100, 25)
$cijfer59 = GUICtrlCreateLabel("", 370, 370, 100, 25)

$cijfer60 = GUICtrlCreateLabel("", 420, 90, 100, 25)
$cijfer61 = GUICtrlCreateLabel("", 420, 110, 100, 25)
$cijfer62 = GUICtrlCreateLabel("", 420, 130, 100, 25)
$cijfer63 = GUICtrlCreateLabel("", 420, 150, 100, 25)
$cijfer64 = GUICtrlCreateLabel("", 420, 170, 100, 25)
$cijfer65 = GUICtrlCreateLabel("", 420, 190, 100, 25)
$cijfer66 = GUICtrlCreateLabel("", 420, 210, 100, 25)
$cijfer67 = GUICtrlCreateLabel("", 420, 230, 100, 25)
$cijfer68 = GUICtrlCreateLabel("", 420, 250, 100, 25)
$cijfer69 = GUICtrlCreateLabel("", 420, 270, 100, 25)
$cijfer70 = GUICtrlCreateLabel("", 420, 290, 100, 25)
$cijfer71 = GUICtrlCreateLabel("", 420, 310, 100, 25)
$cijfer72 = GUICtrlCreateLabel("", 420, 330, 100, 25)
$cijfer73 = GUICtrlCreateLabel("", 420, 350, 100, 25)
$cijfer74 = GUICtrlCreateLabel("", 420, 370, 100, 25)

$cijfer75 = GUICtrlCreateLabel("", 470, 90, 100, 25)
$cijfer76 = GUICtrlCreateLabel("", 470, 110, 100, 25)
$cijfer77 = GUICtrlCreateLabel("", 470, 130, 100, 25)
$cijfer78 = GUICtrlCreateLabel("", 470, 150, 100, 25)
$cijfer79 = GUICtrlCreateLabel("", 470, 170, 100, 25)
$cijfer80 = GUICtrlCreateLabel("", 470, 190, 100, 25)
$cijfer81 = GUICtrlCreateLabel("", 470, 210, 100, 25)
$cijfer82 = GUICtrlCreateLabel("", 470, 230, 100, 25)
$cijfer83 = GUICtrlCreateLabel("", 470, 250, 100, 25)
$cijfer84 = GUICtrlCreateLabel("", 470, 270, 100, 25)
$cijfer85 = GUICtrlCreateLabel("", 470, 290, 100, 25)
$cijfer86 = GUICtrlCreateLabel("", 470, 310, 100, 25)
$cijfer87 = GUICtrlCreateLabel("", 470, 330, 100, 25)
$cijfer88 = GUICtrlCreateLabel("", 470, 350, 100, 25)
$cijfer89 = GUICtrlCreateLabel("", 470, 370, 100, 25)

$cijfer90 = GUICtrlCreateLabel("", 520, 90, 100, 25)
$cijfer91 = GUICtrlCreateLabel("", 520, 110, 100, 25)
$cijfer92 = GUICtrlCreateLabel("", 520, 130, 100, 25)
$cijfer93 = GUICtrlCreateLabel("", 520, 150, 100, 25)
$cijfer94 = GUICtrlCreateLabel("", 520, 170, 100, 25)
$cijfer95 = GUICtrlCreateLabel("", 520, 190, 100, 25)
$cijfer96 = GUICtrlCreateLabel("", 520, 210, 100, 25)
$cijfer97 = GUICtrlCreateLabel("", 520, 230, 100, 25)
$cijfer98 = GUICtrlCreateLabel("", 520, 250, 100, 25)
$cijfer99 = GUICtrlCreateLabel("", 520, 270, 100, 25)
$cijfer100 = GUICtrlCreateLabel("", 520, 290, 100, 25)
$cijfer101 = GUICtrlCreateLabel("", 520, 310, 100, 25)
$cijfer102 = GUICtrlCreateLabel("", 520, 330, 100, 25)
$cijfer103 = GUICtrlCreateLabel("", 520, 350, 100, 25)
$cijfer104 = GUICtrlCreateLabel("", 520, 370, 100, 25)

$cijfer105 = GUICtrlCreateLabel("", 570, 90, 100, 25)
$cijfer106 = GUICtrlCreateLabel("", 570, 110, 100, 25)
$cijfer107 = GUICtrlCreateLabel("", 570, 130, 100, 25)
$cijfer108 = GUICtrlCreateLabel("", 570, 150, 100, 25)
$cijfer109 = GUICtrlCreateLabel("", 570, 170, 100, 25)
$cijfer110 = GUICtrlCreateLabel("", 570, 190, 100, 25)
$cijfer111 = GUICtrlCreateLabel("", 570, 210, 100, 25)
$cijfer112 = GUICtrlCreateLabel("", 570, 230, 100, 25)
$cijfer113 = GUICtrlCreateLabel("", 570, 250, 100, 25)
$cijfer114 = GUICtrlCreateLabel("", 570, 270, 100, 25)
$cijfer115 = GUICtrlCreateLabel("", 570, 290, 100, 25)
$cijfer116 = GUICtrlCreateLabel("", 570, 310, 100, 25)
$cijfer117 = GUICtrlCreateLabel("", 570, 330, 100, 25)
$cijfer118 = GUICtrlCreateLabel("", 570, 350, 100, 25)
$cijfer119 = GUICtrlCreateLabel("", 570, 370, 100, 25)


GUICtrlCreateTabItem("Beoordelingen")
$beoordeling = GUICtrlCreateEdit("", 150, 60, 605, 330, $ES_READONLY + $ES_WANTRETURN)
_GUICtrlEdit_SetMargins($beoordeling, $EC_RIGHTMARGIN, 0, 10)
GUISetState (@SW_SHOW, $Gui)

$Gui_addvak = GUICreate("Cijfer Registratie Systeem | Nieuw vak", 350, 175)
GUICtrlCreateLabel("vak:", 10, 10)
$vak1 = GUICtrlCreateInput("", 55, 7, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 10, 35)
$vak2 = GUICtrlCreateInput("", 55, 32, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 10, 60)
$vak3 = GUICtrlCreateInput("", 55, 57, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 10, 85)
$vak4 = GUICtrlCreateInput("", 55, 82, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 10, 110)
$vak5 = GUICtrlCreateInput("", 55, 107, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 10, 135)
$vak6 = GUICtrlCreateInput("", 55, 132, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 110, 10)
$vak7 = GUICtrlCreateInput("", 155, 7, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 110, 35)
$vak8 = GUICtrlCreateInput("", 155, 32, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 110, 60)
$vak9 = GUICtrlCreateInput("", 155, 57, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 110, 85)
$vak10 = GUICtrlCreateInput("", 155, 82, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 110, 110)
$vak11 = GUICtrlCreateInput("", 155, 107, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 110, 135)
$vak12 = GUICtrlCreateInput("", 155, 132, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 210, 10)
$vak13 = GUICtrlCreateInput("", 255, 7, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 210, 35)
$vak14 = GUICtrlCreateInput("", 255, 32, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateLabel("vak:", 210, 60)
$vak15 = GUICtrlCreateInput("", 255, 57, 40, 20)
GUICtrlSetLimit(-1, "3", "3")
GUICtrlCreateButton("OK", 250, 135, 80, 35)
GUICtrlSetOnEvent(-1, "addvak")
GUISetState (@SW_HIDE, $Gui_addvak)

$Gui_addgroup = GUICreate("MyGUI", 350, 175)
GUISetOnEvent($GUI_EVENT_CLOSE, "On_Exit") 
GUICtrlCreateLabel("Groepnaam:", 10, 10)
$newgroup = GUICtrlCreateInput("", 80, 7, 100, 20)
GUICtrlCreateGroup("Vakken", 10, 30, 330, 130)
GUICtrlCreateButton("OK", 250, 135, 80, 35)
GUICtrlSetOnEvent(-1, "GroupAddOK")
GUISetState(@SW_HIDE, $Gui_addgroup)

While 1
    Sleep(100)
Wend

Func Event()
    Switch @GUI_CtrlId
        Case $GUI_EVENT_CLOSE
            Exit
        Case Else
            $rnaam = IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Algemeen", "naam", "")
   $rov = IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Algemeen", "OV", "")
   $radres = IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Algemeen", "adres", "")
   $rpostcode = IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Algemeen", "postcode", "")
   $rwoonplaats = IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Algemeen", "woonplaats", "")
   $rtelefoon = IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Algemeen", "telefoon", "")
   $rgroep = IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Algemeen", "groep", "")
   $rvakken = IniRead(@ScriptDir & "\groepen\" & $rgroep & ".ini", "Algemeen", "vakken", "")
   $rbeoordeling = IniReadSection(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "beoordeling")
   $rvakken1 = StringReplace($rvakken, ",", "        ")
   $avakken = StringSplit($rvakken, ",")
   $avakken1 = $avakken[1]
   $avakken2 = $avakken[2]
   $avakken3 = $avakken[3]
   $avakken4 = $avakken[4]
   $avakken5 = $avakken[5]
   $avakken6 = $avakken[6]
   $avakken7 = $avakken[7]
   $avakken8 = $avakken[8]
   
         If Not @error Then 
   GUICtrlSetData($Naam, "Naam:               " & $rnaam)
   GUICtrlSetData($ovnr, "OV-Nummer:        " & $rov)
   GUICtrlSetData($adres, "Adres:                 " & $radres)
   GUICtrlSetData($postcode, "Postcode:         " & $rpostcode)
   GUICtrlSetData($woonplaats, "Woonplaats:     " & $rwoonplaats)
   GUICtrlSetData($telefoonnr, "Telefoonnummer: " & $rtelefoon)
   GUICtrlSetData($groep, "Groep:                 " & $rgroep)
   GUICtrlSetData($vakken, "                       " & $rvakken1)
   For $i = 1 To $rbeoordeling[0][0]
   _GUICtrlEdit_AppendText($beoordeling, $rbeoordeling[$i][0] & ":" & @CRLF & $rbeoordeling[$i][1] & @CRLF & @CRLF)
   Next
   $avk1 = StringSplit(IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Cijfers", $avakken1, ""), ",")
   GUICtrlSetData($cijfer0, $avk1[1])
   GUICtrlSetData($cijfer1, $avk1[2])
   GUICtrlSetData($cijfer2, $avk1[3])
   GUICtrlSetData($cijfer3, $avk1[4])
   GUICtrlSetData($cijfer4, $avk1[5])
   GUICtrlSetData($cijfer5, $avk1[6])
   GUICtrlSetData($cijfer6, $avk1[7])
   GUICtrlSetData($cijfer7, $avk1[8])
   GUICtrlSetData($cijfer8, $avk1[9])
   GUICtrlSetData($cijfer9, $avk1[10])
   GUICtrlSetData($cijfer10, $avk1[11])
   GUICtrlSetData($cijfer11, $avk1[12])
   GUICtrlSetData($cijfer12, $avk1[13])
   GUICtrlSetData($cijfer13, $avk1[14])
   GUICtrlSetData($cijfer14, $avk1[15])
   
   $avk2 = StringSplit(IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Cijfers", $avakken2, ""), ",")
   GUICtrlSetData($cijfer15, $avk2[1])
   GUICtrlSetData($cijfer16, $avk2[2])
   GUICtrlSetData($cijfer17, $avk2[3])
   GUICtrlSetData($cijfer18, $avk2[4])
   GUICtrlSetData($cijfer19, $avk2[5])
   GUICtrlSetData($cijfer20, $avk2[6])
   GUICtrlSetData($cijfer21, $avk2[7])
   GUICtrlSetData($cijfer22, $avk2[8])
   GUICtrlSetData($cijfer23, $avk2[9])
   GUICtrlSetData($cijfer24, $avk2[10])
   GUICtrlSetData($cijfer25, $avk2[11])
   GUICtrlSetData($cijfer26, $avk2[12])
   GUICtrlSetData($cijfer27, $avk2[13])
   GUICtrlSetData($cijfer28, $avk2[14])
   GUICtrlSetData($cijfer29, $avk2[15])
   
   $avk3 = StringSplit(IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Cijfers", $avakken3, ""), ",")
   GUICtrlSetData($cijfer30, $avk3[1])
   GUICtrlSetData($cijfer31, $avk3[2])
   GUICtrlSetData($cijfer32, $avk3[3])
   GUICtrlSetData($cijfer33, $avk3[4])
   GUICtrlSetData($cijfer34, $avk3[5])
   GUICtrlSetData($cijfer35, $avk3[6])
   GUICtrlSetData($cijfer36, $avk3[7])
   GUICtrlSetData($cijfer37, $avk3[8])
   GUICtrlSetData($cijfer38, $avk3[9])
   GUICtrlSetData($cijfer39, $avk3[10])
   GUICtrlSetData($cijfer40, $avk3[11])
   GUICtrlSetData($cijfer41, $avk3[12])
   GUICtrlSetData($cijfer42, $avk3[13])
   GUICtrlSetData($cijfer43, $avk3[14])
   GUICtrlSetData($cijfer44, $avk3[15])
   
   $avk4 = StringSplit(IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Cijfers", $avakken4, ""), ",")
   GUICtrlSetData($cijfer45, $avk4[1])
   GUICtrlSetData($cijfer46, $avk4[2])
   GUICtrlSetData($cijfer47, $avk4[3])
   GUICtrlSetData($cijfer48, $avk4[4])
   GUICtrlSetData($cijfer49, $avk4[5])
   GUICtrlSetData($cijfer50, $avk4[6])
   GUICtrlSetData($cijfer51, $avk4[7])
   GUICtrlSetData($cijfer52, $avk4[8])
   GUICtrlSetData($cijfer53, $avk4[9])
   GUICtrlSetData($cijfer54, $avk4[10])
   GUICtrlSetData($cijfer55, $avk4[11])
   GUICtrlSetData($cijfer56, $avk4[12])
   GUICtrlSetData($cijfer57, $avk4[13])
   GUICtrlSetData($cijfer58, $avk4[14])
   GUICtrlSetData($cijfer59, $avk4[15])
   
   $avk5 = StringSplit(IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Cijfers", $avakken5, ""), ",")
   GUICtrlSetData($cijfer60, $avk5[1])
   GUICtrlSetData($cijfer61, $avk5[2])
   GUICtrlSetData($cijfer62, $avk5[3])
   GUICtrlSetData($cijfer63, $avk5[4])
   GUICtrlSetData($cijfer64, $avk5[5])
   GUICtrlSetData($cijfer65, $avk5[6])
   GUICtrlSetData($cijfer66, $avk5[7])
   GUICtrlSetData($cijfer67, $avk5[8])
   GUICtrlSetData($cijfer68, $avk5[9])
   GUICtrlSetData($cijfer69, $avk5[10])
   GUICtrlSetData($cijfer70, $avk5[11])
   GUICtrlSetData($cijfer71, $avk5[12])
   GUICtrlSetData($cijfer72, $avk5[13])
   GUICtrlSetData($cijfer73, $avk5[14])
   GUICtrlSetData($cijfer74, $avk5[15])
   
   $avk6 = StringSplit(IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Cijfers", $avakken6, ""), ",")
   GUICtrlSetData($cijfer75, $avk6[1])
   GUICtrlSetData($cijfer76, $avk6[2])
   GUICtrlSetData($cijfer77, $avk6[3])
   GUICtrlSetData($cijfer78, $avk6[4])
   GUICtrlSetData($cijfer79, $avk6[5])
   GUICtrlSetData($cijfer80, $avk6[6])
   GUICtrlSetData($cijfer81, $avk6[7])
   GUICtrlSetData($cijfer82, $avk6[8])
   GUICtrlSetData($cijfer83, $avk6[9])
   GUICtrlSetData($cijfer84, $avk6[10])
   GUICtrlSetData($cijfer85, $avk6[11])
   GUICtrlSetData($cijfer86, $avk6[12])
   GUICtrlSetData($cijfer87, $avk6[13])
   GUICtrlSetData($cijfer88, $avk6[14])
   GUICtrlSetData($cijfer89, $avk6[15])
   
   $avk7 = StringSplit(IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Cijfers", $avakken7, ""), ",")
   GUICtrlSetData($cijfer90, $avk7[1])
   GUICtrlSetData($cijfer91, $avk7[2])
   GUICtrlSetData($cijfer92, $avk7[3])
   GUICtrlSetData($cijfer93, $avk7[4])
   GUICtrlSetData($cijfer94, $avk7[5])
   GUICtrlSetData($cijfer95, $avk7[6])
   GUICtrlSetData($cijfer96, $avk7[7])
   GUICtrlSetData($cijfer97, $avk7[8])
   GUICtrlSetData($cijfer98, $avk7[9])
   GUICtrlSetData($cijfer99, $avk7[10])
   GUICtrlSetData($cijfer100, $avk7[11])
   GUICtrlSetData($cijfer101, $avk7[12])
   GUICtrlSetData($cijfer102, $avk7[13])
   GUICtrlSetData($cijfer103, $avk7[14])
   GUICtrlSetData($cijfer104, $avk7[15])
      
   $avk8 = StringSplit(IniRead(@ScriptDir & "\" & _TVGetItemTree($TV, "\") & ".ini", "Cijfers", $avakken8, ""), ",")
   GUICtrlSetData($cijfer105, $avk8[1])
   GUICtrlSetData($cijfer106, $avk8[2])
   GUICtrlSetData($cijfer107, $avk8[3])
   GUICtrlSetData($cijfer108, $avk8[4])
   GUICtrlSetData($cijfer109, $avk8[5])
   GUICtrlSetData($cijfer110, $avk8[6])
   GUICtrlSetData($cijfer111, $avk8[7])
   GUICtrlSetData($cijfer112, $avk8[8])
   GUICtrlSetData($cijfer113, $avk8[9])
   GUICtrlSetData($cijfer114, $avk8[10])
   GUICtrlSetData($cijfer115, $avk8[11])
   GUICtrlSetData($cijfer116, $avk8[12])
   GUICtrlSetData($cijfer117, $avk8[13])
   GUICtrlSetData($cijfer118, $avk8[14])
   GUICtrlSetData($cijfer119, $avk8[15])
      
   
   
   
            EndIf
    EndSwitch
EndFunc

Func TVLoadIni($tviID, $iPath)
    Local $FFFF, $FFNF, $STR
    $FFFF = FileFindFirstFile($iPath)
    If $FFFF = -1 Then Return -1
    While 1
        $FFNF = FileFindNextFile($FFFF)
        If @error Then ExitLoop
        $STR = StringTrimRight($FFNF, 4)
        GUICtrlCreateTreeViewItem($STR, $tviID)
        GUICtrlSetOnEvent(-1, "Event")
        GUICtrlSetColor(-1, 0x0000C0)
    WEnd
    FileClose($FFFF)
    Return 0
EndFunc

Func _TVGetItemTree($i_treeview, $s_sep_char, $h_tv_item = 0)
    Local $szPath = "", $hParent, $h_item
    If $h_tv_item <> 0 Then
        $h_item = $h_tv_item
    Else
        $h_item = GUICtrlSendMsg($i_treeview, $TVM_GETNEXTITEM, $TVGN_CARET, 0)
    EndIf
    If $h_item > 0 Then
        $szPath = _TVGetItemText($i_treeview, $h_item)
        Do
            $hParent = GUICtrlSendMsg($i_treeview, $TVM_GETNEXTITEM, $TVGN_PARENT, $h_item)
            If $hParent > 0 Then $szPath = _TVGetItemText($i_treeview, $hParent) & $s_sep_char & $szPath
            $h_item = $hParent
        Until $h_item <= 0
    EndIf

    Return $szPath
EndFunc  ;==>_TVGetItemTree

Func _TVGetItemText($i_treeview, $h_item = 0); copy, name changed
    Local $s_txt = ""
    If $h_item = 0 Then Return ""
    Local $st_txt = DllStructCreate("char[4096]")
    Local $st_TVI = DllStructCreate("uint;uint;uint;uint;ptr;int;int;int;int;uint;int")
    DllStructSetData($st_TVI, 1, $TVIF_TEXT)
    DllStructSetData($st_TVI, 2, $h_item)
    DllStructSetData($st_TVI, 5, DllStructGetPtr($st_txt))
    DllStructSetData($st_TVI, 6, DllStructGetSize($st_txt))
    If GUICtrlSendMsg($i_treeview, $TVM_GETITEM, 0, DllStructGetPtr($st_TVI)) Then $s_txt = DllStructGetData($st_txt, 1)
    Return $s_txt
EndFunc  ;==>_TVGetText

Func On_Exit()
    GUISetState(@SW_HIDE, @GUI_CtrlId)
    Exit
EndFunc

Func menu()
    
    Switch @GUI_CTRLID
  Case $menu_bestand_exit
   Exit
  Case $menu_gebruikers_toevoegen
     
  Case $menu_gebruikers_wijzigen 
  Case $menu_gebruikers_verwijderen
  Case $menu_groepen_toevoegen
   group_vakadd()
  Case $menu_groepen_wijzigen 
  Case $menu_groepen_verwijderen 
        Case $menu_vakken_toevoegen
   GUISetState(@SW_SHOW, $Gui_addvak)
  Case $menu_vakken_wijzigen
  Case $menu_vakken_verwijderen 
    EndSwitch
EndFunc


Func addvak()
$new_vak1 = "vk" & GUICtrlRead($vak1) & ","
$new_vak2 = "vk" & GUICtrlRead($vak2) & ","
$new_vak3 = "vk" & GUICtrlRead($vak3) & ","
$new_vak4 = "vk" & GUICtrlRead($vak4) & ","
$new_vak5 = "vk" & GUICtrlRead($vak5) & ","
$new_vak6 = "vk" & GUICtrlRead($vak6) & ","
$new_vak7 = "vk" & GUICtrlRead($vak7) & ","
$new_vak8 = "vk" & GUICtrlRead($vak8) & ","
$new_vak9 = "vk" & GUICtrlRead($vak9) & ","
$new_vak10 = "vk" & GUICtrlRead($vak10) & ","
$new_vak11 = "vk" & GUICtrlRead($vak11) & ","
$new_vak12 = "vk" & GUICtrlRead($vak12) & ","
$new_vak13 = "vk" & GUICtrlRead($vak13) & ","
$new_vak14 = "vk" & GUICtrlRead($vak14) & ","
$new_vak15 = "vk" & GUICtrlRead($vak15) & ","

$newvak = $new_vak1 & $new_vak2 & $new_vak3 & $new_vak4 & $new_vak5 & $new_vak6 & $new_vak7 & $new_vak8 & $new_vak9 & $new_vak10 & $new_vak11 & $new_vak12 & $new_vak13 & $new_vak14 & $new_vak15

IniWrite("vakken.ini", "algemeen", "vakken", $newvak)

MsgBox(64, "Cijfer Registratie Systeem | Melding", "Vak(ken) toegevoegd")
EndFunc 

Func group_vakadd()
    
;###############################################################################################
; Not GUICtrlSetState !!!!!!!!!!!!!
GUISetState(@SW_SHOW, $Gui_addgroup)  
;###############################################################################################
; using @error was not working so set a default value to show error state
$vakken = IniRead("vakken.ini", "Algemeen", "Vakken", "Error")

If $vakken = "Error" Then
;###############################################################################################
    MsgBox(4096, "", "Error occurred, probably no INI file.")
Else
    
    For $i = 1 To 5
        $CheckBox[$i] = GUICtrlCreateCheckbox("vk" & $i, 45, $top, 50, 20) 
        $count += 1
        $top += 20
    Next
    $top = 50
    For $i = 6 To 10
        $CheckBox[$i] = GUICtrlCreateCheckbox("vk" & $i, 110, $top, 50, 20) 
        $count += 1
        $top += 20
    Next
    $top = 50
    For $i = 11 To 15
        $CheckBox[$i] = GUICtrlCreateCheckbox("vk" & $i, 175, $top, 50, 20) 
        $count += 1
        $top += 20
    Next

    $vakken = StringReplace($vakken, "vk", "")
    $vakken_array = StringSplit($vakken, ",")
    
   ;###############################################################################################
; need to use GUICtrlSetState($CheckBox[$vakken_array[$i]], $GUI_CHECKED) here - told you yesterday!
    For $i = 1 To $vakken_array[0]
        If $vakken_array[$i] <> "" Then
            GUICtrlSetState($CheckBox[$vakken_array[$i]], $GUI_CHECKED)
        EndIf
    Next
;###############################################################################################

EndIf

EndFunc

Func GroupAddOK()
    If GUICtrlRead($newgroup) = Not "" Then
        $newgr2 = ""
        For $f = $CheckBox[1] To $CheckBox[15]
            $newgr1 = BitAND(GUICtrlRead($f), $GUI_CHECKED)
            If $newgr1 = $GUI_CHECKED Then
                $newgr2 &= GUICtrlRead($f, 1) & ","
            EndIf
        Next
;###############################################################################################
; create subdirectory if it does not exist - told you yesterday!
        If Not FileExists(@ScriptDir & "\groepen") Then DirCreate(@ScriptDir & "\groepen")
;###############################################################################################        
        $ini_File = @ScriptDir & "\groepen\" & GUICtrlRead($newgroup) & ".ini"
        IniWrite($ini_file, "algemeen", "vakken", $newgr2)
    Else
        MsgBox(64, "Cijfer Registratie Systeem | Melding", "Vul AUB een geldige naam in voor de groep")
    EndIf
EndFunc ;==>GroupAddOK

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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