Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Karben Selim Mejia
  Where is Karben Selim Mejia?
 San Pedro Sula
 Honduras
 Karben Selim Mejia
 To: Erik Gomez
  Where is Erik Gomez?
 Victorias City, Negros Occidental
 Philippines
 Erik Gomez
 Tags
Subject: THERE'S NOTHING IMPOSSIBLE FOR FOXPRO!!!
Thread ID: 15874 Message ID: 15947 # Views: 3 # Ratings: 0
Version: Unknown Category: General VFP Topics
Date: Friday, October 04, 2002 5:37:22 PM         
   


> > > Have you guy seen that when you want to change the font of a specific part of the text you just have to select it and then go to the nice combobox wich contains all the fonts name and the preview of'em?
> > > Is there any way to do this in VFP?
> > >
> > > Hopefully there is
> > >
> > > Karben Selim Mejia (Mejiaks)
> > >
> > > I used to think that my life was complete. it was until my (by now) Two-years-old child was born that I realized how wrong I was!
> > > Honduras, Central America
> > > The very center of the world
> >
> > GETFONT()
> >
> > Cheers,
> > Jamie
> > jamie.osborn@foxite.com
> hi karben,
>
> it may be impossible in VFP to have differnt fonts for different items in a combobox. but surely you can get all the fonts installed in your pc with the afont() and a select font window with fontsize, font style and preview using the getfont() as jamie suggested.
>
> regards,
> Erik Gomez
> Long Live www.foxite.com

Hi Erick, you know?, when you used the word "impossible" I just dont want to accept the use of such a word for FOX, so I kept on searching and finally I Found the answer and, as i used to say, "The more we share, the more we learn" i want to share what I learned trough this

I wanted a Combo box with all the fonts with the preview of each one of them, I search the web for the answer a whole day long, found some activeX but you know I don't Like them ($$$$) besides I want it to do it by pure FOX, i also found some Visual Basic code and I tried to conver it to Fox with out succeed. And finally the answer came to my mind when I was heading to my home
It was so simple that i felt mad at me, because the time I spent searching for the answer. I was kind da upset towards the forum too, because i thought "the guys in the forum should know this, why they didn't" but I thought that nobody knows everything either, and everyone of us are learning and that I shouldn't be upset about it, I must share what I learned.

And that is exactly what I want to do here. the reason why i needed to learn this it is because I was working in a tool bar to manipulate the rich text control, to help the programmers work with this control without programing anything. Hopefully it will be available in the download section pretty soon if eric considers that it is good enought.

here is the code containing the answer to my question, please try it

frmMyForm = CREATEOBJECT('Form')  && Create a Form
frmMyForm.Closable = .F.  && Disable the Control menu box 
frmMyForm.autocenter = .t.

frmMyForm.AddObject('MyFontSelector', 'cboFontSelectorWithPreview')  
frmMyForm.MyFontSelector.Visible =.T.  

frmMyForm.AddObject('cmdSalir', 'botondesalir')  
frmMyForm.cmdSalir.Visible =.T.  

frmMyForm.SHOW  && Display the form
READ EVENTS  && Start event processing

DEFINE CLASS cboFontSelectorWithPreview AS COMBOBOX  
   Left = 50  	
   Top = 10  	
   Height = 25  
   width  =300
   
   PROCEDURE init
   		=AFONT(_Fonts)
   		_HowManyFonts = ALEN(_Fonts)
   		*:defining the popup to use as rowsource
   		DEFINE POPUP pFonts
   		*:defining the bar with the font preview
   		FOR _N = 1 TO _HowManyFonts 
   			DEFINE BAR _N OF pFonts PROMPT ALLTRIM(_fonts(_N)) FONT ALLTRIM(_fonts(_N))
   		ENDFOR
		This.RowSourceType 	= 9
		This.RowSource 		= "pFonts"   		
   		This.listindex = 1
		
   PROCEDURE Click
      This.FontName = This.Value  
ENDDEFINE

DEFINE CLASS botondesalir as CommandButton 
	left = 150
	top = 210
    Height = 30
	caption ="Exit"
	PROCEDURE click
		MESSAGEBOX("NEVER say IMPOSIBLE when using FOX!!!")
		CLEAR EVENTS 
		thisform.release
ENDDEFINE


your friend

Karben Selim Mejia (Mejiaks)

I used to think that my life was complete. it was until my (by now) Two-years-old child was born that I realized how wrong I was!
Honduras, Central America
The very center of the world

ENTIRE THREAD

Font Combobox in MS Word 2000 Posted by Karben Selim Mejia @ 10/2/2002 6:39:47 PM
RE: Font Combobox in MS Word 2000 Posted by Jamie Osborn @ 10/3/2002 1:24:27 AM
RE: Font Combobox in MS Word 2000 Posted by Erik Gomez @ 10/3/2002 3:05:49 AM
THERE'S NOTHING IMPOSSIBLE FOR FOXPRO!!! Posted by Karben Selim Mejia @ 10/4/2002 5:37:22 PM
Good and easy code, should be in FAQ Posted by Luis Navas @ 10/4/2002 11:31:36 PM
RE: Good and easy code, should be in FAQ Posted by Erik Gomez @ 10/5/2002 7:02:17 AM
RE: Good and easy code, should be in FAQ Posted by Erik Gomez @ 10/5/2002 7:06:03 AM
RE: Good and easy code, should be in FAQ Posted by Boudewijn Lutgerink @ 10/5/2002 8:08:25 AM
RE: Good and easy code, should be in FAQ Posted by Karben Selim Mejia @ 10/5/2002 4:19:14 PM