qui peux a resoudre me petit probleme avec mon code ??
Publié : dim. 24/oct./2004 12:34
bonjour
j'ai cree ce programme pour un ami
je rencontre 1 probleme
quand je clique sur un element pour voir la fiche
j'arrive a activer le bouton quitter
qui peux m'aider a resoudre ce probleme
merci de m'aider svp
Williamm
j'ai cree ce programme pour un ami
je rencontre 1 probleme
quand je clique sur un element pour voir la fiche
j'arrive a activer le bouton quitter
qui peux m'aider a resoudre ce probleme
Code : Tout sélectionner
Enumeration
#Window_0
#Window_1
#window_2
EndEnumeration
Enumeration
#ListIcon_0
#Button_Ajoutet
#Button_Effacee
#Text_Titre
#Frame3D_0
#Frame3D_ajoute
#Text_NomS
#String_NomS
#Text_NomT
#Editor_NomT
#Text_Matos
#Editor_matos
#Text_date
#String_date
#Text_Heure
#String_heure
#Text_Lieux
#Editor_Lieux
#Button_ajoute
EndEnumeration
Enumeration
#menu_Charger
#menu_Save
#menu_Quitter
#menu_Vider
#menu_info
EndEnumeration
Enumeration
#menu_Effacec
#menu_Annuler
EndEnumeration
;Fonts
Global FontID1
FontID1 = LoadFont(1, "Arial", 11, #PB_Font_Bold)
Global FontID2
FontID2 = LoadFont(2, "Arial", 12, #PB_Font_Bold)
Global FontID3
FontID3 = LoadFont(3, "Arial", 10, #PB_Font_Bold)
Global FontID4
FontID4 = LoadFont(4, "Arial", 26, #PB_Font_Bold)
;creation d'un element
Structure Tour_struct
Nom.s
ListeT.s
Matos.s
Date.s
Heure.s
Lieux.s
EndStructure
NewList Items.Tour_struct()
;procedure de gestion des items
Procedure.b item_clear()
ClearList(Items())
ProcedureReturn 1
EndProcedure
;ajouter un element dans la liste
Procedure.b item_add()
If AddElement(Items())
Items()\Nom= GetGadgetText(#String_NomS)
Items()\ListeT= GetGadgetText(#Editor_NomT)
Items()\Matos= GetGadgetText(#Editor_matos)
Items()\date= GetGadgetText(#String_Date)
Items()\Heure= GetGadgetText(#String_heure)
Items()\Lieux=GetGadgetText( #Editor_Lieux)
AddGadgetItem(#ListIcon_0, -1,Items()\Nom) ;
EndIf
ProcedureReturn 1
EndProcedure
Procedure effacer()
SetGadgetText(#String_NomS, "")
SetGadgetText(#Editor_NomT, "")
SetGadgetText(#Editor_matos, "")
SetGadgetText(#String_Date, "")
SetGadgetText(#String_Heure, "")
SetGadgetText(#Editor_lieux, "")
ActivateGadget(#String_NomS)
EndProcedure
Procedure info()
MessageRequester("Information sur Merlin ", "Merlin Version 01 " + Chr(10) + "Par William marcy" + Chr(10) + "Copyright 2004 ", #MB_OK|#MB_ICONINFORMATION)
EndProcedure
Procedure Open_Window_0()
If OpenWindow(#Window_0, 18, 13, 955, 675, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_TitleBar , "Merlin le Gestionnaire de Prestation ")
If CreateGadgetList(WindowID())
;-
ListIconGadget(#ListIcon_0, 20, 20, 700, 630, "Nom du spectacle ", 696, #PB_ListIcon_CheckBoxes | #PB_ListIcon_GridLines)
SetGadgetFont(#ListIcon_0, FontID1)
ButtonGadget(#Button_Ajoutet, 740, 80, 190, 50, "AJOUTER")
GadgetToolTip(#Button_Ajoutet, "Ajoute un spectacle a la liste ")
SetGadgetFont(#Button_Ajoutet, FontID2)
ButtonGadget(#Button_Effacee, 740, 210, 190, 50, "EFFACER")
GadgetToolTip(#Button_Effacee, "Efface un spectacle de la liste ")
SetGadgetFont(#Button_Effacee, FontID2)
TextGadget(#Text_Titre, 750, 460, 180, 100, "Merlin Version 01 ", #PB_Text_Center)
SetGadgetFont(#Text_Titre, FontID4)
Frame3DGadget(#Frame3D_0, 730, 20, 210, 600, "")
If CreateMenu(0,WindowID())
MenuTitle( "Fichier")
MenuItem(#menu_Charger ,"Charger la liste")
MenuItem(#menu_Save ,"Sauvegarder la liste")
MenuItem(#menu_Quitter,"Quitter ")
MenuTitle("Edition")
MenuItem(#menu_vider," Vider la liste ")
MenuTitle ("Information")
MenuItem(#menu_info," A propos de ")
EndIf
EndIf
EndIf
EndProcedure
Procedure Open_Window_1()
If OpenWindow(#Window_1, 255, 7, 678, 724, #PB_Window_TitleBar | #PB_Window_BorderLess | #PB_Window_ScreenCentered , "Creation d'une nouvelle fiche ")
If CreateGadgetList(WindowID())
Frame3DGadget(#Frame3D_ajoute, 10, 10, 660, 710, "")
TextGadget(#Text_NomS, 20, 40, 150, 30, "Nom du spectacle :", #PB_Text_Center)
SetGadgetFont(#Text_NomS, FontID2)
StringGadget(#String_NomS, 180, 40, 480, 28, "")
SetGadgetFont(#String_NomS, FontID3)
TextGadget(#Text_NomT, 20, 110, 150, 30, "Listes des tours : ", #PB_Text_Center)
SetGadgetFont(#Text_NomT, FontID2)
EditorGadget(#Editor_NomT, 180, 110, 480, 100)
SetGadgetFont(#Editor_NomT, FontID3)
TextGadget(#Text_Matos, 20, 280, 130, 30, "Materiel : ", #PB_Text_Center)
SetGadgetFont(#Text_Matos, FontID2)
EditorGadget(#Editor_matos, 180, 280, 480, 130)
SetGadgetFont(#Editor_matos, FontID3)
TextGadget(#Text_date, 30, 460, 110, 30, "Date :", #PB_Text_Center)
SetGadgetFont(#Text_date, FontID2)
StringGadget(#String_date, 140, 460, 120, 30, "")
SetGadgetFont(#String_date, FontID3)
TextGadget(#Text_Heure, 360, 460, 110, 20, "Heure :", #PB_Text_Center)
SetGadgetFont(#Text_Heure, FontID2)
StringGadget(#String_heure, 480, 460, 130, 25, "")
SetGadgetFont(#String_heure, FontID3)
TextGadget(#Text_Lieux, 160, 520, 80, 20, "Lieux: ", #PB_Text_Center)
SetGadgetFont(#Text_Lieux, FontID2)
EditorGadget(#Editor_Lieux, 270, 510, 380, 80)
SetGadgetFont(#Editor_Lieux, FontID3)
ButtonGadget(#Button_ajoute, 200, 620, 290, 50, "Ajouter un nouveau spectacle ")
GadgetToolTip(#Button_ajoute, "Ajoute une prestation a la liste ")
SetGadgetFont(#Button_ajoute, FontID2)
If CreateMenu(1,WindowID())
MenuTitle( "Edition")
MenuItem(#menu_Effacec," Effacer les Renseignement ")
MenuItem(#menu_Annuler," Annuler la fiche ")
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_EventMenu
Select EventMenuID()
Case#menu_Effacec :effacer()
Case #menu_Annuler: Fermer_Window_1 = 1
EndSelect
Case #PB_EventGadget
GadgetID = EventGadgetID()
If GadgetID = #Button_Ajoute
item_add()
Fermer_Window_1 = 1
EndIf
EndSelect
Until Fermer_Window_1 = 1
CloseWindow(#Window_1)
While WindowEvent():Wend
EndIf
EndIf
EndIf
EndProcedure
Procedure Open_Window_2()
If OpenWindow(#Window_1, 255, 7, 678, 724, #PB_Window_TitleBar | #PB_Window_BorderLess | #PB_Window_ScreenCentered , "Fiche du spectacle ")
If CreateGadgetList(WindowID())
Frame3DGadget(#Frame3D_ajoute, 10, 10, 660, 710, "")
TextGadget(#Text_NomS, 20, 40, 150, 30, "Nom du spectacle :", #PB_Text_Center)
SetGadgetFont(#Text_NomS, FontID2)
StringGadget(#String_NomS, 180, 40, 480, 28, "")
SetGadgetFont(#String_NomS, FontID3)
TextGadget(#Text_NomT, 20, 110, 150, 30, "Listes des tours : ", #PB_Text_Center)
SetGadgetFont(#Text_NomT, FontID2)
EditorGadget(#Editor_NomT, 180, 110, 480, 100)
SetGadgetFont(#Editor_NomT, FontID3)
TextGadget(#Text_Matos, 20, 280, 130, 30, "Materiel : ", #PB_Text_Center)
SetGadgetFont(#Text_Matos, FontID2)
EditorGadget(#Editor_matos, 180, 280, 480, 130)
SetGadgetFont(#Editor_matos, FontID3)
TextGadget(#Text_date, 30, 460, 110, 30, "Date :", #PB_Text_Center)
SetGadgetFont(#Text_date, FontID2)
StringGadget(#String_date, 140, 460, 120, 30, "")
SetGadgetFont(#String_date, FontID3)
TextGadget(#Text_Heure, 360, 460, 110, 20, "Heure :", #PB_Text_Center)
SetGadgetFont(#Text_Heure, FontID2)
StringGadget(#String_heure, 480, 460, 130, 25, "")
SetGadgetFont(#String_heure, FontID3)
TextGadget(#Text_Lieux, 160, 520, 80, 20, "Lieux: ", #PB_Text_Center)
SetGadgetFont(#Text_Lieux, FontID2)
EditorGadget(#Editor_Lieux, 270, 510, 380, 80)
SetGadgetFont(#Editor_Lieux, FontID3)
ButtonGadget(#Button_ajoute, 200, 620, 290, 50, " Quitter la fiche ")
SetGadgetFont(#Button_ajoute, FontID2)
ForEach Items()
If Items()\Nom = GetGadgetItemText(#ListIcon_0, Element, 0)
SetGadgetText(#String_NomS,Items()\Nom)
SetGadgetText(#Editor_NomT,Items()\ListeT)
SetGadgetText(#Editor_matos,Items()\Matos)
SetGadgetText(#String_Date,Items()\date)
SetGadgetText(#String_heure,Items()\Heure)
SetGadgetText(#editor_lieux,Items()\Lieux)
Break
EndIf
Next
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_EventCloseWindow
Fermer_Window_2 = 1
Case #PB_EventGadget
GadgetID = EventGadgetID()
If GadgetID = #Button_Ajoute
Fermer_Window_2 = 1
EndIf
EndSelect
Until Fermer_Window_2 = 1
CloseWindow(#Window_2)
EndIf
EndIf
EndProcedure
Open_Window_0()
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_EventMenu
Select EventMenuID()
Case #menu_Info:info()
Case#menu_Quitter :fermer_window_0=1
EndSelect
Case #PB_EventGadget
Select EventGadgetID()
Case #ListIcon_0
GetGadgetState(#ListIcon_0) :Open_Window_2()
Case #Button_Ajoutet:open_window_1()
EndSelect
Case #PB_EventCloseWindow
fermer_window_0= 1
EndSelect
Until fermer_window_0= 1
End
Williamm