Vous débutez et vous avez besoin d'aide ? N'hésitez pas à poser vos questions
Mesa
Messages : 1126 Inscription : mer. 14/sept./2011 16:59
Message
par Mesa » ven. 18/oct./2013 16:58
J'ai l'impression qu'on ne peut pas changer de font dans un Dialog, me trompe-je ?
Code : Tout sélectionner
CompilerIf #PB_Compiler_Unicode
#XmlEncoding = #PB_UTF8
CompilerElse
#XmlEncoding = #PB_Ascii
CompilerEndIf
#Dialog = 0
#Xml = 0
XML$ = "<window id='#PB_Any' name='test' text='test' minwidth='auto' minheight='auto' flags='#PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_SizeGadget'>" +
" <panel>" +
" <tab text='Premier Onglet'>" +
" <vbox expand='item:2'>" +
" <hbox>" +
" <button name='but1' text='Bouton 1'/>" +
" <checkbox name='check1' text='Case à cocher 1'/>" +
" <button name='but2' text='Bouton 2'/>" +
" </hbox>" +
" <editor text='Contenu...' height='150'/>" +
" </vbox>" +
" </tab>" +
" </panel>" +
"</window>"
If CatchXML(#Xml, @XML$, StringByteLength(XML$), 0, #XmlEncoding) And XMLStatus(#Xml) = #PB_XML_Success
If CreateDialog(#Dialog) And OpenXMLDialog(#Dialog, #Xml, "test")
If LoadFont(1, "Arial", 24, #PB_Font_HighQuality)
SetGadgetFont(DialogGadget(#Dialog, "but1"), FontID(1))
;SetGadgetText(DialogGadget(#Dialog, "but1"), "azerty")
EndIf
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
Else
Debug "Erreur de la bibliothèque -Dialog- : " + DialogError(#Dialog)
EndIf
Else
Debug "Erreur XML : " + XMLError(#Xml) + " (Ligne: " + XMLErrorLine(#Xml) + ")"
EndIf
Mesa
falsam
Messages : 7321 Inscription : dim. 22/août/2010 15:24
Localisation : IDF (Yvelines)
Contact :
Message
par falsam » ven. 18/oct./2013 18:18
Pour moi ça fonctionne. Le bouton "but1" apparaît bien avec la police indiquée. Faut juste agrandir un peu le bouton.
Configuration : Windows 11 Famille 64-bit - PB 6.20 x64 - AMD Ryzen 7 - 16 GO RAM
Vidéo NVIDIA GeForce GTX 1650 Ti - Résolution 1920x1080 - Mise à l'échelle 125%
Micoute
Messages : 2583 Inscription : dim. 02/oct./2011 16:17
Localisation : 35520 La Mézière
Message
par Micoute » ven. 18/oct./2013 19:20
C'est exactement ce que j'ai fait, voici le code:
Code : Tout sélectionner
CompilerIf #PB_Compiler_Unicode
#XmlEncoding = #PB_UTF8
CompilerElse
#XmlEncoding = #PB_Ascii
CompilerEndIf
#Dialog = 0
#Xml = 0
XML$ = "<window id='#PB_Any' name='test' text='test' minwidth='auto' minheight='auto' flags='#PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_SizeGadget'>" +
" <panel>" +
" <tab text='Premier Onglet'>" +
" <vbox expand='item:2'>" +
" <hbox>" +
" <button name='but1' text='Bouton 1' width= '140' height='40'/>" +
" <checkbox name='check1' text='Case à cocher 1'/>" +
" <button name='but2' text='Bouton 2'/>" +
" </hbox>" +
" <editor text='Contenu...' height='150'/>" +
" </vbox>" +
" </tab>" +
" </panel>" +
"</window>"
If CatchXML(#Xml, @XML$, StringByteLength(XML$), 0, #XmlEncoding) And XMLStatus(#Xml) = #PB_XML_Success
If CreateDialog(#Dialog) And OpenXMLDialog(#Dialog, #Xml, "test")
If LoadFont(1, "Arial", 24, #PB_Font_HighQuality)
SetGadgetFont(DialogGadget(#Dialog, "but1"), FontID(1))
;SetGadgetText(DialogGadget(#Dialog, "but1"), "azerty")
EndIf
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
Else
Debug "Erreur de la bibliothèque -Dialog- : " + DialogError(#Dialog)
EndIf
Else
Debug "Erreur XML : " + XMLError(#Xml) + " (Ligne: " + XMLErrorLine(#Xml) + ")"
EndIf
Merci pour le partage.
Microsoft Windows 10 Famille 64 bits : Carte mère : ASRock 970 Extreme3 R2.0 : Carte Graphique NVIDIA GeForce RTX 3080 : Processeur AMD FX 6300 6 cœurs 12 threads 3,50 GHz PB 6.20 LTS (x64)
Un homme doit être poli, mais il doit aussi être libre !
Backup
Messages : 14526 Inscription : lun. 26/avr./2004 0:40
Message
par Backup » ven. 18/oct./2013 19:42
c'est moi ou "OpenXMLDialog(#Dialog, #Xml, "test")" n'apparait pas dans la Doc ?
kernadec
Messages : 1606 Inscription : ven. 25/avr./2008 11:14
Message
par kernadec » ven. 18/oct./2013 20:33
bonsoir
il est dans la doc onglet "dialog"
cordialement