Code : Tout sélectionner
#include <Array.au3>
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
Opt("WinTitleMatchMode", -2)
Local $tableau1[1]
$Button_text = "Valider"
Local $g_aidIcons
Global $directory = "D:\Desktop\Logo3.jpg"
$GUINombre = GUICreate("Nombre de fleurs", 420, 100, 100, 100, -1, $WS_EX_ACCEPTFILES)
$g_aidIcons = GUICtrlCreatePic($directory, 200, 0, 196, 33)
GUICtrlCreateLabel("Combien de fleurs à répertorier (entre 1 et 10) ? ", 50, 40, 300, 20)
$tableau1[0] = GUICtrlCreateInput("", 10, 60, 100, 21)
$Button = GUICtrlCreateButton($Button_text,160, 80, 100, 20)
GUISetState(@SW_SHOW)
Local $nombre
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then Exit
If $msg = $Button Then
$nombre = $tableau1[0]
ExitLoop
EndIf
WEnd
GuiDelete($GUINombre)
MsgBox(0,"Vérifications", "Il y en a " & $nombre)
Local $tableau[$nombre][4]
$text = "Veuillez remplir le tableau SVP"
$GUIList = GUICreate("Entrez les valeurs", 420, 20*($nombre+6), 100, 100, -1, $WS_EX_ACCEPTFILES)
$g_aidIcons = GUICtrlCreatePic($directory, 200, 0, 196, 33)
GUICtrlCreateLabel($text, 100, 0, 200, 20)
GUICtrlCreateLabel("Fleurs", 10, 40, 100, 20)
GUICtrlCreateLabel("Nom", 120, 40, 100, 20)
GUICtrlCreateLabel("Couleur", 220, 40, 100, 20)
GUICtrlCreateLabel("Emplacement", 320, 40, 100, 20)
For $i = 0 to $nombre - 1
$x = $i+3
$tableau[$i][0] = GUICtrlCreateLabel("Fleur " & $i+1, 10, 20*$x, 100, 21)
$tableau[$i][1] = GUICtrlCreateInput("Nom " & $i+1, 110, 20*$x, 100, 21)
$tableau[$i][2] = GUICtrlCreateInput("Couleur " & $i+1, 210, 20*$x, 100, 21)
Local $idBox = GUICtrlCreateCombo("", 310, 20*$x, 100, 20)
$tableau[$i][3] = $idBox
GUICtrlSetData($idBox, "E1|E2|E3|E4|E5|E6|E7|E8|E9|E10", "E" & $i+1)
Next
$Button = GUICtrlCreateButton($Button_text,160, 20*($nombre+4), 100, 20)
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then Exit
If $msg = $Button Then
For $i = 0 to $nombre - 1
$tableau[$i][0] = "Fleur " & $i + 1
$tableau[$i][1] = GUICtrlRead($tableau[$i][1])
$tableau[$i][2] = GUICtrlRead($tableau[$i][2])
$tableau[$i][3] = GUICtrlRead($tableau[$i][3])
Next
ExitLoop
EndIf
WEnd
GuiDelete($GUIList)