INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Menus

How to change menu font (name,size) and colors with Menu designer by Kruno
Posted: 19 Jun 06 (Edited 20 Jun 06)

.

Yes. It is not recommended to change the way menu looks.
But if you (or your users) still insist, here is the way:

A. CHANGING MENU FONT (NAME, SIZE, STYLE)
================================================
Step-by-Step Procedure
To change the font of a menu item, follow these steps:

1. Open the menu designer, and select Quick Menu under Menu.  
2. In the Prompt column, click a menu item (for example, Open) under File.  
3. Press the Options button to display the Prompt Options dialog box.  
4. Select the Skip For box to display the Expression Builder.  
5. In the Skip For box, type the following:
.f. FONT "Courier New", 14 style "BI"  
6. Choose OK twice to return to the Menu Designer.  
7. Choose Generate under Menu, and run the menu.  
Now the Open choice in the File menu is much larger and displays bold italic.

http://support.microsoft.com/default.aspx?scid=kb;en-us;130657
================================================

My suggestion (for VFP9 and lower):
You will allow the user to change these settings or/and
save these values to DBF or TXT/INI.

1. Before invoking your menu in your program read them into variables.
    lcfont_name    e.g.Courier New
    lnfont_size    e.g.14        (integer!)
    lcfont_style    e.g.BI

2. And build a string with these values.

CODE

lcxxx = [FONT "] + lcfont_name + [", ] + ;
ALLTRIM(STR(lnfont_size)) + ;
[ STYLE "] + lcfont_style+[" ]
3. Then declare 2 global variables.

CODE

public gcMenuF,gcMenuT
gcMenuF = ".f. " + lcxxx
gcMenuT = ".t. " + lcxxx

4. In Menu Designer click on button Options on the right of your
option and put in SKIP FOR:

CODE

&gcMenuF

For your disabled options put instead

CODE

&gcMenuT

**************************************************************

B. CHANGING MENU COLORS

Lets say you prepared your lcxxx as above.
To manipulate with colors, you need 3 pairs of integers representing
colors. You got it by RGB-dialog.

2-A.
Read them into variables:

lnenabled_fore -> enabled options, fore and back color
lnenabled_back

lnselected_fore -> the selected option, fore and back color
lnselected_back

lndisabled_fore -> disabled options, fore and back color
lndisabled_back

2-B.
After you get lcxxx as above (2),

CODE

lcxxx = [FONT "] + lcfont_name + [", ] + ;
ALLTRIM(STR(lnfont_size)) + ;
[ STYLE "] + lcfont_style+[" ]

you need 3 color pairs only relevant in VFP,
opposed to FPD.

CODE

lcx1 = Color2RGBpair(lndisabled_fore,lndisabled_back)
lcx2 = Color2RGBpair(lnenabled_fore,lnenabled_back)
lcx3 = Color2RGBpair(lnselected_fore,lnselected_back)

lcxxx = lcxxx + ;
[ COLOR ] + ;
lcx1 + "," + ;
lcx2 + ",,,," + ;
lcx3 + " "


After that richer lcxxx, you declare 2 global variables and put one in SKIP FOR in your Menu Designer (steps 3,4)



You only need access to function Color2RGBpair.
Notice very odd format of RGB ! Like RGBRGB.

CODE

FUNCTION Color2RGBpair
* Returns color pair as "RGB(cRed,cGreen,cBlue,cRed,cGreen,cBlue)" from the numeric value of the color.
* Based on function Color2RGB_1 by ???
LPARAMETERS tnColorFore ,tnColorBack
RETURN STRTRAN("RGB("+ ;
    STR(tnColorFore%256,3)+","+;
    STR(FLOOR(tnColorFore%256^2 / 256),3)+ "," + ;
    STR(FLOOR(tnColorFore / 256^2),3)+","+;
    STR(tnColorBack%256,3)+","+;
    STR(FLOOR(tnColorBack%256^2 / 256),3)+ "," + ;
    STR(FLOOR(tnColorBack / 256^2),3) + ;
    ")" , " ", "")
ENDFUNC

Limitations: It seems to work only for menu bars (DEFINE BAR), not for PADS and not for separators in menu.

Example:
lnenabled_fore = 0
lnenabled_back = 16777215
lndisabled_fore = 14737632
lndisabled_back = 16777215
lnselected_fore = 16777215
lnselected_back = 14772545
lnfont_size = 12
lcfont_name = "Verdana"
lcfont_style = "B"

Back to Microsoft: Visual FoxPro FAQ Index
Back to Microsoft: Visual FoxPro Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close