Page 1 of 1
Simple EditorGadget toolbar (Solved)
Posted: Fri Jan 09, 2009 1:13 pm
by Fangbeast
Has anyone done a toolbar similar to this for anything? I just wanted to add a few simple effects to an editorgadget, not turn it into a full notepad or anything complex like that.
I can manage the code to create the effects from the returned values but don't know how to create a toolbar like this. And I'd assume that the font size values were gathered from the font itself and not arbitrary?

Posted: Fri Jan 09, 2009 1:51 pm
by srod
Code by FluidByte should get you started :
Code: Select all
OpenWindow(0,0,0,320,240,"EnumFonts",#WS_OVERLAPPEDWINDOW | 1)
CreateGadgetList(WindowID(0))
ComboBoxGadget(0,10,10,250,400,#CBS_SORT)
Global NewList FaceName.s()
Procedure EnumFontFamExProc(*lpelfe.ENUMLOGFONTEX,*lpntme.NEWTEXTMETRICEX,FontType,lParam)
FaceName$ = PeekS(@*lpelfe\elfFullName)
Select FontType
Case #TRUETYPE_FONTTYPE
Type$ + " [TT]"
EndSelect
ForEach FaceName()
If FaceName() = FaceName$ + Type$ : Goto SkipFont : EndIf
Next
AddElement(FaceName())
FaceName() = FaceName$ + Type$ : Type$ = ""
SkipFont:
ProcedureReturn #True
EndProcedure
lf.LOGFONT
lf\lfCharset = #DEFAULT_CHARSET
hdc = GetDC_(WindowID(0))
EnumFontFamiliesEx_(hdc,lf,@EnumFontFamExProc(),0,0)
ReleaseDC_(WindowID(0),hdc)
ForEach FaceName()
SendMessage_(GadgetID(0),#CB_ADDSTRING,0,FaceName())
Next
SetGadgetState(0,0)
While WaitWindowEvent() ! #PB_Event_CloseWindow : Wend
Posted: Fri Jan 09, 2009 2:16 pm
by Fangbeast
Interesting, thank you.