如何给动态生成的ActiveBar加快捷键

qpalzmn001 2010-03-15 01:35:55
如题,我用aTool.ShortCuts = "Alt+N"提示 “对象 shortcuts 的方法 itool 失败”
请问我应该怎么添加,谢谢
...全文
163 17 打赏 收藏 转发到动态 举报
写回复
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
cqq_chen 2010-03-23
  • 打赏
  • 举报
回复
常用F1对你会有很大的帮助!!!
Sets or returns a string array of shortcut keys for the tool.

Syntax
[form!]Tool.ShortCuts[ = value As Variant ]

Remarks
The first element in the array will be displayed on the menu as the default shortcut.

To assign values to the ShortCuts property you must first declare a string array as a New shortcut type. You can then use the shortcut value property to assign values to the array items. You can use "Alt", "Control" and "Shift" in the string to specify the <Alt>, <Control> and <Shift> keys respectively. You must spell out the words "Control" and "Shift". The shortcut must be specified in Alt, Control, Shift order. Entering "Control+Alt+N" will generate an error. There cannot by any spaces within the string.

To clear a shortcut, user the shortcut clear method.

Example
Assign Shortcuts:

Private Sub CreateStandardTools()
Dim oTool As Tool
Dim saShortcuts(4) As New ShortCut
' Shortcuts
saShortcuts(0).Value = "Control+Shift+A"
saShortcuts(1).Value = "Control+B"
saShortcuts(2).Value = "Alt+Control+C"
saShortcuts(3).Value = "Alt+O"
saShortcuts(4).Value = "F8"

Set oTool = ActiveBar2.Tools.Add(GetUniqueToolID(), "Open")
oTool.ControlType = ddTTButton
oTool.Caption = "&Open"
oTool.Shortcuts = saShortcuts
End Sub


Clear Shortcut:

Dim saShortcuts(4) As New ShortCut
' Shortcuts
saShortcuts(0).Clear
saShortcuts(1).Clear
saShortcuts(2).Clear
saShortcuts(3).Clear
saShortcuts(4).Clear

ActiveBar2.Tools("Open").Shortcuts = saShortcuts


Data Type
shortcut
qpalzmn001 2010-03-23
  • 打赏
  • 举报
回复
还有像是ESC键怎么表达,谢谢
qpalzmn001 2010-03-23
  • 打赏
  • 举报
回复
谢谢,再问一下,如果我是想ALT+N的话我应该怎么用,ALT好像他是不认的Alter也没用
cqq_chen 2010-03-23
  • 打赏
  • 举报
回复
Dim saShortcuts(4) As New ShortCut
cqq_chen 2010-03-23
  • 打赏
  • 举报
回复
这个控件所有的属性都是区分大小写
qpalzmn001 2010-03-23
  • 打赏
  • 举报
回复
谢谢了,我也晕了,我用了大写的ALT他就不认得了,用Alt就可以。。。真晕。。
cqq_chen 2010-03-22
  • 打赏
  • 举报
回复
我一直在用2.0,没有出现你说的问题,设置方式如上
cqq_chen 2010-03-22
  • 打赏
  • 举报
回复
With ActiveBar
saShortcuts(0).Value = "Control+N"
.Tools("tNew").ShortCuts = saShortcuts
qpalzmn001 2010-03-22
  • 打赏
  • 举报
回复
请问saShortcuts(0).Value 是什么控件?
qpalzmn001 2010-03-17
  • 打赏
  • 举报
回复
我的就是ActiveBar3.0,我也是新用,听说还挺有名的
  • 打赏
  • 举报
回复
楼主,我们讲的好像不是同个控件,我的是Sheridan active toolbar plus(记忆中),您的呢?
qpalzmn001 2010-03-16
  • 打赏
  • 举报
回复
我用的是3.0,没有你说的那个属性,只有我这个
qpalzmn001 2010-03-16
  • 打赏
  • 举报
回复
to三楼:不行啊,我就是这么做的了,这样ssCtrlA就变成一个变量了,提示我未定义了!
我的代码
    '新增btn
Set aTool = modeAcBar.Bands("Ttools").Tools.Add(5, "TbtnAddnew")
aTool.ControlType = ddTTButton
aTool.Style = ddSIconText
aTool.Caption = "新增(&N)"
'aTool.ShortCuts = ssCtrlA
aTool.SetPicture index:=0, Picture:=MDIForms.ImageList1.ListImages("Addnew").Picture, Color:=&HC0C0C0
aTool.Visible = True
贝隆 2010-03-15
  • 打赏
  • 举报
回复
UPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUP
  • 打赏
  • 举报
回复
试试
Dim ctl As SSTool

Set ctl = SSActiveToolBars1.Tools.Add("K1")
ctl.Shortcut = ssCtrlA
Tiger_Zhao 2010-03-15
  • 打赏
  • 举报
回复
你用哪个 ActiveBar?
Tool 对象只有 ShortcutKey As Long 属性。
qpalzmn001 2010-03-15
  • 打赏
  • 举报
回复
上个贴标题搞错了,把ActiveBar和Spread搞晕了,再开提问。。。
相关推荐

1,445

社区成员

发帖
与我相关
我的任务
社区描述
VB 控件
社区管理员
  • 控件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告