Dear Friends,
Attn: Mr.Cristobal
Using the following code, I am not able to apply the respective
menu thems like l2007, l2010, l2013 and l2015 to the sub-menu
items at runtime. They are properly applied to the main menu
but not to the sub-menu items.
And How I can I get the Default Windows Menu Theme. I am
not getting this even after disable all l2007, l2010, l2013
and l2015 themes and define oMenu:lColors := .F.
Please suggest me the right way.
-Ramesh Babu P
#include "FiveWin.ch"
STATIC oWnd, oMenu, n
//-------------------------------------------------------------------//
FUNCTION Main()
n := 0
DEFINE WINDOW oWnd TITLE "Menu Theme Change - Runtime" ;
@ 10, 1 BUTTON "2007 Theme" SIZE 100,28 ;
ACTION SetMenuTheme(oMenu, 1) // CLR_WHITE, CLR_BLACK )
@ 10,18 BUTTON "2010 Theme" SIZE 100,28 ;
ACTION SetMenuTheme(oMenu, 2) // RGB(40,40,40), CLR_WHITE )
@ 10,35 BUTTON "2013 Theme" SIZE 100,28 ;
ACTION SetMenuTheme(oMenu, 3) // RGB(40,70,120), CLR_YELLOW )
@ 10,52 BUTTON "2015 Theme" SIZE 100,28 ;
ACTION SetMenuTheme(oMenu, 4) // RGB(40,70,120), CLR_YELLOW )
@ 10,69 BUTTON "Win.Default" SIZE 100,28 ;
ACTION SetMenuTheme(oMenu, 0) // RGB(40,70,120), CLR_YELLOW )
BuildMenu()
ACTIVATE WINDOW oWnd CENTERED
return nil
//-------------------------------------------------------------------//
FUNCTION BuildMenu()
LOCAL oMenuFont
DEFINE FONT oMenuFont NAME "Tahoma" SIZE 0, -14 WEIGHT 300
MENU oMenu FONT oMenuFont HEIGHT -2.00 COLORBMP CLR_HGRAY //"MEDICAL.BMP"
MENUITEM "File"
MENU
MENUITEM "New"
MENUITEM "Open"
MENUITEM "Exit" ACTION oWnd:End()
ENDMENU
MENUITEM "Edit"
MENU
MENUITEM "Copy"
MENUITEM "Paste"
ENDMENU
MENUITEM "Help"
MENU
MENUITEM "About"
ENDMENU
ENDMENU
oWnd:SetMenu(oMenu)
RELEASE FONT oMenuFont
RETURN nil
//-------------------------------------------------------------------//
FUNCTION SetMenuTheme(oMenu, n)
DO CASE
CASE n = 1
oMenu:l2007 := .T.
oMenu:l2010 := .F.
oMenu:l2013 := .F.
oMenu:l2015 := .F.
oMenu:lColors := .T.
CASE n = 2
oMenu:l2007 := .F.
oMenu:l2010 := .T.
oMenu:l2013 := .F.
oMenu:l2015 := .F.
oMenu:lColors := .T.
CASE n = 3
oMenu:l2007 := .F.
oMenu:l2010 := .F.
oMenu:l2013 := .T.
oMenu:l2015 := .F.
oMenu:lColors := .T.
CASE n = 4
oMenu:l2007 := .F.
oMenu:l2010 := .F.
oMenu:l2013 := .F.
oMenu:l2015 := .T.
oMenu:lColors := .T.
CASE n = 0
oMenu:l2007 := .F.
oMenu:l2010 := .F.
oMenu:l2013 := .F.
oMenu:l2015 := .F.
oMenu:lColors := .F.
ENDCASE
oMenu:SetSkin()
oMenu:Refresh()
ApplyMenuItemColors(oMenu, n)
RETURN nil
//-------------------------------------------------------------------//
FUNCTION ApplyMenuItemColors(oMenu, n)
local oItem
// Loop through menu items and apply color
FOR EACH oItem IN oMenu:aItems
DO CASE
CASE n = 1
oItem:l2007 := .T.
oItem:l2010 := .F.
oItem:l2013 := .F.
oItem:l2015 := .F.
oItem:lColors := .T.
CASE n = 2
oItem:l2007 := .F.
oItem:l2010 := .T.
oItem:l2013 := .F.
oItem:l2015 := .F.
oItem:lColors := .T.
CASE n = 3
oItem:l2007 := .F.
oItem:l2010 := .F.
oItem:l2013 := .T.
oItem:l2015 := .F.
oItem:lColors := .T.
CASE n = 4
oItem:l2007 := .F.
oItem:l2010 := .F.
oItem:l2013 := .F.
oItem:l2015 := .T.
oItem:lColors := .T.
CASE n = 0
oItem:l2007 := .F.
oItem:l2010 := .F.
oItem:l2013 := .F.
oItem:l2015 := .F.
oItem:lColors := .F.
ENDCASE
oItem:nClrMenu := oMenu:nClrMenu
oItem:nClrText := oMenu:nClrText
oItem:nClrToBa := oMenu:nClrToBa
oItem:nClrBkBa := oMenu:nClrBkBa
oItem:nClrHiLi := oMenu:nClrHiLi
oItem:nClrHiLf := oMenu:nClrHiLf
oItem:nClrHitx := oMenu:nClrHitx
oItem:nClrHiBr := oMenu:nClrHiBr
oItem:nClrToBr := oMenu:nClrToBr
oItem:nClrBkBr := oMenu:nClrBkBr
oItem:nClrBox1 := oMenu:nClrBox1
CColorSubMenu()
NEXT
oWnd:Refresh()
RETURN nil