Page 1 of 1

#PB_Default Constant? [Solved]

Posted: Sun Oct 15, 2023 11:06 am
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?

Re: #PB_Default Constant?

Posted: Sun Oct 15, 2023 11:26 am
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)

Re: #PB_Default Constant?

Posted: Sun Oct 15, 2023 12:12 pm
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?

Re: #PB_Default Constant?

Posted: Sun Oct 15, 2023 12:34 pm
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

Re: #PB_Default Constant?

Posted: Sun Oct 15, 2023 12:40 pm
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

Re: #PB_Default Constant?

Posted: Sun Oct 15, 2023 1:20 pm
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.