ComboBox et fichier de préférences
Publié : ven. 28/mars/2008 11:34
Bien le bonjours à tous, est-il possible de charger dans un combobox certainne partie d'un fichier de préférences qui, une fois sélectionner, fait afficher les autres partie du fichier de préférences dans d'autre gadget (ex: StringGadget, EditorGadget...).
Exemple du fichier de préférences :
[PERSONNE 1]
adresse 1
telephone1
fax 1
[PERSONNE 2]
adresse 2
telephone2
fax 2
[PERSONNE 3]
etc.......
Il faudrais charger PERSONNE 1, PERSONNE 2, etc... dans le ComboBox, puis si une des presonnes est selectionner sur le ComboBox sa ferra afficher les données qui lui sont attachés.
Exemple :
- Si je séléctionne PERSONNE 1
- J'affiche adresse 1 dans un EditorGadget,
- J'affiche telephone 1 dans un StringGadget,
- J'affiche fax 1 dans un StringGadget.
etc... pour chaque personne.
Merci Pour vos réponses.
Exemple du fichier de préférences :
[PERSONNE 1]
adresse 1
telephone1
fax 1
[PERSONNE 2]
adresse 2
telephone2
fax 2
[PERSONNE 3]
etc.......
Il faudrais charger PERSONNE 1, PERSONNE 2, etc... dans le ComboBox, puis si une des presonnes est selectionner sur le ComboBox sa ferra afficher les données qui lui sont attachés.
Exemple :
- Si je séléctionne PERSONNE 1
- J'affiche adresse 1 dans un EditorGadget,
- J'affiche telephone 1 dans un StringGadget,
- J'affiche fax 1 dans un StringGadget.
etc... pour chaque personne.
Code : Tout sélectionner
;{- Enumerations / DataSections
;{ Windows
Enumeration
#Window_0
EndEnumeration
;}
;{ Gadgets
Enumeration
#ComboBox_0
#String_1
#String_2
#Editor_4
EndEnumeration
;}
Define.l Event, EventWindow, EventGadget, EventType, EventMenu
;}
Procedure OpenWindow_Window_0()
If OpenWindow(#Window_0, 450, 200, 338, 108, "ComboBox et Pref.", #PB_Window_MinimizeGadget|#PB_Window_TitleBar|#PB_Window_SystemMenu|#PB_Window_WindowCentered)
If CreateGadgetList(WindowID(#Window_0))
ComboBoxGadget(#ComboBox_0, 5, 5, 165, 100)
StringGadget(#String_1, 5, 30, 165, 20, "")
StringGadget(#String_2, 5, 55, 165, 20, "")
EditorGadget(#Editor_4, 175, 30, 155, 70)
EndIf
EndIf
EndProcedure
OpenWindow_Window_0()
;{- Event loop
Repeat
Event = WaitWindowEvent()
Select Event
; ///////////////////
Case #PB_Event_Gadget
EventGadget = EventGadget()
EventType = EventType()
If EventGadget = #ComboBox_0
ElseIf EventGadget = #String_1
ElseIf EventGadget = #String_2
ElseIf EventGadget = #Editor_4
EndIf
; ////////////////////////
Case #PB_Event_CloseWindow
EventWindow = EventWindow()
If EventWindow = #Window_0
CloseWindow(#Window_0)
Break
EndIf
EndSelect
ForEver
;
;}