Page 1 sur 1
question sur les fonts et Global
Publié : ven. 24/juin/2005 16:20
par bernard13
bonsoir
juste une petite question
quand on charge une font
avec Global
dois t'on imperativement mettre la fonte la moins grosse en premier
exemple je veux mettre un texte en font 12
et un stringgadget en font 11
donc faut'il mettre la fonte de 11 en premier
puis celle de 12 apres ?
merci
Publié : ven. 24/juin/2005 19:52
par Le Soldat Inconnu
pas saisi ....
Il n'y a pas d'ordre pour déclarer les Font, on s'en moque totalement, le tout, c'est quel soit créer avant que est besion de les utiliser
Publié : ven. 24/juin/2005 21:41
par bernard13
essaye ceci :
Code : Tout sélectionner
si tu change la taille de la font 1 ca bug
par contre la font 2 marche
alors Régis tu peux m'expliquer ce bug ?
Enumeration
#w1
EndEnumeration
Enumeration
#text_1
#text_2
EndEnumeration
Global FontId1
FontId1=LoadFont(FontId1,"Arial",12,#pb_font_bold)
Global FontId2
FontId2=LoadFont(FontId2,"Arial",11,#pb_font_bold)
Procedure ww()
If OpenWindow(#w1,0,0,450,250,#pb_window_systemmenu|#pb_window_titlebar|#pb_window_screencentered,"exemple")
If CreateGadgetList(WindowID())
TextGadget(#text_1,160,50,130,25,"arial 12 : " ,#pb_text_center)
SetGadgetFont(#text_1,fontId1)
TextGadget(#text_2,160,100,130,25,"arial 11 : " ,#pb_text_center)
SetGadgetFont(#text_2,fontId2)
EndIf
EndIf
EndProcedure
ww()
Repeat
Select WaitWindowEvent()
Case #pb_event_closewindow
fermer=1
EndSelect
Until fermer=1
End
Publié : ven. 24/juin/2005 21:53
par Droopy
Tu gère mal LoadFont
voici la correction
Code : Tout sélectionner
Global FontId1
FontId1=LoadFont(#text_1,"Arial",12,#PB_Font_Bold)
Global FontId2
FontId2=LoadFont(#text_2,"Arial",11,#PB_Font_Bold)
Publié : ven. 24/juin/2005 22:27
par Le Soldat Inconnu
Code : Tout sélectionner
Global FontId1
FontId1=LoadFont(FontId1,"Arial",12,#pb_font_bold)
Global FontId2
FontId2=LoadFont(FontId2,"Arial",11,#pb_font_bold)
regarde, tu mets une variable global à la place de l'identifiant de la police.
Comme il n'y a pas de valeur dans fontId1 et FontID2 quand tu fait loadFont, c'est comme si tu avais ceci :
Code : Tout sélectionner
Global FontId1
FontId1=LoadFont(0,"Arial",12,#pb_font_bold)
Global FontId2
FontId2=LoadFont(0,"Arial",11,#pb_font_bold)
Donc tu charges 2 fois une police d'itenfiant 0
Soit tu utilises #PB_Any
Code : Tout sélectionner
Global FontId1
FontId1=LoadFont(#PB_Any,"Arial",12,#pb_font_bold)
Global FontId2
FontId2=LoadFont(#PB_Any,"Arial",11,#pb_font_bold)
Soit une constante pour chaque font
Code : Tout sélectionner
Enumeration
#Font1
#Font2
EndEnumeration
Global FontId1
FontId1=LoadFont(#Font1,"Arial",12,#pb_font_bold)
Global FontId2
FontId2=LoadFont(#Font2,"Arial",11,#pb_font_bold)
Publié : sam. 25/juin/2005 7:50
par bernard13
merci regis
mais ca pas marche
j'ai beau changer la taille de la fonte
ca marche pas
Publié : sam. 25/juin/2005 7:52
par bernard13
c'est curieux
que FontId2 ca marche
mais pas fontid1
Publié : sam. 25/juin/2005 9:15
par Torp
Argh!
Publié : sam. 25/juin/2005 9:58
par bernard13
peux tu m'aider Torp svp
comment tu fais toi pour charger er utiliser des FontS?
Publié : sam. 25/juin/2005 13:43
par Torp
LSI te l'a montré juste au dessus !
Publié : sam. 25/juin/2005 15:41
par bernard13
oui mais ça marche pas
et j'ai remarquer le fichier d'exemple appeller
font.pb ne marche pas , on vois la fenetre et pas les fonts
j'ai tester sur 3pc different et c'est le meme probleme
Publié : sam. 25/juin/2005 22:54
par Le Soldat Inconnu
Code : Tout sélectionner
Enumeration
; Window
#w1
; Gadget
#text_1
#text_2
; Font
#Font1
#Font2
EndEnumeration
Global FontId1, FontId2
FontId1 = LoadFont(#Font1, "Arial", 14, #PB_Font_Bold)
FontId2 = LoadFont(#Font2, "Arial", 11, #PB_Font_Bold)
Procedure ww()
If OpenWindow(#w1, 0, 0, 450, 250, #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered, "exemple")
If CreateGadgetList(WindowID())
TextGadget(#text_1, 160, 50, 130, 25, "arial 12 : ", #PB_Text_Center)
SetGadgetFont(#text_1, FontId1)
TextGadget(#text_2, 160, 100, 130, 25, "arial 11 : ", #PB_Text_Center)
SetGadgetFont(#text_2, FontId2)
EndIf
EndIf
EndProcedure
ww()
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
fermer = 1
EndSelect
Until fermer = 1
End
Publié : dim. 26/juin/2005 7:36
par bernard13
merci régis
j'ai passer des heures a chercher une solution
merci
Publié : dim. 26/juin/2005 10:45
par gansta93
Pourtant, à peu de choses près, c la même chose qu'il postait comme code...
Publié : lun. 27/juin/2005 7:42
par Jacobus
Pourtant, à peu de choses près, c la même chose qu'il postait comme code...
C'est bien souvent là qu'est toute la différence.
#FontID1 et
FontID1 c'est pas vraiment la même chose...