Page 1 of 1

Font Requester - name and size only

Posted: Sat Feb 28, 2009 5:25 pm
by rsts
I would like to offer a font selector that only permits selection of fontname and size. Just a way to allow a default font selection and I would prefer they not be picking bold, underline, etc.

Is this possible without completely building my own? I've searched msdn but have not seen any combination of options that would accomplish this.

cheers

Posted: Sat Feb 28, 2009 8:53 pm
by Sparkie
Testted and working on XP.

Code: Select all

Procedure CFHookProc(hwnd, msg, wParam, lParam)
  ;- disable style combo
  hStyle = GetDlgItem_(hwnd, 1137)
  EnableWindow_(hStyle, 0)
  ;- Return 0 to process msg
  ;- Return 1 to ignore msg
  ProcedureReturn  0
EndProcedure
hdc = CreateDC_(@"DISPLAY", 0, 0, 0) 
logPixSY = GetDeviceCaps_(hdc, #LOGPIXELSY) 
DeleteDC_(hdc) 

cf.CHOOSEFONT
cf\lStructSize = SizeOf(cf) 

lf.LOGFONT 
;- Default font size
pointSize = 12
lf\lfHeight = (pointSize * logPixSY) / 72

;- Default font
FontName$ = "Courier New"
CopyMemory(@FontName$, @lf\lfFaceName, Len(FontName$))

cf\flags = #CF_INITTOLOGFONTSTRUCT | #CF_SCREENFONTS | #CF_ENABLEHOOK | #CF_USESTYLE

;- HookProc to disable choosing of styles
cf\lpfnHook = @CFHookProc()

;- lf.LOGFONT contains default font properties
cf\lpLogFont = @lf 

;- Get language text for various styles
hLib = OpenLibrary(0, "comdlg32.dll")
style$ = Space(260)

;- Regular
LoadString_(hLib, 1284, @style$, 64)

;- Bold
;LoadString_(hLib, 1285, @style$, 64)

;- Italic
;LoadString_(hLib, 1286, @style$, 64)

;- Bold Italic
;LoadString_(hLib, 1287, @style$, 64)

;-(none)
;LoadString_(hLib, 1288, @style$, 64)
CloseLibrary(0)

cf\lpszStyle = @style$


If ChooseFont_(@cf) 
  MessageRequester("Font chosen:", "Name: " + PeekS(@lf\lfFaceName) + #CRLF$ + "Size: " + Str(cf\iPointSize/10) + #CRLF$ + "Style: "  + style$, #PB_MessageRequester_Ok | #MB_ICONINFORMATION)
EndIf


Posted: Sat Feb 28, 2009 9:04 pm
by srod
Nice one Sparks. :)

Posted: Sun Mar 01, 2009 12:50 am
by rsts
Never ceases to amaze me.

Now I have to explain to my partner, why I'm doing it when I had just told him it was impossible due to a windows limitation :)

I'll see if I can get kwai to send you a rose (or whatever).

(works on vista too)

Posted: Sun Mar 01, 2009 1:07 am
by Kwai chang caine
Somebody call KCC SHIPMENT 24/24 hours at your service !!! :D

It's a little bit to late for the shipment of a rose :cry:
But KCC have always a good solution for his hero SPARKIE

KCC have found that

Image

Yes i know i know......it's not a rose :?
But this tongs is pink no ???? :roll:

And my hero is surelly very nice with this great shoes :D
I say at everybody that my hero know all to do, it's for that, that is the KCC hero 8)
And like all the true and great hero, he have a very good and devoted assistant, who be always behind him, i have nominate KCCSKIE.
It's a mystery, but nobody know who is he ???? because he is hidden behind a mask :?

Image

Perhaps a day KCCSKIE take off his mask ????
Surelly the day where his hero take off it too :D

Posted: Sun Mar 01, 2009 1:09 am
by rsts
umm - i leave that between you and sparkie. Have fun.

:D

I'm sure sparkie will LOVE the slippers.

Posted: Sun Mar 01, 2009 2:13 am
by Fluid Byte
Hello Kitty FTW or what?

Posted: Sun Mar 01, 2009 4:06 pm
by Kwai chang caine
Ayaaaai !!!! it's the day, it's good !!!!! ...the shop is open in france at this time :D
And a client is a client....and KCC don't want loose any client :?

Then KCC SHIPMENT 24/24 hours at your service, have run everywhere, and found the real command for his client.
And i'm sure that this time.....SPARKIE been proud of his devoted assistant

Image

If you have another command.....don't forget.... one name only :
KCC SHIPMENT 24/24 hours at your service :D

Posted: Sun Mar 01, 2009 4:13 pm
by Kwai chang caine
Kind FLUID BYTE wrote:Hello Kitty FTW or what?
KCC SHIPMENT 24/24 hours at your service

No problem !!!!!
For my dear FLUID BYTE also

Image

Posted: Sun Mar 01, 2009 5:00 pm
by Sparkie
KCC, I'm proud to have you as my assistant but the pink footwear has got to go. :shock: Maybe something in bat black would be more of a fashion statement. :wink:

Posted: Sun Mar 01, 2009 6:12 pm
by Kwai chang caine
KCC, I'm proud to have you as my assistant
Thank you very much, this is one of the more good day of my life 8)

I have at last, find somebody who want me in assistant :oops:
This sentence proof another time, that you are not only great for the knowledge....but also for the heart 8)
Don't worry....KCC have do all that is possible, for serve his master, for that, always my hero, as proud of the little KCC :D
Maybe something in bat black would be more of a fashion statement
Yes you are right, but i had an imperative, remember you the sentence of rsts
rsts wrote:I'll see if I can get kwai to send you a rose

And i don't know if you know that, but in france a rose it's the same word that the color pink (Rose the color = Rose the flower)
So when rsts call KCC SHIPMENT 24/24 hours at your service then it's to late for shopping because all the flower shop in france is closed :cry:
Then KCC have an idea :D offer like rsts want an object "Rose" so "pink"
This is the explain of this story :D

But don't worry....you don't put this shoes for do your dangerous mission of BATMAN.....no no no :roll:
And surelly the spectator of movie laugh if he see the pink shoes replace the black boots :lol:
And KCC don't want the spectator jeer of his hero :?
It's just when you are in your home or in vacancy with your nice dog :D
Oh... i have forgotten the other day to ask you, the name of your devoted assistant at four foot ??? :roll:
This mines is "PERLE" and "SOURIS" in english it's "PEARL" and "MOUSE".
But she don't know the english, if you call her like this "PEARL" and "MOUSE" perhaps she are unnerve :lol: