While the program is running:
When the user answer the font requester, the first ListIconGadget contents and heading area change to the requested fonts but the second ListIconGadget only changes the heading font but not the contents???. All other gadgets change correctly.
When the program starts up:
Last user chosen font is read (from a database table) and all gadgets change correctly!
How on earth can just the heading font change in a ListIconGadget and not the contents? The exact same code is used to do it during running time and startup.
Code: Select all
; Change the user's choice of program font
Global Programfontname.s = "Comic Sans MS"
Global Programfontsize.i = 9
Global IsFontLoaded.i
Procedure ChangeProgramFont()
IsFontSelected.i = FontRequester(Programfontname.s, Programfontsize.i, #Null)
If IsFontSelected.i
Programfontname.s = SelectedFontName()
Programfontsize.i = SelectedFontSize()
If Programfontsize.i > 9
Programfontsize.i = 9
EndIf
IsFontLoaded = LoadFont(#PB_Any, Programfontname.s, Programfontsize.i, #PB_Font_HighQuality)
If IsFontLoaded
EnumChildWindows_(WindowID(#Window_MyStuff), @ChangeAllFonts(), 0)
Else
MessageRequester("Display font load error", "No new font loded, unknown problem ocurred.", #MB_ICONERROR)
EndIf
Else
MessageRequester("Display font selection", "No new font selected, user cancelled.", #MB_ICONWARNING)
EndIf
EndProcedure
; Change to the user selected fonts on all gadgets and windows
Procedure ChangeAllFonts(ControlHandle, ControlParameter)
SendMessage_(ControlHandle, #WM_SETFONT, FontID(IsFontLoaded), 0)
InvalidateRect_(ControlHandle, 0, #True)
ProcedureReturn #True
EndProcedure