回 帖 发 新 帖 刷新版面

主题:请教 gird 中 右键怎么用 (续)

[img]http://imgqun.qq.com/cgi-bin/img?uuid=20b4bd041e8dee061b160c955706eda044[/img]
那天cbl518老师回复后,今天有空研究了下。
能出现任意位置点击右键弹出一个可选菜单,[color=FF0000]但是不知道点击AAAAA(如上图)跳转到我想要的表单代码要写怎么写那里?[/color]我在gird的rightclick写入如下代码:

local otxt
otxt=sys(1270)
if atc("text",otxt.name)=0
    otxt=.f.
    return
endif
*添加右键信息
local nsellength
nsellength= otxt.sellength<=0
define popup shortcut shortcut relative from mrow(),mcol()
define bar 1 of shortcut prompt "AAAAAAA" ;
[color=FF0000]**是不是要在这里加入代码,应该怎么写?****[/color]
activate popup shortcut
deactivate popup shortcut
release popup shortcut
otxt=.f.

以上代码实现任意位置右击出现AAAAA,不知道是不是有缺陷。




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

以下是在上帖的说面
楼主
各位老师好,

    比如我做了一个表单,主要是用来查询用,里面有一个gird用来显示查询的结果,
如果我选中某条结果,想通过点击鼠标右键直接打开一个新的表单,这个表单可以看清这条结果的详细信息。
   我现在是暂时选中结果后,再点击另一个按钮,感觉比较麻烦。

按钮的代码大概如下:

SELECT lsjfcx          $$ lsjfcx是grid的数据源,也是一个临时表。
jfdh=ALLTRIM(单号)     $$ 单号是其中一个字段


SELECT XXX 
LOCATE for 单号=jfdh

jjghjfd=RECNO()
DO form xxxxx.scx

请问如果想通过直接点击右键,难后选择打开xxxxx.scx.可否实现。谢谢。 

回复列表 (共14个回复)

沙发

define popup shortcut shortcut relative from mrow(),mcol()
define bar 1 of shortcut prompt "AAAAAAA" 

**要在这里加入代码。
ON SELECTION BAR 1 OF shortcut MESSAGEBOX("执行命令!") 
activate popup shortcut
deactivate popup shortcut
release popup shortcut

板凳


define popup shortcut shortcut relative from mrow(),mcol()
define bar 1 of shortcut prompt "AAAAAAA" 

**要在这里加入代码。
ON SELECTION BAR 1 OF shortcut DO form xxxxx.scx

activate popup shortcut
deactivate popup shortcut
release popup shortcut



3 楼

define popup shortcut shortcut relative from mrow(),mcol()
define bar 1 of shortcut prompt "AAAAAAA" 
define bar 2 of shortcut prompt "bbbb" 

**是不是要在这里加入代码,应该这么写!!!****
ON SELECTION BAR 1 OF shortcut MESSAGEBOX("执行aaaa命令!")  
ON SELECTION BAR 2 OF shortcut MESSAGEBOX("执行bbbb命令!")  

activate popup shortcut
deactivate popup shortcut
release popup shortcut

4 楼

楼主搞了那么久都还不明白,我实在忍不住用了几分钟搞了个简单的"示范程序"
你看看是不是你要的效果:

下面是演示的效果的截图:

当单号为:20090102 (光标在本单号处)点右键即是:
[img]http://www.enhor.com/temp/001.jpg[/img]

点左键确认打开
[img]http://www.enhor.com/temp/005.jpg[/img]

第二个表单即是:(本单的详细内容)
[img]http://www.enhor.com/temp/002.jpg[/img]


而当单号为:20090103 (光标在本单号处)点右键即是:
[img]http://www.enhor.com/temp/003.jpg[/img]

点左键确认打开
[img]http://www.enhor.com/temp/006.jpg[/img]

第二个表单即是:(本单的详细内容)
[img]http://www.enhor.com/temp/004.jpg[/img]

(再花点时间改进一点)当单号的详细内容不存在时:
[img]http://www.enhor.com/temp/007.jpg[/img]

[img]http://www.enhor.com/temp/008.jpg[/img]

[img]http://www.enhor.com/temp/009.jpg[/img]

[img]http://www.enhor.com/temp/010.jpg[/img]

如果是你要的效果,我就将本示范程序发给你.....

5 楼

[quote]define popup shortcut shortcut relative from mrow(),mcol()
define bar 1 of shortcut prompt "AAAAAAA" 
define bar 2 of shortcut prompt "bbbb" 

**是不是要在这里加入代码,应该这么写!!!****
ON SELECTION BAR 1 OF shortcut MESSAGEBOX("执行aaaa命令!")  
ON SELECTION BAR 2 OF shortcut MESSAGEBOX("执行bbbb命令!")  

activate popup shortcut
deactivate popup shortcut
release popup shortcut
[/quote]

这次终于搞定了,很谢谢cbl老师。

主要是这句命令不会,现在知道了。早上做出来了。效果和预期的一样。很感谢。
ON SELECTION BAR 2 OF shortcut MESSAGEBOX("执行bbbb命令!")  

6 楼


谢谢foxdb,已经可以了,很感谢您的关心。但是我看到了你的菜单上有一个计算器。
很感兴趣,不知道怎么调用 的,可以分享下吗?

7 楼

菜单上计算器:有两个,一个是

VFP自带的,

调直接用  _mst_calcu  即可

另一个是WIN带的 calc.exe 直接运行即可(用shell来调用运行没有黑窗)

DECLARE INTEGER ShellExecute IN shell32.DLL INTEGER , STRING , STRING , STRING , STRING , INTEGER 
ShellExecute(0,"open","c:\windows\system32\calc.exe",0,0,1)

8 楼

调用 VFP 自带的计算器的命令是:
ACTIVATE WINDOW calculator

应该这样调用操作系统的计算器(就不会产生什么黑窗的。):
! /n calc.exe

9 楼

给 vfp 计算器 赋初始值:
_CALCMEM=12

获得  vfp 计算器 计算结果值:

? _CALCVALUE

10 楼

菜单:
define popup shortcut shortcut relative from mrow(),mcol()
define bar _mst_calcu of shortcut prompt "vfp计算器" 
define bar 1 of shortcut prompt "系统计算器" 
ON SELECTION BAR 1 OF shortcut ! /n calc.exe
activate popup shortcut
deactivate popup shortcut
release popup shortcut

我来回复

您尚未登录,请登录后再回复。点此登录或注册