Message sous l'averse de neige
Publié : mar. 30/nov./2010 11:32
bonjour à tous
J'avais besoin d'une boite d'alerte avec plus de 3 options...
alors au passage, je vous envoie le ptit bonjour d'un ami fauché.
Cordialement
J'avais besoin d'une boite d'alerte avec plus de 3 options...
alors au passage, je vous envoie le ptit bonjour d'un ami fauché.
Cordialement
Code : Tout sélectionner
;####### kernadec décembre 2010 #######
Enumeration
#WinAlert
#image
#image_gadget
#button01
#button02
#button03
#button04
#button05
#button06
EndEnumeration
Global iconselect.l
Procedure Alerte()
LoadFont(5, "Curlz MT", 28,#PB_Font_Bold)
; LoadFont(5, "Forte", 27,#PB_Font_Bold)
OpenWindow(#WinAlert,0,0,270,140,"Message Requester du Père Noël", #PB_Window_ScreenCentered|#PB_Window_SystemMenu)
CreateImage(#image,WindowWidth(#WinAlert),WindowHeight(#WinAlert),32) ;|#PB_Image_Transparent
StartDrawing(ImageOutput(#image))
cb=RGB(Random(255),Random(255),Random(255))
Box(0,0,WindowWidth(#WinAlert),WindowHeight(#WinAlert),cb)
If iconselect=0
SendMessage_(WindowID(#WinAlert),#WM_SETICON,#False,LoadIcon_(0,#IDI_ASTERISK)) ;IDI_ASTERISK = 32516
DrawImage(LoadIcon_(0, #IDI_ASTERISK), 5, 5)
PlaySound_("SystemAsterisk" ,0, #SND_ALIAS|#SND_NODEFAULT|#SND_NOWAIT|#SND_ASYNC ):EndIf
If iconselect=1
SendMessage_(WindowID(#WinAlert),#WM_SETICON,#False,LoadIcon_(0,#IDI_EXCLAMATION)) ;IDI_EXCLAMATION = 32515
DrawImage(LoadIcon_(0, #IDI_EXCLAMATION), 10, 10)
PlaySound_("SystemExclamation",0, #SND_ALIAS|#SND_NODEFAULT|#SND_NOWAIT |#SND_ASYNC ):EndIf
If iconselect=2
SendMessage_(WindowID(#WinAlert),#WM_SETICON,#False,LoadIcon_(0,#IDI_HAND)) ;IDI_HAND = 32513
DrawImage(LoadIcon_(0, #IDI_HAND), 10, 10)
PlaySound_("SystemHand" ,0, #SND_ALIAS|#SND_NODEFAULT|#SND_NOWAIT |#SND_ASYNC ):EndIf
If iconselect=3
SendMessage_(WindowID(#WinAlert),#WM_SETICON,#False,LoadIcon_(0,#IDI_QUESTION)) ;IDI_QUESTION = 32514
DrawImage(LoadIcon_(0, #IDI_QUESTION), 10, 10)
PlaySound_("SystemQuestion",0, #SND_ALIAS|#SND_NODEFAULT|#SND_NOWAIT|#SND_ASYNC):EndIf
If iconselect=4
SendMessage_(WindowID(#WinAlert),#WM_SETICON,#False,LoadIcon_(0,#IDI_APPLICATION)) ;IDI_APPLICATION = 32512
DrawImage(LoadIcon_(0, #IDI_APPLICATION), 10, 10)
PlaySound_("SystemStart" ,0, #SND_ALIAS|#SND_NODEFAULT|#SND_NOWAIT|#SND_ASYNC ):EndIf
If iconselect=5
SendMessage_(WindowID(#WinAlert),#WM_SETICON,#False,LoadIcon_(0,#IDI_WINLOGO)) ;#IDI_WINLOGO = 32517
DrawImage(LoadIcon_(0, #IDI_WINLOGO), 10, 10)
PlaySound_("SystemExit" ,0, #SND_ALIAS|#SND_NODEFAULT|#SND_NOWAIT |#SND_ASYNC ):EndIf
; Zone texte
DrawingFont(FontID(5))
DrawText(43,0,"Joyeux Noël ",RGB(255,255,255),cb)
DrawingMode(1)
DrawText(42,1,"Joyeux Noël ",RGB(255,0,0),cb)
DrawText(43,32," à Tous... ",RGB(255,255,255),cb)
DrawingMode(1)
DrawText(42,33," à Tous... ",RGB(255,0,0),cb)
StopDrawing()
ImageGadget(#image_gadget,0,0,WindowWidth(#WinAlert),WindowHeight(#WinAlert),ImageID(#image))
DisableGadget(#image_gadget,1)
Debug "Fond=RGB("+Str(Red(cb))+","+Str(Green(cb))+","+Str(Blue(cb))+")"
ButtonGadget(#button01, 25, 80, 60, 20, "Icône 1")
ButtonGadget(#button02, 105, 80, 60, 20, "Icône 2")
ButtonGadget(#button03, 185, 80, 60, 20, "Icône 3")
ButtonGadget(#button04, 25, 110, 60, 20, "Icône 4")
ButtonGadget(#button05, 105, 110, 60, 20, "Icône 5")
ButtonGadget(#button06, 185, 110, 60, 20, "Icône 6")
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
Select EventGadget()
Case #button01 : Debug "Bouton 1 SystemAsterisk (stern)"
iconselect=0
Alerte()
Case #button02 : Debug "Bouton 2 SystemExclamation (Advice)"
iconselect=1
Alerte()
Case #button03 : Debug "Bouton 3 SystemHand (Kritischer Abbruch)"
iconselect=2
Alerte()
Case #button04 : Debug "Bouton 4 SystemQuestion (Frage)"
iconselect=3
Alerte()
Case #button05 : Debug "Bouton 5 SystemExit (Systemstart)"
iconselect=4
Alerte()
Case #button06 : Debug "Bouton 6 SystemExit (Systemstart)"
iconselect=5
Alerte()
EndSelect
EndIf
If Event = #PB_Event_CloseWindow
End
EndIf
ForEver
EndProcedure
Alerte()
End