Code : Tout sélectionner
; purebasic : 3.94
; auteur : Progi1984
; langue : francais
; date : 18/01/2006
If OpenWindow(0,10,10,450,400,#PB_Window_ScreenCentered|#PB_Window_SystemMenu, "TreegadgetWorking")
If CreateGadgetList(WindowID())
TreeGadget(10,0,0,300,400)
ButtonGadget(20,300,0,150,30,"Ajouter l'item 1")
ButtonGadget(21,300,30,150,30,"Ajouter un fils (2) à 1")
DisableGadget(21,1)
ButtonGadget(22,300,60,150,30,"Ajouter un fils (3) à 2")
DisableGadget(22,1)
ButtonGadget(23,300,90,150,30,"Ajouter un frere (4) à 3")
DisableGadget(23,1)
ButtonGadget(24,300,120,150,30,"Ajouter un frere (5) à 2")
DisableGadget(24,1)
ButtonGadget(25,300,150,150,30,"Ajouter un frere (6) à 1")
DisableGadget(25,1)
ButtonGadget(26,300,180,150,30,"Ajouter un fils (7) à 5")
DisableGadget(26,1)
ButtonGadget(27,300,210,150,30,"Ajouter un frere (8) à 2 et 5")
DisableGadget(27,1)
ButtonGadget(28,300,240,150,30,"Fin")
DisableGadget(28,1)
EndIf
EndIf
Repeat
EventID=WaitWindowEvent()
GadgetID=EventGadgetID()
MenuID=EventMenuID()
Select EventID
Case #PB_Event_Gadget
Select GadgetID
Case 10
Case 20
AddGadgetItem(10,0,"1")
DisableGadget(20,1)
DisableGadget(21,0)
Case 21
OpenTreeGadgetNode(10,0)
AddGadgetItem(10,1,"2")
SetGadgetItemState(10, 0, #PB_Tree_Expanded )
CloseTreeGadgetNode(10,1)
DisableGadget(21,1)
DisableGadget(22,0)
Case 22
OpenTreeGadgetNode(10,1)
AddGadgetItem(10,2,"3")
SetGadgetItemState(10, 1, #PB_Tree_Expanded )
CloseTreeGadgetNode(10,2)
DisableGadget(22,1)
DisableGadget(23,0)
Case 23
OpenTreeGadgetNode(10,1)
AddGadgetItem(10,3,"4")
SetGadgetItemState(10, 1, #PB_Tree_Expanded )
CloseTreeGadgetNode(10,3)
DisableGadget(23,1)
DisableGadget(24,0)
Case 24
OpenTreeGadgetNode(10,0)
AddGadgetItem(10,4,"5")
SetGadgetItemState(10,0, #PB_Tree_Expanded )
CloseTreeGadgetNode(10,4)
DisableGadget(24,1)
DisableGadget(25,0)
Case 25
AddGadgetItem(10,5,"6")
DisableGadget(25,1)
DisableGadget(26,0)
Case 26
OpenTreeGadgetNode(10,4)
AddGadgetItem(10,5,"7")
SetGadgetItemState(10,4, #PB_Tree_Expanded )
CloseTreeGadgetNode(10,5)
DisableGadget(26,1)
DisableGadget(27,0)
Case 27
OpenTreeGadgetNode(10,0)
AddGadgetItem(10,6,"8")
SetGadgetItemState(10,0, #PB_Tree_Expanded )
CloseTreeGadgetNode(10,6)
DisableGadget(27,1)
DisableGadget(28,0)
Case 28
End
Default
MessageRequester("GadgetID", Str(GadgetID))
EndSelect
Case #PB_Event_CloseWindow
Quit=1
EndSelect
Until quit=1