j'ai un truc qui "marchotte" ; ça ne se plante pas mais ça n'affiche pas les bonnes images ?!?
Code : Tout sélectionner
EnableExplicit
Declare Exit()
Declare start()
; /// DECLARATION DE L'ENUMERARION
Enumeration gadget
#image1
#image2
EndEnumeration
Enumeration Window
#mf
EndEnumeration
Enumeration Gadget_lang
#G1
#G2
#G3
#G4
EndEnumeration
;/// DECLARATION DES VARIABLES
Global event, police
;/// INTERFACE UTILISATEUR (FENETRE, MENU, ETC ...)
Police = LoadFont(0, "Arial", 16, #PB_Font_Bold); CONSTANTES DE LA FENÊTRE
#LA_FEN = 1024
#HA_FEN = 768
#CA_SIZE = 20
#GD_SIZE = 16 * (#CA_SIZE + 2) + 2
#GD_YST = (#HA_FEN-#GD_SIZE) / 2
#GD_XST = (#LA_FEN-#GD_SIZE) / 2
#TXT_X = #GD_XST + #GD_SIZE / 2
#TXT_Y = #GD_YST + #GD_SIZE + 10
#CLEAR = "RESET"
; Langue
Enumeration Langue
#GB
#FR
#GE
EndEnumeration
; TITRES DES MENUS
Enumeration menus
#ME_GAM
#ME_TON
EndEnumeration
; ITEMS DU MENU GAMME
Enumeration Gamme
#GA_CHR
#GA_DIAMA
#GA_DIAMI
#GA_PMA
#GA_PMI
EndEnumeration
; ITEMS DU MENU TONALITÉ
Enumeration Tonalite #PB_Compiler_EnumerationValue
#TO_C
#TO_Db
#TO_D
#TO_Eb
#TO_E
#TO_F
#TO_Gb
#TO_G
#TO_Ab
#TO_A
#TO_Bb
#TO_B
EndEnumeration
Global Dim item.s(#PB_Compiler_EnumerationValue), a, A$, ix, iy, Police, xx, yy, TX_LEN, TX_HA, XF, Event, Lang, test, image1, image2
Procedure mk_menus (id)
Select id
Case #GB
CreateMenu(#ME_GAM, WindowID(0))
; MENU GAMME
MenuTitle("Scale")
MenuItem(#GA_CHR, "Chromatic")
MenuItem(#GA_DIAMA, "Major Diatonic")
MenuItem(#GA_DIAMI, "Minor Diatonic")
MenuItem(#GA_PMA, "Major Pentatonic")
MenuItem(#GA_PMI , "Minor Pentatonic")
item(#GA_CHR) = "Chromatic"
item(#GA_DIAMA) = "Major Diatonic"
item(#GA_DIAMI) = "Minor Diatonic"
item(#GA_PMA) = "Major Pentatonic"
item(#GA_PMI ) = "Minor Pentatonic"
; MENU TONALITÉ de DO à SI Par demis-tons
MenuTitle("Key")
MenuItem(#TO_C, "C")
MenuItem(#TO_Db, "C#")
MenuItem(#TO_D, "D#")
MenuItem(#TO_Eb, "Eb#")
MenuItem(#TO_E, "E")
MenuItem(#TO_F, "F")
MenuItem(#TO_Gb, "F#")
MenuItem(#TO_G, "G")
MenuItem(#TO_Ab, "Ab")
MenuItem(#TO_A, "A")
MenuItem(#TO_Bb, "Bb")
MenuItem(#TO_B, "B")
item(#TO_C) = "C"
item(#TO_Db) = "C#"
item(#TO_D) = "D"
item(#TO_Eb) = "Eb"
item(#TO_E) = "E"
item(#TO_F) = "F"
item(#TO_Gb) = "F#"
item(#TO_G) = "G"
item(#TO_Ab) = "Ab"
item(#TO_A) = "A"
item(#TO_Bb) = "Bb"
item(#TO_B) = "B"
Case #Fr
CreateMenu(#ME_GAM, WindowID(0))
; MENU GAMME
MenuTitle("Gamme")
MenuItem(#GA_CHR, "Chromatique")
MenuItem(#GA_DIAMA, "Diatonique Majeure")
MenuItem(#GA_DIAMI, "Diatonique Mineure")
MenuItem(#GA_PMA, "Pentatonique Majeure")
MenuItem(#GA_PMI , "Pentatonique Mineure")
item(#GA_CHR) = "Chromatique"
item(#GA_DIAMA) = "Diatonique Majeure"
item(#GA_DIAMI) = "Diatonique Mineure"
item(#GA_PMA) = "Pentatonique Majeure"
item(#GA_PMI ) = "Pentatonique Mineure"
; MENU TONALITÉ de DO à SI Par demis-tons
MenuTitle("Tonalité")
MenuItem(#TO_C, "Do")
MenuItem(#TO_Db, "Do#")
MenuItem(#TO_D, "Ré")
MenuItem(#TO_Eb, "Mib")
MenuItem(#TO_E, "Mi")
MenuItem(#TO_F, "Fa")
MenuItem(#TO_Gb, "Fa#")
MenuItem(#TO_G, "Sol")
MenuItem(#TO_Ab, "Lab")
MenuItem(#TO_A, "La")
MenuItem(#TO_Bb, "Sib")
MenuItem(#TO_B, "Si")
item(#TO_C) = "Do"
item(#TO_Db) = "Do#"
item(#TO_D) = "Ré"
item(#TO_Eb) = "Mib"
item(#TO_E) = "Mi"
item(#TO_F) = "Fa"
item(#TO_Gb) = "Fa#"
item(#TO_G) = "Sol"
item(#TO_Ab) = "Lab"
item(#TO_A) = "La"
item(#TO_Bb) = "Sib"
item(#TO_B) = "Si"
Case #GE
CreateMenu(#ME_GAM, WindowID(0))
; MENU GAMME
MenuTitle("Gamme")
MenuItem(#GA_CHR, "Chromatique")
MenuItem(#GA_DIAMA, "Diatonique Majeure")
MenuItem(#GA_DIAMI, "Diatonique Mineure")
MenuItem(#GA_PMA, "Pentatonique Majeure")
MenuItem(#GA_PMI , "Pentatonique Mineure")
item(#GA_DIAMA) = "Diatonique Majeure"
item(#GA_DIAMI) = "Diatonique Mineure"
item(#GA_PMA) = "Pentatonique Majeure"
item(#GA_PMI ) = "Pentatonique Mineure"
; MENU TONALITÉ de DO à SI Par demis-tons
MenuTitle("Tonalité")
MenuItem(#TO_C, "Do")
MenuItem(#TO_Db, "Do#")
MenuItem(#TO_D, "Ré")
MenuItem(#TO_Eb, "Mib")
MenuItem(#TO_E, "Mi")
MenuItem(#TO_F, "Fa")
MenuItem(#TO_Gb, "Fa#")
MenuItem(#TO_G, "Sol")
MenuItem(#TO_Ab, "Lab")
MenuItem(#TO_A, "La")
MenuItem(#TO_Bb, "Sib")
MenuItem(#TO_B, "Si")
item(#TO_C) = "C"
item(#TO_Db) = "C#"
item(#TO_D) = "D"
item(#TO_Eb) = "Eb"
item(#TO_E) = "E"
item(#TO_F) = "F"
item(#TO_Gb) = "F#"
item(#TO_G) = "G"
item(#TO_Ab) = "Ab"
item(#TO_A) = "A"
item(#TO_Bb) = "Bb"
item(#TO_B) = "B"
EndSelect
EndProcedure
; CRÉATION FENÊTRE
Procedure Start()
BindEvent(#PB_Event_CloseWindow, @Exit())
EndProcedure
If OpenWindow(#mf, 0, 0, #LA_FEN, #HA_FEN, "", #PB_Window_ScreenCentered | #PB_Window_TitleBar | #PB_Window_SystemMenu )
UseJPEGImageDecoder()
image1 = CatchImage(#PB_Any, ?imagetest1)
image2 = CatchImage(#PB_Any, ?imagetest2)
ImageGadget(#image1, 20, 20, 40, 40, ImageID(image1))
ImageGadget(#image2, 165, 80, 40, 40, ImageID(image2))
; AAA
;Cette partie sert à tester les changement de menus
;
EndIf
test = 0
If test <> 0
mk_menus (0)
A$ = "Bout"
MessageRequester( A$, A$, #PB_MessageRequester_Ok)
mk_menus (1)
MessageRequester( A$, A$, #PB_MessageRequester_Ok)
mk_menus(2)
MessageRequester( A$, A$, #PB_MessageRequester_Ok)
EndIf
mk_menus(#FR)
;
; Fin AAA
;
; Création de la grille
If CreateImage(0, #LA_FEN, #HA_FEN) And StartDrawing(ImageOutput(0))
ImageGadget(#G1,#GD_XST,#GD_YST, #GD_SIZE,#GD_SIZE, 0)
Box(#GD_XST,#GD_YST, #GD_SIZE,#GD_SIZE, RGB(200,0, 0))
For ix = 0 To 15
xx = #GD_XST + 2 + ix*(#CA_SIZE+2) ;
For iy = 0 To 15
yy = #GD_YST + 2 + iy*(#CA_SIZE+2) ;
Box( xx,yy,#CA_SIZE,#CA_SIZE, RGB(0,0,0))
Next iy
Next ix
DrawingFont(Police)
TX_LEN = TextWidth(#CLEAR)
TX_HA = TextHeight(#CLEAR)
Box(#TXT_X-4-TX_LEN/2, #TXT_Y+5, TX_LEN+8, TX_HA + 8, RGB(100,100,100))
DrawingMode(#PB_2DDrawing_Transparent )
XF =DrawText(#TXT_X-TX_LEN/2,#TXT_Y+8,#CLEAR, RGB(200, 200, 0))
; TX_LEN = XF-#TXT_X;
DrawingMode(#PB_2DDrawing_Default )
StopDrawing()
ImageGadget(0, 0, 0, 200, 200, ImageID(0))
StopDrawing()
ImageGadget(0, 0, 0, #LA_FEN, #HA_FEN, ImageID(0))
EndIf
Repeat
Event = WaitWindowEvent() ; pour l'instant test : on affiche un message et c'est tout.
Select Event
Case #PB_Event_Menu
A$ = Str(EventMenu())
; MessageRequester( A$, A$, #PB_MessageRequester_Ok)
Select EventMenu()
; Menu Gamme
; MessageRequester( A$, item(EventMenu()), #PB_MessageRequester_Ok)
Case #GA_CHR
MessageRequester( A$, item(EventMenu()), #PB_MessageRequester_Ok) ;
Case #GA_DIAMA
MessageRequester( A$, item(EventMenu()), #PB_MessageRequester_Ok) ; MessageRequester( A$, "Diatonique Majeure", #PB_MessageRequester_Ok)
Case #GA_DIAMI
MessageRequester( A$, item(EventMenu()), #PB_MessageRequester_Ok) ; MessageRequester( A$, "Diatonique Mineure", #PB_MessageRequester_Ok)
Case #GA_PMA
MessageRequester( A$, item(EventMenu()), #PB_MessageRequester_Ok) ; MessageRequester( A$, "Pentatonique Majeure", #PB_MessageRequester_Ok)
Case #GA_PMI
MessageRequester( A$, item(EventMenu()), #PB_MessageRequester_Ok) ; MessageRequester( A$, "Pentatonique Mineure", #PB_MessageRequester_Ok)
; Menu tonalié
Case #TO_C
MessageRequester( A$, "C", #PB_MessageRequester_Ok)
Case #TO_Db
MessageRequester( A$, "C#", #PB_MessageRequester_Ok)
Case #TO_D
MessageRequester( A$, "D", #PB_MessageRequester_Ok)
Case #TO_Eb
MessageRequester( A$, "Eb", #PB_MessageRequester_Ok)
Case #TO_E
MessageRequester( A$, "E", #PB_MessageRequester_Ok)
Case #TO_F
MessageRequester( A$, "F", #PB_MessageRequester_Ok)
Case #TO_Gb
MessageRequester( A$, "F#", #PB_MessageRequester_Ok)
Case #TO_G
MessageRequester( A$, "G", #PB_MessageRequester_Ok)
Case #TO_Ab
MessageRequester( A$, "Ab", #PB_MessageRequester_Ok)
Case #TO_A
MessageRequester( A$, "A", #PB_MessageRequester_Ok)
Case #TO_Bb
MessageRequester( A$, "Bb", #PB_MessageRequester_Ok)
Case #TO_B
MessageRequester( A$, "B", #PB_MessageRequester_Ok)
EndSelect
EndSelect
Until Event = #PB_Event_CloseWindow
;EndIf
Procedure Exit()
End
EndProcedure
DataSection
imagetest1:
IncludeBinary "E:\DF.jpg"
imagetest2:
IncludeBinary "E:\DA.jpg"
EndDataSection