Page 1 sur 1

ContainerGadget

Publié : mar. 08/janv./2019 20:32
par omega
Bonsoir à tous

Je ne comprends pas pourquoi le containerGadget ne s'affiche pas comme prévu. Ci-dessous, la partie du code simplifié pour vous faciliter la lecture.
Merci de m'éclairer

Code : Tout sélectionner

Enumeration
#WinMenu

#Conteneur
  #bouletable
  #linktable
  
  #boulestock
  #linkstock
  
  #boulefb
  #linkfb
  
  #boulebc
  #linkbc
  
  #bouletres
  #linktres
  
  #bouleJl
  #linkJl
  
  #bouletool
  #linktool
  
  #bouleexit
  #linkexit
  
EndEnumeration


UseJPEGImageDecoder()

;C'est une petite boule qui apparait à gauche du texte de chaque lien du menu....
 
catchImage(10, ?imgboule)

DataSection
imgboule:
IncludeBinary "images/boule.jpg"
EndDataSection

ExitMenu=0
ExamineDesktops()
Wlargeur=DesktopWidth(0)
Whauteur=DesktopHeight(0)
OpenWindow(#WinMenu, 0,0, Wlargeur, Whauteur, "test conteneur",#PB_Window_SystemMenu |#PB_Window_ScreenCentered | #PB_Window_TitleBar |#PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget)
SetWindowColor(#WinMenu,RGB(255, 255, 255))
If CreateMenu(0, WindowID(#WinMenu))
   MenuItem( 01, "rien")
   MenuItem( 99, "Fin de session")
EndIf

wcol=20 : wtop=100
ContainerGadget(#Conteneur, 10,wtop,200,500, #PB_Container_Flat) 
SetGadgetColor(#Conteneur,#PB_Gadget_BackColor,RGB(2, 2,2))      
wtop=wtop+20
ImageGadget(#BouleTable,wcol,wtop,0,0,ImageID(10))
HyperLinkGadget(#LinkTable,wcol+30, wtop,130,40,"Tables", RGB(255,255,255), #PB_Font_Underline)
SetGadgetColor(#LinkTable,#PB_Gadget_FrontColor,RGB(240, 169, 111))      
SetGadgetFont(#LinkTable,FontID(21))
wtop=wtop+40
ImageGadget(#Boulestock,wcol,wtop,0,0,ImageID(10))
HyperLinkGadget(#Linkstock,wcol+30, wtop,130,40,"Stock", RGB(255,255,255), #PB_Font_Underline)
SetGadgetColor(#Linkstock,#PB_Gadget_FrontColor,RGB(240, 169, 111))      
SetGadgetFont(#Linkstock,FontID(21))
wtop=wtop+40
ImageGadget(#Boulefb,wcol,wtop,0,0,ImageID(10))
HyperLinkGadget(#Linkfb,wcol+30, wtop,130,40,"Fiches brigades", RGB(255,255,255), #PB_Font_Underline)
SetGadgetColor(#Linkfb,#PB_Gadget_FrontColor,RGB(240, 169, 111))      
SetGadgetFont(#Linkfb,FontID(21))
wtop=wtop+40
ImageGadget(#Boulebc,wcol,wtop,0,0,ImageID(10))
HyperLinkGadget(#Linkbc,wcol+30, wtop,130,40,"Bons de commande", RGB(255,255,255), #PB_Font_Underline)
SetGadgetColor(#Linkbc,#PB_Gadget_FrontColor,RGB(240, 169, 111))      
SetGadgetFont(#Linkbc,FontID(21))
wtop=wtop+40
ImageGadget(#Bouletres,wcol,wtop,0,0,ImageID(10))
HyperLinkGadget(#Linktres,wcol+30, wtop,130,40,"Trésorerie", RGB(255,255,255), #PB_Font_Underline)
SetGadgetColor(#Linktres,#PB_Gadget_FrontColor,RGB(240, 169, 111))      
SetGadgetFont(#Linktres,FontID(21))
wtop=wtop+40
ImageGadget(#BouleJl,wcol,wtop,0,0,ImageID(10))
HyperLinkGadget(#LinkJl,wcol+30, wtop,130,40,"Journaux", RGB(255,255,255), #PB_Font_Underline)
SetGadgetColor(#LinkJl,#PB_Gadget_FrontColor,RGB(240, 169, 111))      
SetGadgetFont(#LinkJl,FontID(21))
wtop=wtop+40
ImageGadget(#Bouletool,wcol,wtop,0,0,ImageID(10))
HyperLinkGadget(#Linktool,wcol+30, wtop,130,40,"Utilitaires", RGB(255,255,255), #PB_Font_Underline)
SetGadgetColor(#Linktool,#PB_Gadget_FrontColor,RGB(240, 169, 111))      
SetGadgetFont(#Linktool,FontID(21))
wtop=wtop+40
ImageGadget(#BouleExit,wcol,wtop,0,0,ImageID(10))
HyperLinkGadget(#LinkExit,wcol+30, wtop,130,40,"Sortie", RGB(255,255,255), #PB_Font_Underline)
SetGadgetColor(#LinkExit,#PB_Gadget_FrontColor,RGB(240, 169, 111))      
SetGadgetFont(#LinkExit,FontID(21))
CloseGadgetList() 

ExitMenu=0

Repeat

EventId=WaitWindowEvent()
If EventID = #PB_Event_CloseWindow
   CloseWindow(#WinMenu) 
   ExitMenu=1
EndIf

Until  ExitMenu=1
End

Re: ContainerGadget

Publié : mar. 08/janv./2019 23:35
par Ar-S
Vu qu'il manque les fonts et surtout les images je vais dire ça comme ça.
Ton ContainerGadget s'affiche comme il faut, c'est à dire à 10px du bord gauche et 100 px du haut (le wtop=100). Il fait bien 200x500
En gros tout ce que tu as inscrit. C'est quoi ton soucis ? parce que sans les fichiers datas je n'ai pas de soucis d'affichage.

Re: ContainerGadget

Publié : mer. 09/janv./2019 10:09
par Marc56
Pas vu de problème non plus dans cette partie de code.

Ne pas oublier que le container est un ensemble d'objets, et qu'il faut donc indiquer au programme quel ensemble doit être utilisé lors d'une action, cela veut dire utiliser: UseGadgetList() CloseGadgetList() OpenGadgetList() car des objets peuvent parfois de recouvrir.

:wink:

Edit: "car des objets peuvent parfois se recouvrir."

Re: ContainerGadget

Publié : mer. 09/janv./2019 15:03
par Ar-S
Marc56 a écrit :car des objets peuvent parfois de recouvrir.
Je viens de perdre 4250 neuronnes, tu peux corriger :)