string gadget
Publié : dim. 13/août/2006 19:37
bonjour a tous
comment faire pour savoir si le string gadget 0 ou 1 a été sélectionné si oui on le colore en jaune a l'aide du bouton colore?
mon code
; PureBasic Visual Designer v3.95 build 1485 (PB4Code)
;VARIABLES COULEUR
colorblanc=$FFFFFF ;couleur blanche
colorjaune=$00FFFF ;couleur jaune
;- CONSTANTE WINDOW
;
Enumeration
#Window_0
EndEnumeration
;- CONSTANTES GADGET
;
Enumeration
#String_0
#String_1
#Button_2
EndEnumeration
;ouvre une fenetre et la color en blanc
If OpenWindow(#Window_0, 216, 0, 600, 300, "TOURNEE", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered | #PB_Window_WindowCentered )And CreateGadgetList(WindowID(0))
SetWindowColor(#Window_0, colorblanc)
; céation de la liste des gadgets puis céation des gadgets
If CreateGadgetList(WindowID(#Window_0))
StringGadget(#String_0, 40, 30, 40, 20, "")
StringGadget(#String_1, 120, 30, 50, 20, "")
ButtonGadget(#Button_2, 270, 20, 60, 20, "couleur")
SetGadgetColor(#String_0, #PB_Gadget_BackColor, colorblanc)
SetGadgetColor(#String_1, #PB_Gadget_BackColor, colorblanc)
EndIf;fi création des gadgets
EndIf ;fin de la céation de la fenetre et des gadgets
;*******************************************
; BOUCLE PRINCIPALE ATTENTE D'UN EVENEMENT
;*******************************************
Repeat
Evenement = WaitWindowEvent()
If EventType() = #PB_EventType_LeftClick ;teste si clik a droite souris
SetGadgetColor(#String_0, #PB_Gadget_BackColor, colorjaune) ; si oui colore en jaune #string_0
EndIf
;*********************
Until Evenement = #PB_Event_CloseWindow ;FIN BOUCLE PRINCIPALE
;*********************
End ;FIN DU PROGRAM
comment faire pour savoir si le string gadget 0 ou 1 a été sélectionné si oui on le colore en jaune a l'aide du bouton colore?
mon code
; PureBasic Visual Designer v3.95 build 1485 (PB4Code)
;VARIABLES COULEUR
colorblanc=$FFFFFF ;couleur blanche
colorjaune=$00FFFF ;couleur jaune
;- CONSTANTE WINDOW
;
Enumeration
#Window_0
EndEnumeration
;- CONSTANTES GADGET
;
Enumeration
#String_0
#String_1
#Button_2
EndEnumeration
;ouvre une fenetre et la color en blanc
If OpenWindow(#Window_0, 216, 0, 600, 300, "TOURNEE", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered | #PB_Window_WindowCentered )And CreateGadgetList(WindowID(0))
SetWindowColor(#Window_0, colorblanc)
; céation de la liste des gadgets puis céation des gadgets
If CreateGadgetList(WindowID(#Window_0))
StringGadget(#String_0, 40, 30, 40, 20, "")
StringGadget(#String_1, 120, 30, 50, 20, "")
ButtonGadget(#Button_2, 270, 20, 60, 20, "couleur")
SetGadgetColor(#String_0, #PB_Gadget_BackColor, colorblanc)
SetGadgetColor(#String_1, #PB_Gadget_BackColor, colorblanc)
EndIf;fi création des gadgets
EndIf ;fin de la céation de la fenetre et des gadgets
;*******************************************
; BOUCLE PRINCIPALE ATTENTE D'UN EVENEMENT
;*******************************************
Repeat
Evenement = WaitWindowEvent()
If EventType() = #PB_EventType_LeftClick ;teste si clik a droite souris
SetGadgetColor(#String_0, #PB_Gadget_BackColor, colorjaune) ; si oui colore en jaune #string_0
EndIf
;*********************
Until Evenement = #PB_Event_CloseWindow ;FIN BOUCLE PRINCIPALE
;*********************
End ;FIN DU PROGRAM