2
0

func_requesters_requestfont.rst 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. .. _func_requesters_requestfont:
  2. ===========
  3. RequestFont
  4. ===========
  5. RequestFont -
  6. Description
  7. ===========
  8. .. code-block:: blitzmax
  9. RequestFont:TGuiFont(font:TGuiFont=Null)
  10. Prompts the user to select a system font.
  11. Prompts the user for a font and returns an object that can be used with the #SetGadgetFont command.
  12. See Also: #LoadGuiFont, #LookupGuiFont, #FontName, #FontSize and #FontStyle
  13. Parameters
  14. ==========
  15. Return Values
  16. =============
  17. A @TGuiFont object, or #Null if no font was selected.
  18. Examples
  19. ========
  20. .. code-block:: blitzmax
  21. ' requestfont.bmx
  22. Import MaxGui.Drivers
  23. Strict
  24. Local window:TGadget
  25. Local button:TGadget
  26. Local label:TGadget
  27. Local font:TGuiFont
  28. window=CreateWindow("RequestFont",30,20,200,250)
  29. label=CreateLabel("font example",4,4,192,132,window)
  30. button=CreateButton("Select Font",4,140,100,20,window)
  31. While WaitEvent()
  32. Select EventID()
  33. Case EVENT_WINDOWCLOSE
  34. End
  35. Case EVENT_GADGETACTION
  36. font=RequestFont(font)
  37. If font
  38. SetGadgetFont label,font
  39. SetGadgetText label,FontName(font)+":"+FontSize(font)
  40. EndIf
  41. End Select
  42. Wend
  43. See Also
  44. ========