J'aimerai faire un menu Dynamique c-a-d, lorsque j'appuie sur le bouton "ajouter" il ajoute une ligne de plusieurs cellules avec un ID identique et un bouton supprimer pour chaque ligne créé (Pour supprimer la ligne de cellule). Le problème c'est que je ne sais pas récupérer l'ID du bouton supprimer.
Ma façon n'est surement pas la meilleur, si vous avez des remarques n'hésitez pas.
Vous comprendrez surement mieu mon problème avec mon script et MERCI d'avoir pris le temps d'avoir lu.
► Afficher le texte
Code : Tout sélectionner
#include <GUIConstantsEx.au3>
#Include<file.au3>
Opt("MustDeclareVars", 1)
Opt("GUIOnEventMode", 1)
Global $BAJOUTER, $BRESULT, $BSEND, $i, $d, $height, $nom, $prenom
Global $inpRep, $cbAcces, $ResultRep, $ResultAcces, $lblsrv, $lstsrv, $rc,$MSG,$lblnom, $lblprenom, $cbAcces1,$lstsrv, $lblAcces, $lblRep
Global $inpRepN[8], $cbAccesN[8], $BDEL[8]
Global $HexNumber
$i = 0
$height = 90
Main ()
Func Main()
Local $BTNEXIT, $msg, $guiread
Dim $lblnom, $lblprenom, $cbAcces1,$lstsrv, $lblAcces, $lblRep
GuiCreate("Demande de droit sur répertoire", 400, 400,0,0)
$lblnom = GuiCtrlCreateLabel("NOM:", 10, 15)
$nom = GuiCtrlCreateInput("", 10, 35, 80, 20)
;GuiCtrlSetBkColor($nom, )
$lblprenom = GuiCtrlCreateLabel("PRENOM:", 100, 15)
$prenom = GuiCtrlCreateInput("", 100, 35, 80, 20)
$lblsrv = GuiCtrlCreateLabel("Serveurs de fichier", 10, 70)
$lstsrv = GuiCtrlCreateList("", 10, 90, 100, 90)
GuiCtrlSetData(-1, "FRLBM-FIL01|FRPAR-FIL01|BRMAC-FIL01")
$lblRep = GuiCtrlCreateLabel("Répertoire", 120, 70)
$inpRep = GuiCtrlCreateInput("", 120, 90, 80, 20)
$lblAcces = GuiCtrlCreateLabel("Droit d'acces", 212, 70)
$cbAcces = GuiCtrlCreatecombo("Select", 212, 90, 100, 100)
GUICtrlSetData(-1, "Lecture|Lecture/Ecriture")
$BAJOUTER = GUICtrlCreateButton("&Ajouter", 320, 90, 70)
GUICtrlSetOnEvent($BAJOUTER, "OnAjouter")
$BTNEXIT = GUICtrlCreateButton("&Exit", 295, 370, 100)
GUICtrlSetOnEvent($BTNEXIT, "OnExit")
$BRESULT =GUICtrlCreateButton("&Result", 175, 370, 100)
GUICtrlSetOnEvent($BRESULT, "OnResult")
GUISetOnEvent($GUI_EVENT_CLOSE, "OnClose")
GuiSetState()
while 1
Sleep(1000)
WEnd
EndFunc
Func OnClose()
Exit
EndFunc
Func OnAjouter()
If $i = 7 Then
MsgBox(16,"Erreur","Vous avez atteind la limite de nombre de répertoire")
Else
$i = $i + 1
$height = $height + 30
$inpRepN[$i] = GuiCtrlCreateInput("", 120, $height, 80, 20)
$ResultRep = $inpRepN[$i]
$cbAccesN[$i] = GuiCtrlCreatecombo("Select", 212, $height, 100, 100)
GUICtrlSetData($cbAccesN[$i], "Lecture|Lecture/Ecriture")
$ResultAcces = $cbAccesN[$i]
$BDEL[$i] = GUICtrlCreateButton("X", 320, $height, 20, 20)
GUICtrlSetOnEvent($BDEL[$i], "OnDel")
EndIf
EndFunc
Func OnDel()
GUICtrlDelete($inpRepN[$i])
GUICtrlDelete($cbAccesN[$i])
GUICtrlDelete($BDEL[$i])
EndFunc
Func OnResult()
MsgBox(0,"Result0",GUICtrlRead($inpRep))
MsgBox(0,"Result",GUICtrlRead($cbAcces))
;$compte =
for $compte = 1 to $i
MsgBox(0,"Result Rep" & $compte,GUICtrlRead($inpRepN[$compte]))
MsgBox(0,"Result Acces" & $compte,GUICtrlRead($cbAccesN[$compte]))
Next
;MsgBox(0,"Result",GUICtrlRead($ResultRep))
;MsgBox(0,"Result",GUICtrlRead($ResultAcces))
EndFunc
Func OnExit()
If GUICtrlRead($nom) = "" And GUICtrlRead($prenom) = "" And GUICtrlRead($lstsrv) = "" Then
MsgBox(16,"ERREUR","Remplis Ce p..... De NOM Et PRENOM Et Sélectionne Ce p..... De Serveur ! ! !")
Else
If GUICtrlRead($nom) = "" And GUICtrlRead($prenom) <> "" And GUICtrlRead($lstsrv) <> "" Then
MsgBox(16,"ERREUR","Remplis Ce p..... De NOM ! ! !")
Else
If GUICtrlRead($nom) <> "" And GUICtrlRead($prenom) = "" And GUICtrlRead($lstsrv) <> "" Then
MsgBox(16,"ERREUR","Remplis Ce p..... De PRENOM ! ! !")
Else
If GUICtrlRead($nom) <> "" And GUICtrlRead($prenom) <> "" And GUICtrlRead($lstsrv) = "" Then
MsgBox(16,"ERREUR","Sélectionnes Un p..... De Serveur ! ! !")
Else
If GUICtrlRead($nom) = "" And GUICtrlRead($prenom) = "" And GUICtrlRead($lstsrv) <> "" Then
MsgBox(16,"ERREUR","Remplis Ce p..... De NOM Et PRENOM ! ! !")
Else
If GUICtrlRead($nom) = "" And GUICtrlRead($prenom) <> "" And GUICtrlRead($lstsrv) = "" Then
MsgBox(16,"ERREUR","Remplis Ce p..... De NOM Et Sélectionne Ce p..... De Serveur ! ! !")
Else
If GUICtrlRead($nom) <> "" And GUICtrlRead($prenom) = "" And GUICtrlRead($lstsrv) = "" Then
MsgBox(16,"ERREUR","Remplis Ce p..... De PRENOM Et Sélectionne Ce p..... De Serveur ! ! !")
Else
Exit
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndFunc