Je cherche à affecter la police d'un editorgadget.
if LoadFont (0, "Courier New", 10) ;Load Courrier Font, Size 1
SetGadgetFont(#Resultats,FontID(0))
endif
Quelqu'un a t il une solution ?

Merci d'avance !
Code : Tout sélectionner
Procedure boutonImage(num_Img, x, y, w, h, colorFr, ColorTx, titre$, Ft$, hf,typ)
ImgID = CreateImage(num_Img, w, h)
Font=LoadFont(#PB_Any, ft$ , hf, typ)
StartDrawing(ImageOutput(num_Img))
DrawingMode(1)
Box(0, 0, w, h,colorFr)
FrontColor(colorTx)
DrawingFont(FontID(Font))
DrawText(x,y,titre$)
StopDrawing()
ProcedureReturn ImgID
EndProcedure
OpenWindow(0,0,0,220,80,"Bouton Color",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
ButtonImageGadget(1, 50, 10, 110, 40,boutonImage(1,10,8,110,40,RGB(180,250,50),RGB(0,0,0)," BINGO!!","arial",14,#PB_Font_Bold))
Repeat
Event = WindowEvent()
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case 1
Debug "bouton1"
EndSelect
EndSelect
Until event = #PB_Event_CloseWindow
J'ai ajouté votre exemple dans le code exécutable suivant et ça marche sur mon Mac OS X 10.6.8 sans problèmes!Philippe_GEORGES a écrit :Le code suivant fonctionne sur PC mais pas sur Mac :
Je cherche à affecter la police d'un editorgadget.
if LoadFont (0, "Courier New", 10) ;Load Courrier Font, Size 1
SetGadgetFont(#Resultats,FontID(0))
endif
Quelqu'un a t il une solution ?![]()
Code : Tout sélectionner
If OpenWindow(0, 0, 0, 300, 150, "EditorGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
EditorGadget(0, 10, 10, 280, 130)
If LoadFont (0, "Courier New", 10)
SetGadgetFont(0, FontID(0))
EndIf
For i = 1 To 5
AddGadgetItem(0, i, "Ligne "+Str(i))
Next
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Merci pour votre remarque sur mon exemple dans le forum anglais. Mais il fonctionne seulement avec Subsystem Carbon, qui malheureusement n'est plus contenu dans PB 5.20...kernadec a écrit :j'ai trouvé un post de Shardik qui parle de ce problème et propose une solution!
http://www.purebasic.fr/english/viewtop ... 19&t=46961