Simple EditorGadget toolbar (Solved)

Just starting out? Need help? Post your questions and find answers here.
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Simple EditorGadget toolbar (Solved)

Post 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?

Image
Last edited by Fangbeast on Wed Jan 28, 2009 1:43 pm, edited 1 time in total.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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
I may look like a mule, but I'm not a complete ass.
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4789
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Post by Fangbeast »

Interesting, thank you.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
Post Reply