Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Custom Menu color
Message
De
08/03/2006 09:34:14
 
 
À
07/03/2006 09:53:02
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01098399
Message ID:
01102415
Vues:
17
Hi Denis

That you cannot change easily. But you can simulate the colour by

SET SYSMENU OFF
SET SYSMENU TO

and then use either a toolbar that looks like a menu or a form with buttons to simulate a menu, that will sit across the top of the form. Then you can have any colour you want. Note that in the VFP IDE the menu will still show but will not in an EXE. I have done this many times. Just needs a bit of imagination.

Then you can define SHORTCUT MENUS using my method and give THEM colours and make them popup just like a normal "grey" menu but with colours!


>Hi Bernard!
>Your lecture is very nice! ;) You can write a little book ;)) I think..
>All what you wrote good working for BAR.. but I had try apply same way for
>DEFINE MENU, or DEFINE PAD OF _MYSSYMENU... and have not get success with it. The menu line has always gray color (as system defined). but .. for BARs all works cool as you wrote.. (but I never using menu designer to write menu... because I too silly to get it work as I want
>
>Thanks again
>Denis
>
>>>Hi,
>>>Can I set custom menu color for top level form menu?
>>>Can't understand how to use color pair ;(
>>>I need to setup menu backcolor, menu forecolor, selected item back color, selected Item forecolor
>>>Is it possible?
>>>
>>>Thanks
>>>Denis
>>
>>
>>Hi Denis
>>
>>I won't lecture you here about not changing the menu colours.
>>
>>To answer your question, Yes it is possible to change the background, foregroung as well as the font and font attributes of each menu item if you so wish.
>>
>>Using a little known trick this is possible. You can also make this easy to change using the VFP menu designer as well as changeable at RUNTIME!!!
>>
>>Read on...
>>
>>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 Message
>>
>>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 :
>>
>>4. Enter this: COLOR , RGB(255,255,255,192,255,0)
>>
>>(don't forget the comma after the keyword color)
>>
>>5 Enter this:
>>
>>FONT "Century Gothic", 20 Style "B"
>>
>>6 Now if you want a bitmap add this :
>>
>>PICTURE "c:\vfp9\fox.bmp"
>>
>>Now the complete string in your Message field is:
>>
>>"" COLOR , RGB(255,255,255,192,255,0) FONT "Century Gothic", 20 Style "B" Picture "c:\vfp9\fox.bmp"
>>
>>Note1: Colours are entered as a colour pair Foreground / Background)
>>
>>Note: Your menu 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 + colours!
>>
>>RUNTIME Changes:
>>
>>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:
>>&MyMenuVar1
>>
>>Message field now looks like this :
>>
>>"" &MyMenuVar1
>>
>>Save this and generate the MPR file again. Do NOT run it as yet.
>>
>>In your command window type this:
>>
>>
>>MyMenuVar1 = [ COLOR , RGB(255,255,255,192,255,0) FONT "Century Gothic", 20 Style "B" PICTURE "c:\vfp9\fox.bmp" ]
>>
>>
>>
>>(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.
>>
>>Now
>>Do MyMenu.Mpr
>>
>>
>>
>>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.
>>
>>Type :
>>MyMenuVar1 = [COLOR , RGB(255,255,255,0,0,255) FONT "Century Gothic", 6 Style "B" Picture "c:\vfp9\fox.bmp"]
>>
>>(Change the background colour and the font size)
>>
>>Now rum this again:
>>Do MyMenu.Mpr
>>
>>
>>
>>Open the menu and see that the font size has reduced from 20 to 6 and the backgroung colour has changed - at runtime!
>>
>>So now you know how to do this at design time as well as runtime.
>>
>>You just need to remember to DO the MPR each time you change the attributes.
>>
>>Experiment at changing other properties as defined in the VFP help Define Bar command.
>>
>>You can store colour schemes/themes and use them from a table using the above method.
>>
>>Good luck
>>
>>Cheers
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform