I think this is a better look than the standard DCMENUBAR.
Compile and run the below sample.
Code: Select all
#INCLUDE "dcdialog.CH"
#INCLUDE "appevent.CH"
#define MENU_BAR_BGCOLOR GRA_CLR_BACKGROUND
#define MENU_BAR_FGCOLOR GRA_CLR_BLACK
#define MENU_SUB_BGCOLOR GRA_CLR_WHITE
#define MENU_SUB_FGCOLOR GRA_CLR_BLACK
#define MENU_SUB_BARCOLORFG GRA_CLR_WHITE
#define MENU_SUB_BARCOLORBG GRA_CLR_PALEGRAY
#define MENU_SUB_OUTLINECOLOR GRA_CLR_BLACK
#define MENU_SUB_VERTBARFONT '12.Arial Bold'
#define MENU_SUB_CHECKFONT '10.Marlett'
#define MENU_SUB_CHECKCHAR 'b'
#define MENU_BAR_BARFONT '10.Arial'
#define MENU_SUB_ITEMFONT '10.Arial'
#translate BUTTONMENU <m> => ;
EVAL {|o|o:lbDown := {|a,b,o|oButton := o, ;
<m>:endMenu := {|a,b,o|Eval(oButton:killInputFocus,a,b,oButton)}, ;
<m>:PopUp( o:setParent(), o:currentPos(), 2, ;
XBPMENU_PU_DEFAULT + XBPMENU_PU_MOUSE_RBDOWN )}, ;
o:keyboard := {|a,b,o|IIF(a==xbeK_ENTER,Eval(o:lbDown,a,b,o),nil)}, ;
o:setInputFocus := {|a,b,o|PostAppEvent(xbeM_Enter,,,o)}, ;
o:killInputFocus := {|a,b,o|PostAppEvent(xbeM_Leave,,,o)}}
FUNCTION Main()
LOCAL GetList[0], oStatTop, oMenuBar, oFileMenu, oEditMenu, oEditMenuSub, ;
oConfig := DC_XbpPushButtonXPConfig():new(), ;
aParams, cButtonFont := '12.Arial Bold', bEval, oButton
aParams := { MENU_SUB_BGCOLOR, ;
MENU_SUB_BARCOLORFG, ;
MENU_SUB_BARCOLORBG, ;
MENU_SUB_OUTLINECOLOR, ;
MENU_SUB_VERTBARFONT, ;
.F., ;
MENU_SUB_CHECKFONT, ;
MENU_SUB_CHECKCHAR, ;
MENU_BAR_FGCOLOR, ;
MENU_BAR_BGCOLOR, ;
MENU_SUB_FGCOLOR, ;
MENU_BAR_BARFONT, ;
MENU_SUB_ITEMFONT }
DC_XbpMenuConfig( aParams )
oConfig:radius := 10
oConfig:bgColor := GRA_CLR_PALEGRAY
DCSTATUSBAR oStatTop HEIGHT 22 ALIGN DCGUI_ALIGN_TOP
@ 0,0 DCTOOLBAR oMenuBar SIZE 1000,22 PIXEL PARENT oStatTop BUTTONSIZE 80,20 ;
COLOR nil, GRA_CLR_PALEGRAY FONT '12.Arial Bold'
DCHOTKEY xbeK_RIGHT ACTION {||PostAppEvent(xbeP_Keyboard,xbeK_TAB,,oMenuBar)}
DCHOTKEY xbeK_LEFT ACTION {||PostAppEvent(xbeP_Keyboard,xbeK_SH_TAB,,oMenuBar)}
DCADDBUTTONXP CAPTION '&File' PARENT oMenuBar CONFIG oConfig ;
BUTTONMENU oFileMenu TABSTOP
DCSUBMENU oFileMenu PROMPT 'File' OWNERDRAW
DCMENUITEM 'Open File' PARENT oFileMenu ACTION {||MsgBox('Open File')}
DCMENUITEM 'Close File' PARENT oFileMenu ACTION {||MsgBox('Close File')}
DCADDBUTTONXP CAPTION '&Edit' PARENT oMenuBar CONFIG oConfig ;
BUTTONMENU oEditMenu TABSTOP
DCSUBMENU oEditMenu PROMPT 'Edit' OWNERDRAW
DCMENUITEM 'Edit File' PARENT oEditMenu ACTION {||MsgBox('Edit File')}
DCMENUITEM 'Save File' PARENT oEditMenu ACTION {||MsgBox('Save File')}
DCSUBMENU oEditMenuSub PROMPT 'Sub File' PARENT oEditMenu
DCMENUITEM 'Edit File Sub 1' PARENT oEditMenuSub ACTION {||MsgBox('EFS1')}
DCMENUITEM 'Edit File Sub 2' PARENT oEditMenuSub ACTION {||MsgBox('EFS2')}
DCMENUITEM 'Edit File Sub 3' PARENT oEditMenuSub ACTION {||MsgBox('EFS3')}
DCREAD GUI TITLE 'Menu Test'
RETURN nil
PROC appsys ; RETURN