How do you set the default font style in a font requester?
Result = FontRequester(FontName$, FontSize, Flags [, Color])
There appears to be nowhere to set it as Flags is used for something else.
Any ideas?
-Anthony
Font Style...
- DoubleDutch
- Addict
- Posts: 3220
- Joined: Thu Aug 07, 2003 7:01 pm
- Location: United Kingdom
- Contact:
Font Style...
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
https://reportcomplete.com <- School end of term reports system
Code: Select all
Result = FontRequester("arial", 12, #PB_FontRequester_Effects , #red)
- DoubleDutch
- Addict
- Posts: 3220
- Joined: Thu Aug 07, 2003 7:01 pm
- Location: United Kingdom
- Contact:
Einhander: Thanks for the reply, but no. 
Trond: Yep, thats what I'm after!
Also, how do you get the results from the #PB_FontRequester_Effects, such as underline and strikeout?

Trond: Yep, thats what I'm after!

Also, how do you get the results from the #PB_FontRequester_Effects, such as underline and strikeout?
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
https://reportcomplete.com <- School end of term reports system
I am guessing that the Purebasic FontRequester() command is just a wrapper for the API Choosefont_() function which certainly allows you to achieve your desired results.
However, without direct access to the underlying 'CHOOSEFONT' structure, it would seem that you cannot do what you're after with the PB command.
Here is a simple example of using the Choosefont_() function in which I select the default colour to be red and also select the strikeout option as default. The results of the users choices are returned within the choosefont structure. Sorry I haven't time for a more in depth example.
Regards.
However, without direct access to the underlying 'CHOOSEFONT' structure, it would seem that you cannot do what you're after with the PB command.
Here is a simple example of using the Choosefont_() function in which I select the default colour to be red and also select the strikeout option as default. The results of the users choices are returned within the choosefont structure. Sorry I haven't time for a more in depth example.
Code: Select all
;Choose font common dialogue with default colours etc.
loadfont(1,"Arial", 16, #PB_Font_Bold|#PB_Font_Italic)
cf.CHOOSEFONT
lf.LOGFONT
GetObject_(usefont(1), SizeOf(lf), @lf)
lf\lfStrikeOut = #TRUE
cf\lStructSize = SizeOf(cf)
cf\lpLogFont = @lf
cf\Flags = #CF_INITTOLOGFONTSTRUCT | #CF_SCREENFONTS | #CF_EFFECTS
cf\rgbColors = #Red
choosefont_(@cf)
I may look like a mule, but I'm not a complete ass.
- DoubleDutch
- Addict
- Posts: 3220
- Joined: Thu Aug 07, 2003 7:01 pm
- Location: United Kingdom
- Contact:
Thats really good, thanks 
Fred:Pity the commands aren't native to PB...

Fred:Pity the commands aren't native to PB...
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
https://reportcomplete.com <- School end of term reports system
What's wrong with -
Works for me,
MikeB
Code: Select all
MyFont=LoadFont(0,"arial black",10,#PB_Font_Underline)
MyWin = OpenWindow(0,200,200,200,50,#PB_Window_SystemMenu,"")
CreateGadgetList(MyWin)
MyGad=StringGadget(0,10,10,180,25,"Type something")
SetGadgetFont(0,MyFont)
MikeB
DoubleDutch's request was not for simply setting font styles etc. more a case of wanting to display to the user a more flexible 'FontRequester' so that the user could select the font styles etc.
Unfortunately, the PB implementation of the Font chooser common dialogue does not give us total control over the said common control. E.g. setting default styles and colours.
Unfortunately, the PB implementation of the Font chooser common dialogue does not give us total control over the said common control. E.g. setting default styles and colours.
I may look like a mule, but I'm not a complete ass.