J'ai un peu de misère à expliquer mon problème. Voici mon script et ensuite je vous explique mon problème
► Afficher le texte
Code : Tout sélectionner
#include <GUIConstants.au3>
#include <File.au3>
#include <Array.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
Opt("GUIOnEventMode", 1)
Global $IniFile = @ScriptDir & "\Ini\Villes.ini", $aArray, $MainGUI, $Combo, $Checks, $DummyCheck
_Gui()
While GUIGetMsg() <> -3
WEnd
Func _Gui()
$aArrayLogiciels = IniReadSection(@ScriptDir & "\Ini\logiciels.ini", "Logiciels")
$DummyCheck = $aArrayLogiciels[0][0]
Dim $Checks[$aArrayLogiciels[0][0] + 1]
$Height = ($aArrayLogiciels[0][0] * 20) + 50
If $Height > @DesktopHeight Then
MsgBox(0x0,"Erreur", "Il y a trop pour votre écran", 3)
$Height = @DesktopHeight - 50
EndIf
$MainGUI = GUICreate("Menu d'installation de logiciels", 910, 340, 200, 200)
$Label1 = GUICtrlCreateLabel ("Sélectionner les logiciels à installer", 350, 1, 300, 17)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
Local Const $sFont = "Comic Sans Ms"
GUICtrlSetFont($Label1, 10, 400, 4, $sFont)
GUICtrlCreateGroup ("Produits Autodesk", 20, 48, 350, 250)
GUICtrlCreateGroup ("Produits Microsoft", 390, 48, 150, 250)
GUICtrlCreateGroup ("Autres Produits", 555, 48, 310, 250)
$alignH = 70
$alignV = 30
For $i = 1 To $aArrayLogiciels[0][0]
$Checks[$i] = GUICtrlCreateCheckbox($aArrayLogiciels[$i][0], $alignV, $alignH, 125, 15)
GUICtrlSetState(-1, $GUI_DISABLE)
$alignH = $alignH + 20
If $alignH = 290 then
$alignV = 200
$alignH = 70
EndIf
if $i = 14 Then
$alignH = 70
$alignV = 400
EndIf
if $i = 18 then
$alignH = 70
$alignV = 565
EndIf
if $i = 29 then
$alignH = 70
$alignV = 725
EndIf
Next
$Label2 = GUICtrlCreateLabel ("Place d'affaire:", 20, 25, 100, 17)
Global $CmbTitle="Choisissez une ville..."
$Combo = GUICtrlCreateCombo($CmbTitle, 140, 30, 220, 25, BitOR($CBS_DROPDOWNLIST, $WS_VSCROLL))
GUISetBkColor (0xf0f8ff)
GUICtrlSetOnEvent(-1, "_Autorisation")
Global $Button1 = GUICtrlCreateButton ("Démarrer", 20, 305, 129, 25, 0)
GUICtrlSetState(-1, $GUI_FOCUS)
GUISetState()
Global $Button2 = GUICtrlCreateButton ("Sélectionner tous", 180, 305, 129, 25, 0)
GUISetState()
Global $Button3 = GUICtrlCreateButton ("Déselectionner tous", 330, 305, 129, 25, 0)
GUISetState()
$aArrayCombo = IniReadSectionNames($IniFile)
If Not @error Then
For $i = 1 To $aArrayCombo[0]
GUICtrlSetData($Combo, $aArrayCombo[$i])
Next
EndIf
GUISetState(@SW_SHOW, $MainGUI)
EndFunc
Func _Autorisation()
$Location = GUICtrlRead($Combo)
Local $aAutorisation = IniReadSection($IniFile, $Location)
If Not IsArray($aAutorisation) Then
For $i = 1 To $DummyCheck
GUICtrlSetState($Checks[$i], 4)
GUICtrlSetState($Checks[$i], 128)
Next
Return
EndIf
If Not @error Then
For $i = 1 To $aAutorisation[0][0]
If $aAutorisation[$i][1] = 1 Then
GUICtrlSetState($Checks[$i], $GUI_DISABLE)
GUICtrlSetState($Checks[$i], 64)
GUICtrlSetState($Checks[$i], $GUI_UNCHECKED)
Else
GUICtrlSetState($Checks[$i], 4)
GUICtrlSetState($Checks[$i], 128)
EndIf
Next
endIf
EndFunc
Func _Exit()
Exit
EndFunc