下面名为 markpad.pkg 的示例程序中,当选择一个菜单标题时,使用 mrkpad( ) 函数来切换菜单标题的标记字符。首先用 set sysmeno save 命令保存当前系统菜单栏,然后用 setsysenu to
命令移去所有的系统菜单栏。用 define pad 命令创建几个系统菜单项,当选择一个菜单项时,就执行 choice 过程。choice 显示了所选择的菜单项名和菜单栏名。用 set mark of
命令和 mrkpad( ) 函数一起来显示或移去菜单项的标记字符。如果选择了“退出”菜单,
就还原原来的 visual foxpro 系统菜单。
*** 程序名为 markpad.pgc ***
clear
set sysmenu save
set sysmenu to
set mark of menu _msysmenu to chr(4)
public glmarkpad
glmarkpad = .t.
define pad padsys of _msysmenu prompt '\<system' color scheme 3 ;
key alt+s, ''
define pad padedit of _msysmenu prompt '\<edit' color scheme 3 ;
key alt+e, ''
define pad padrecord of _msysmenu prompt '\<record' color scheme 3 ;
key alt+r, ''
define pad padwindow of _msysmenu prompt '\<window' color scheme 3 ;
key alt+w, ''
define pad padreport of _msysmenu prompt 're\<ports' color scheme 3 ;
key alt+p, ''
define pad padexit of _msysmenu prompt 'e\<xit' color scheme 3 ;
key alt+x, ''
on selection menu _msysmenu ;
do choice in markpad with pad( ), menu( )
procedure choice
parameter gcpad, gcmenu
wait window 'you chose ' + gcpad + ;
' from menu ' + gcmenu nowait
set mark of pad (gcpad) of _msysmenu to ;
! mrkpad('_msysmenu', gcpad)
glmarkpad= ! glmarkpad
if gcpad = 'padexit'
set sysmenu to default
endif