Como defino que los Menus tenga mas de un Nivel
- Code: Select all Expand view RUN
FUNCTION CreateMainMenu()
LOCAL oMainMenu := TopBarMenu():new( 3, 1, 78 ) //MaxCol()
LOCAL bMenuBlock := {|o| MenuSelect(o) }
LOCAL cMenuColor := "N/BG,W+/R,GR+/BG,GR+/R,N+/BG,N/BG"
LOCAL aItems
oMainMenu:colorSpec := cMenuColor
@0,1 say "[ ] Produccion/Facturacion" colour "w/b"
menu_dp1()
aItems := { ;
{ " &Open " , K_ALT_O , "Open routine" , 11 }, ; //p_200() p_rr()
{ " &Save " , K_ALT_S , "Save routine" , 12 }, ;
{ MENU_SEPARATOR, , , 13 }, ;
{ " E&xit " , K_ALT_X , "Exit program" , 14 } ;
}
CreateSubMenu( oMainMenu, " &File ", bMenuBlock, aItems )
aItems := { ;
{ " Cop&y " , K_CTRL_INS, "Copy routine" , 21 }, ;
{ " &Paste " , K_SH_INS , "Paste routine" , 22 }, ;
{ MENU_SEPARATOR, , , 23 }, ;
{ " C&ut " , K_SH_DEL , "Cut routine" , 24 }, ;
{ " &Delete " , K_DEL , "Delete routine", 25 } ;
}
CreateSubMenu( oMainMenu, " &Edit ", bMenuBlock, aItems )
aItems := { ;
{ " &Info " , K_F1 , "Help routine" , 31 }, ;
{ " &About " , , "About program" , 32 } ;
}
CreateSubMenu( oMainMenu, " &Help ", bMenuBlock, aItems )
RETURN oMainMenu
FUNCTION CreateSubMenu( oMenu, cMenuItem, bBlock, aItems )
LOCAL aItem, oItem, oSubMenu
oSubMenu := PopUp():new()
oSubMenu:colorSpec := oMenu:colorSpec
FOR EACH aItem IN aItems
oItem := MenuItem():new( aItem[1], ;
bBlock , ;
aItem[2], ;
aItem[3], ;
aitem[4] )
oSubMenu:addItem ( oItem )
NEXT
oItem := MenuItem():new( cMenuItem, oSubMenu )
oMenu:addItem( oItem )
RETURN
PROCEDURE MenuSelect( oMenuItem )
// @ 1, 0 CLEAR TO MaxRow(), MaxCol()
SWITCH oMenuItem:ID
CASE 14
ExitRoutine() ; EXIT
DEFAULT
Alert( oMenuItem:message )
END
RETURN
PROCEDURE ExitRoutine
IF Alert( "Desea Terminar ?", { "Si", "No" } ) == 1
QUIT
ENDIF
RETURN