Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Brad SanMarie
  Where is Brad SanMarie?
 
 California - United States
 Brad SanMarie
 To: Don Higgins
  Where is Don Higgins?
 Peoria
 Illinois - United States
 Don Higgins
 Tags
Subject: RE: Do you give your users font options?
Thread ID: 247420 Message ID: 248747 # Views: 1 # Ratings: 0
Version: Visual FoxPro 9 Category: Forms
Date: Tuesday, December 22, 2009 9:51:21 PM         
   


> Let the customer decide.
>
> I am a big fan of customer interaction with my programs. Recently a young woman asked if I could change the "Ugly Font" on the pageframes TABS of my program. I told her not yet, but give me a few minutes and you will.
>
> So I thought about it and wrote this code so she and others could have what they want.
>
> Here is the new program with the ability to Right Click on the pageframe and pick the font name you want. I don't have them pick the sizes because some would choose sizes too large. I will in the future but this isn't bad for 20 minutes of work.
>
> Keep in mind this just affects the TABS, not all the fonts on each of the pageframes.
>
>
>
>
>
>
> Shown above is 3 different examples of the new pageframes. Simply Right Clicking on the pageframe will activate this code and store the result into the SETUP.DBF file.
>
>
> 
> RIGHT CLICK CODE OF PAGEFRAME:
> ********************************************************************
> *** Name.....: CMDFINANCEPAYMENT.RIGHTCLICK.PageFrame Font Picker
> *** Author...: Donald J. Higgins
> *** Date.....: 12/05/2009
> *** Notice...: Copyright (c) 2009 Common Sense Software
> *** Compiler.: Visual FoxPro 09.00.0000.2412 for Windows
> *** Function.: Customer to pick font name from list so pageframe tabs are what they want
> *** Returns..: nothing
> ********************************************************************
> 
> 
> Local lcFontName, atsymbol
> 
> lcFontName = ""
> atsymbol = 0
> 
> * get new font name
> lcFontName = Getfont()
> 
> 
> Do openit In Main With "data\setup"
> 
> If .Not. Empty(lcFontName)
> 
> 	* store the choice to the setup file
> 	Replace pagefont With lcFontName IN SETUP
> 
> 	* update the command buttons with the new font
> 	* first get rid of commas and stuff
> 
> 	* find first comma
> 	* then truncate lcFontname so no commas or info afterwards
> 	atsymbol = At(",",lcFontName)
> 	lcFontName = Left(lcFontName,atsymbol - 1)
> 
> 	thisform.Pageframe_Font_Name = lcFontName  && "Comic Sans MS"
> 	* now make it so number 1 - or Engage
> 	* like that?  Its from Star Trek - new version, a show I could not get into
> 
> 	* Use setall function to set all the pageframe fonts the same
> 	thisform.pageframe1.SetAll("fontname",lcFontName,"page")
> 
> Endif
> 
> * select dbf you want to return to
> * 
> 
> Return
> 
> 

>
>
> OK, now that we have the right click method finished lets examine the ACTIVATE of the PageFrame class.
>
>
> 
> ********************************************************************
> *** Name.....: PageFrame.ACTIVATE
> *** Author...: Donald J. Higgins
> *** Date.....: 12/05/2009
> *** Notice...: Copyright (c) 2007 Common Sense Software
> *** Compiler.: Visual FoxPro 09.00.0000.3504 for Windows
> *** Function.: Controls ALL pageframe activate calls - so all code is made in one area and executed all over
> *** Returns..: the page has the color, font, and underline I want.  And I can change everything in one method
> ********************************************************************
> 
> * is this the first time they opened the program?  If so run this code otherwise bypass it, so it doesn't run this code every time someone clicks on the pageframe
> 
> If Thisform.first_time = .T.
> 
> 	Local i, lcPageName, lcFontName, atsymbol
> 
> 	* open SETUP.DBF file
> 	Do openit In Main With "data\setup"
> 
> 	lcFontName = ""
> 	atsymbol = 0
> 
> 	* prepare PageFrame Font Name First
> 	If .Not. Empty(Setup.pagefont)
> 		lcFontName = Alltrim(Setup.pagefont)
> 		* find first comma
> 		* then truncate lcFontname so no commas or info afterwards
> 		atsymbol = At(",",lcFontName)
> 		lcFontName = Left(lcFontName,atsymbol - 1)
> 	else
> 		* set a default value since there is not any from the table
> 		lcFontName = "Arial"
> 	endif
> 
> 
> 	* set default pageframe font size
> 	Thisform.pageframe1.SetAll("fontsize",10,"page")
> 
> 	* set form property for pageframe default font name from SETUP.DBF field pagefont.  Anytime we need 
> 	* to restore a font from here on out we use this property instead of running the code again
> 	Thisform.Pageframe_Font_Name = lcFontName  
> 
> 	* use setall function now.
> 	Thisform.pageframe1.SetAll("fontname",lcFontName,"page")
> 
> 
> 	* tell the program that this is no longer the first time so it doesn't run this code every time someone clicks on the pageframe
> 
> 	Thisform.first_time = .f.
> 
> 	* lots of other stuff here
> 
> endif
> 
> 
> 

>
>
> That is all you have to do. Keep in mind if you don't store the entire font name and size then the above code will need to be changed because it does not like it if there are no commas in the font name. For example: "Comic Sans MS, 10" is how it is stored. If you want to store just the font name then adjust the above code.
>
>
> Last part of the puzzle is using ALTER TABLE to add the necessary field into your SETUP.DBF file ( or whatever you use for this )
>
> Here is my code for this:
>
> 
> * Add pagefont for fonts on pageframe
> * used on pageframe tabs
> If Type("setup.pagefont") = "U"
> 	*************** Add field to payment database if it is not already done
> 	Alter Table Setup Add Column pagefont c(50)
> 	Replace ALL pagefont With "Comic Sans MS,10"   && you need the comma and size to use my code.
> ENDIF
> 
> 

>
>
> That is all there is to it. It will take you maybe 5 minutes to add this code and it is fun to use for customers. They want to be part of the process and have their own unique look so give it to them.
>
>
>
> Don Higgins
>
>
>
> http://www.youtube.com/watch?v=dcuFx85o8XU
>

Hi, Don.
Very good idea.
So I also want to change the fonts on the pages, is it the same idea?
I will test this idea myself but just in case you've already figured it out, I will save myself some time.
Thanks.

Atik
"Life lets him who is willing, him who is not, it drags."

ENTIRE THREAD

Do you give your users font options? Posted by Don Higgins @ 12/6/2009 7:43:38 AM
RE: Do you give your users font options? Posted by M. Akram Bhatti @ 12/6/2009 8:20:35 AM
RE: Do you give your users font options? Posted by Atik @ 12/22/2009 9:51:21 PM