MENU'S >> HOW DO I CHANGE THE ATTRIBUTES LIKE COLOUR, FONT ETC. FOR MY MENU'S
This is how to obtain Dynamic Colors for your menubars, Dynamic fonts and Dynamic bmps that can be changed at runtime.
When desigining your menu in the menu designer of VFP, for the menu item you want to change, click on the small button just below Options.
This opens the VFP "Prompt Options" dialog box where you specify shortcut, Skip for, Message etc. The field we want is
1. In the Message field first enter an empty string like so "". You could add some text between the "" if you wanted, but for this exercise just enter ""
2. Now enter a SPACE
3. Now enter your font string Exactly as I have :
FONT "Century Gothic", 20 Style "B"
4. Now if you want a bitmap add this :
Now the complete string in your Message field is:
"" FONT "Century Gothic", 20 Style "B" Picture "c:\vfp9\fox.bmp"
Note: Your Preview will not show the new attributes.
From the menu select Menu | Generate to generate the MPR file.
Run this : DO MyMenu.mpr
Now go to the menu and look at the item that you added the above line to. Voila. Picture & Font Attributes.
Now open the menu in VFP, go to the Message field (as above), Highlight and CUT out all the code you entered EXCEPT for the "" . Now your Message field should have just ""
Type a space and then enter this:
Message field now looks like this :
Save this and generate the MPR file again. Do NOT run it as yet.
In your command window type this:
MyMenuVar1 = [FONT "Century Gothic", 20 Style "B" COLOR , RGB(255,255,255,192,255,0) PICTURE "c:\vfp9\fox.bmp" ]
VFP Help File is wrong
Specifies the colors for an individual menu item, overriding the default colors or the colors specified with DEFINE POPUP. You can specify the colors of all menu items, mark characters, and messages. By default, the colors of menu items are determined by color scheme 2 of the current color set."
The above will do NOTHING. You need to enter the colorpair as I have done above, with a comma between the COLOR and the Pair:
COLOR , RGB(255,255,255,192,255,0)
(Basically you paste the code you cut out of the message field between the  btackets. Use any small bitmap but you need the full path)
Press enter and Public Variable MyMenuVar1 now equals to your string.
Final result is as below. Ugly I know but it gives you the idea that you can change anything, even the fonts.
Open the menu to the item you wanted changed and see that it now has a bitmap as well as font attributes. You can change the value assigned to MyMenuVar at runtime and reissue Do MyMenu.Mpr and the menu will take on the new attributes.
MyMenuVar1 = [FONT "Century Gothic", 6 Style "B" COLOR , RGB(255,255,255,192,255,0) PICTURE "c:\vfp9\fox.bmp" ]
(change the font size to 6 , Backgcolor to green, forecolor to white)
Now Do MyMenu.Mpr
Open the menu and see that the font size has reduced from 20 to 6 at runtime with a colour change!
So now you know how to do this at design time as well as runtime.
You just need to remember to Generate the MPR and also at runtime DO the MPR each time you change the attributes.
Experiment at changing other properties as defined in the VFP help Define Bar command.
@ 8/23/2007 8:08:38 AM
@ 12/2/2007 6:10:24 PM
@ 12/6/2007 10:19:42 AM
@ 7/21/2008 11:55:18 AM
How to change top level menu bar ?
@ 7/23/2008 3:07:48 AM
shahid masoud - You change Top Level Menu bar in Windows. That is a system wide setting.
@ 7/30/2008 3:29:08 PM
its great.... tnx bout
@ 7/30/2009 3:38:45 PM
please show a example for top level menu bar
@ 7/30/2009 3:46:39 PM
it effects all the menus but only want to change only my software menu
Rama Kirhsna NagaRaju
@ 9/26/2010 5:28:27 PM
Your Code Is Not Working. Could You Please Send Any Sample File For Me. It's More Help Full For Us.
Plz... Send To Me
My Mail firstname.lastname@example.org
@ 4/3/2014 6:41:15 PM
Brilliant! It works perfectly! Thanks a lot!
Enter the code shown: