| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1547 人关注过本帖
标题:菜单?
只看楼主 加入收藏
有容就大
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:东土大唐
等 级:版主
威 望:74
帖 子:9048
专家分:14309
注 册:2011-11-11
结帖率:99.34%
收藏
已结贴  问题点数:20 回复次数:40 
菜单?
我在计算器界面上添加了一个菜单栏 但是怎么用它 呵呵 加完了竟然束手无策
图片附件: 游客没有浏览图片的权限,请 登录注册


要用菜单下面的功能怎么办 ?
我用记事本打开了菜单的mpr文件  是不是 在主程序里调用jjm.mpr后 就可以用到他里面的变量 比如菜单项的ID?
那么菜单项的ID是那些呢?
程序代码:
*       *********************************************************
*       *                                                        

*       * 09/20/12               JJM.MPR                13:02:02 

*       *                                                        

*       *********************************************************
*       *                                                        

*       * 作者姓名                                               

*       *                                                        

*       * Copyright (C) 2012 公司名称                            

*       * 地址                                                   

*       * 城市,     Zip                                          

*       * 国家                                             

*       *                                                        

*       * 说明:                                           

*       * This PROGRAM was automatically generated BY GENMENU.   

*       *                                                        

*       *********************************************************

* To attach this menu to your Top-Level form,

* call it from the Init event of the form:

* Syntax: DO <mprname> WITH <oFormRef> [,<cMenuname>|<lRename>][<lUniquePopups>]

*    oFormRef - form object reference (THIS)
*    cMenuname - name for menu (this is required for Append menus - see below)
*    lRename - renames Name property of your form
*    lUniquePopups - determines whether to generate unique ids for popup names          
*     example:
*    PROCEDURE Init
*        DO mymenu.mpr WITH THIS,.T.
*    ENDPROC

* Use the optional 2nd parameter if you plan on running multiple instances
* of your Top-Level form. The preferred method is to create an empty string
* variable and pass it by reference so you can receive the form name after
* the MPR file is run. You can later use this reference to destroy the menu.

*    PROCEDURE Init
*        LOCAL cGetMenuName
*        cGetMenuName = ""
*        DO mymenu.mpr WITH THIS, m.cGetMenuName
*    ENDPROC

* The logical lRename parameter will change the name property of your

* form to the same name given the menu and may cause conflicts in your

* code if you directly reference the form by name.

* You will also need to remove the menu when the form is destroyed so that it does

* not remain in memory unless you wish to reactivate it later in a new form.

* If you passed the optional lRename parameter as .T. as in the above example,

* you can easily remove the menu in the form's Destroy event as shown below.
* This strategy is ideal when using multiple instances of Top-Level forms.

*    example:

*    PROCEDURE Destroy
*        RELEASE MENU (THIS.Name) EXTENDED
*    ENDPROC

* Using Append/Before/After location options:

*   You might want to append a menu to an existing Top-Level form by setting

*   the Location option in the General Options dialog. In order to do this, you

*   must pass the name of the menu in which to attach the new one. The second
*   parameter is required here. If you originally created the menu with the lRename

*   parameter = .T., then you can update the menu with code similar to the following:

*    example:

*    DO mymenu2.mpr WITH THISFORM,THISFORM.name
*
* Using lUniquePopups:

*   If you are running this menu multiple times in your application, such as in multiple

*   instances of the same top-level form, you should pass .T. to the lUniquePopups

*   parameter so that unique popup names are generated to avoid possible conflicts.

*    example:

*    PROCEDURE Init
*        DO mymenu.mpr WITH THIS,.T.,.T.
*    ENDPROC
*
* Note: Parm4-Parm9 are not reserved and freely available for use with your menu code.
*

LPARAMETERS oFormRef, getMenuName, lUniquePopups, parm4, parm5, parm6, parm7, parm8, parm9
LOCAL cMenuName, nTotPops, a_menupops, cTypeParm2, cSaveFormName
IF TYPE("m.oFormRef") # "O" OR ;
  LOWER(m.oFormRef.BaseClass) # 'form' OR ;
  m.oFormRef.ShowWindow # 2
    MESSAGEBOX([该菜单只可从顶层表单中调用。确保表单的 ShowWindow 属性被设置为 2。更详细的资料,请阅读菜单 MPR 文件的头部章节。])
    RETURN
ENDIF
m.cTypeParm2 = TYPE("m.getMenuName")
m.cMenuName = SYS(2015)
m.cSaveFormName = m.oFormRef.Name
IF m.cTypeParm2 = "C" OR (m.cTypeParm2 = "L" AND m.getMenuName)
    m.oFormRef.Name = m.cMenuName
ENDIF
IF m.cTypeParm2 = "C" AND !EMPTY(m.getMenuName)
    m.cMenuName = m.getMenuName
ENDIF
DIMENSION a_menupops[3]
IF TYPE("m.lUniquePopups")="L" AND m.lUniquePopups
    FOR nTotPops = 1 TO ALEN(a_menupops)
        a_menupops[m.nTotPops]= SYS(2015)
    ENDFOR
ELSE
    a_menupops[1]="编辑e"
    a_menupops[2]="查看v"
    a_menupops[3]="帮助h"
ENDIF


*       *********************************************************
*       *                                                        

*       *                         菜单定义                       

*       *                                                        

*       *********************************************************
*

DEFINE MENU (m.cMenuName) IN (m.oFormRef.Name) BAR

DEFINE PAD _3lo0rxpth OF (m.cMenuName) PROMPT "编辑(\<E)" COLOR SCHEME 3 ;
    KEY ALT+E, ""
DEFINE PAD _3lo0rxpti OF (m.cMenuName) PROMPT "查看(\<V)" COLOR SCHEME 3 ;
    KEY ALT+V, ""
DEFINE PAD _3lo0rxptj OF (m.cMenuName) PROMPT "帮助(\<H)" COLOR SCHEME 3 ;
    KEY ALT+H, ""
ON PAD _3lo0rxpth OF (m.cMenuName) ACTIVATE POPUP (a_menupops[1])
ON PAD _3lo0rxpti OF (m.cMenuName) ACTIVATE POPUP (a_menupops[2])
ON PAD _3lo0rxptj OF (m.cMenuName) ACTIVATE POPUP (a_menupops[3])

DEFINE POPUP (a_menupops[1]) MARGIN RELATIVE SHADOW COLOR SCHEME 4
DEFINE BAR 1 OF (a_menupops[1]) PROMPT "复制" ;
    KEY CTRL+C, ""
DEFINE BAR 2 OF (a_menupops[1]) PROMPT "粘贴" ;
    KEY CTRL+V, ""

DEFINE POPUP (a_menupops[2]) MARGIN RELATIVE SHADOW COLOR SCHEME 4
DEFINE BAR 1 OF (a_menupops[2]) PROMPT "标准型(\<T)"
DEFINE BAR 2 OF (a_menupops[2]) PROMPT "科学型(\<S)"
DEFINE BAR 3 OF (a_menupops[2]) PROMPT "\-"
DEFINE BAR 4 OF (a_menupops[2]) PROMPT "数字分组(\<I)"

DEFINE POPUP (a_menupops[3]) MARGIN RELATIVE SHADOW COLOR SCHEME 4
DEFINE BAR 1 OF (a_menupops[3]) PROMPT "帮助主题(\<H)"
DEFINE BAR 2 OF (a_menupops[3]) PROMPT "关于计算器(\<A)"

ACTIVATE MENU (m.cMenuName) NOWAIT

IF m.cTypeParm2 = "C"
    m.getMenuName = m.cMenuName
    m.oFormRef.Name = m.cSaveFormName

ENDIF

搜索更多相关主题的帖子: color 菜单栏 主程序 
2012-09-20 13:21
bccn201203
Rank: 9Rank: 9Rank: 9
等 级:蜘蛛侠
威 望:3
帖 子:680
专家分:1140
注 册:2012-3-14
收藏
得分:0 
[复制]=ALLTRIM(_SCREEN.ACTIVEFORM.LABEL2.CAPTION) &&写在该菜单的过程中
_SCREEN.ACTIVEFORM.LABEL2.CAPTION =[粘贴]

[ 本帖最后由 bccn201203 于 2012-9-20 13:39 编辑 ]
2012-09-20 13:36
有容就大
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:东土大唐
等 级:版主
威 望:74
帖 子:9048
专家分:14309
注 册:2011-11-11
收藏
得分:0 
以下是引用bccn201203在2012-9-20 13:36:01的发言:

[复制]=ALLTRIM(_SCREEN.ACTIVEFORM.LABEL2.CAPTION) &&写在该菜单的过程中
_SCREEN.ACTIVEFORM.LABEL2.CAPTION =[粘贴]

你的意思是 去修改菜单程序mpr ? 可以直接在主程序jsq3.prg里面写相关代码吗?

梅尚程荀
马谭杨奚







                                                       
2012-09-20 13:41
bccn201203
Rank: 9Rank: 9Rank: 9
等 级:蜘蛛侠
威 望:3
帖 子:680
专家分:1140
注 册:2012-3-14
收藏
得分:0 
图片附件: 游客没有浏览图片的权限,请 登录注册


图片附件: 游客没有浏览图片的权限,请 登录注册
2012-09-20 13:48
bccn201203
Rank: 9Rank: 9Rank: 9
等 级:蜘蛛侠
威 望:3
帖 子:680
专家分:1140
注 册:2012-3-14
收藏
得分:0 
图片附件: 游客没有浏览图片的权限,请 登录注册
2012-09-20 13:52
有容就大
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:东土大唐
等 级:版主
威 望:74
帖 子:9048
专家分:14309
注 册:2011-11-11
收藏
得分:0 
厉害啊 谢谢啦

梅尚程荀
马谭杨奚







                                                       
2012-09-20 13:55
bccn201203
Rank: 9Rank: 9Rank: 9
等 级:蜘蛛侠
威 望:3
帖 子:680
专家分:1140
注 册:2012-3-14
收藏
得分:0 
显示屏中的第一个标签应该设置输出宽度,否则超过显示屏宽度,会影响显示效果的。第一行的标签的右边距要与显示屏的右边距保持1-2个字符宽度的距离[你现在这种效果比较难看]。
2012-09-20 13:56
bccn201203
Rank: 9Rank: 9Rank: 9
等 级:蜘蛛侠
威 望:3
帖 子:680
专家分:1140
注 册:2012-3-14
收藏
得分:0 
复制 过程中 LABEL2 要写完整的引用对象。
比如 .容器1.LABLE2.CAPTION
2012-09-20 14:03
有容就大
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:东土大唐
等 级:版主
威 望:74
帖 子:9048
专家分:14309
注 册:2011-11-11
收藏
得分:0 
我在复制和黏贴下写了相关代码 然后生成 在mpr文件里有增加的代码 但去用计算器还是菜单无反应啊

程序代码:
*       *********************************************************
*       *                                                        

*       * _3LO0TZ4M7  ON SELECTION BAR 1 OF POPUP 编辑e          

*       *                                                        

*       * Procedure Origin:                                      

*       *                                                        

*       * From Menu:  JJM.MPR,            Record:    5           

*       * Called By:  ON SELECTION BAR 1 OF POPUP 编辑e          

*       * Prompt:     复制                                       

*       * Snippet:    1                                          

*       *                                                        

*       *********************************************************
*
PROCEDURE _3lo0tz4m7 // 这个什么东西 为什么后面没有endproc 和 procedure 对应?
Procedure copy
Alltrim(_screen.ActiveForm.C_display.epn_dpy.Caption)
EndProc


*       *********************************************************
*       *                                                        

*       * _3LO0TZ4M8  ON SELECTION BAR 2 OF POPUP 编辑e          

*       *                                                        

*       * Procedure Origin:                                      

*       *                                                        

*       * From Menu:  JJM.MPR,            Record:    6           

*       * Called By:  ON SELECTION BAR 2 OF POPUP 编辑e          

*       * Prompt:     粘贴                                       

*       * Snippet:    2                                          

*       *                                                        

*       *********************************************************
*
PROCEDURE _3lo0tz4m8
Procedure paste
_screen.ActiveForm.C_display.rst_dpy.Caption = Alltrim(_screen.ActiveForm.C_display.epn_dpy.Caption)
EndProc


梅尚程荀
马谭杨奚







                                                       
2012-09-20 14:03
有容就大
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:东土大唐
等 级:版主
威 望:74
帖 子:9048
专家分:14309
注 册:2011-11-11
收藏
得分:0 
呵呵 搞定了 原来不要加procedure 和 endproc

梅尚程荀
马谭杨奚







                                                       
2012-09-20 14:05
快速回复:菜单?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.072315 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved