#PB_Default Constant? [Solved]

Just starting out? Need help? Post your questions and find answers here.
jayand
User
User
Posts: 22
Joined: Sat Mar 04, 2023 12:55 pm

#PB_Default Constant? [Solved]

Post by jayand »

The help file refers to a #PB_Default constant (eg.DrawingFont())
Syntax: DrawingFont(FontID)
Description: Sets the font to be used for text rendering on the current output.
Parameters: FontID The font to be used. The FontID can be easily obtained with the FontID() function from the font library.
To restore the default system font, #PB_Default can be used as FontID.
My searches have failed to turn up any other references to this constant.
Every PB code I have ever seen where this constant has been used fails to compile at the line where it is used.
Is this a genuine in-built constant and how can it be used without a compiler error?
Last edited by jayand on Sun Oct 15, 2023 1:21 pm, edited 1 time in total.
User avatar
mk-soft
Always Here
Always Here
Posts: 6207
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: #PB_Default Constant?

Post by mk-soft »

This is a predefined constant and can also be used for your own functions.

For further use see: https://www.purebasic.com/documentation ... tants.html

Code: Select all

Debug #PB_Default

Procedure foo(var = #PB_Default)
  Debug var
EndProcedure

foo()
foo(100)
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
jayand
User
User
Posts: 22
Joined: Sat Mar 04, 2023 12:55 pm

Re: #PB_Default Constant?

Post by jayand »

Thanks, but a search of that page finds no reference to #PB_Default.
My question should maybe rephrased:
Can DrawingFont(#PB_Default) be used without defining FontID?
BarryG
Addict
Addict
Posts: 4128
Joined: Thu Apr 18, 2019 8:17 am

Re: #PB_Default Constant?

Post by BarryG »

jayand wrote: Sun Oct 15, 2023 12:12 pma search of that page finds no reference to #PB_Default
Image
jayand wrote: Sun Oct 15, 2023 12:12 pmCan DrawingFont(#PB_Default) be used without defining FontID?
Yes -> https://www.purebasic.com/documentation ... gfont.html
SMaag
Enthusiast
Enthusiast
Posts: 303
Joined: Sat Jan 14, 2023 6:55 pm
Location: Bavaria/Germany

Re: #PB_Default Constant?

Post by SMaag »

In the PB IDE
goto Tools\StructureViewer Dropdown Menu

select the Constants TAB select [P]
here you'll find all #PB_ Constants.

#PB_Default = -1
jayand
User
User
Posts: 22
Joined: Sat Mar 04, 2023 12:55 pm

Re: #PB_Default Constant?

Post by jayand »

Hm! Not sure how I missed #PB_Default on that page :shock:. Maybe I need to use another browser.
Thanks folks, after all the years I obviously still have much to learn.
Post Reply