一个想法(an idea)

Next
 From:  大道刀 (SUIYAN)
12027.1 
HI EveryOne

将moi.ini文件中的快捷键映射于相对应的工具按钮的鼠标停靠文字(Map the shortcut keys in the moi.ini file to the corresponding tool button mouse-over text),我掌握的方法用<moi:CommandButton title="shortcut key",但这样当快捷键发生修改时,鼠标停靠文字无法动态更新。能否通过脚本或代码,直接将moi.ini文件中快捷键的部分直接显示为鼠标停靠文字?
(The method I have mastered uses "<moi:CommandButton title="shortcut key"", but when the shortcut key is modified, the mouse hover text cannot be dynamically updated. Is it possible to use a script or code to directly display the shortcut key from the moi.ini file in the mouse hover text of the corresponding tool button?)
最好适用于v3+谢谢(Best for v3+ ,Thanks)

EDITED: 21 Jun 3:46 by SUIYAN

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
12027.2 In reply to 12027.1 
Hi SUIYAN,

It is possible to set the title="" property on command buttons with script like this:

code:
function SetButtonTitle( button )
{
	button.title = 'the title';
}

var panels = moi.ui.getUIPanels();

for ( var i = 0; i < panels.length; ++i )
{
	var panel = panels.item(i);
	var buttons = panel.document.getElementsByTagName( 'moi:CommandButton' );

	for ( var j = 0; j < buttons.length; ++j )
		SetButtonTitle( buttons[j] );
}


But the part that may be tricky is that any buttons on popup menus, dialog windows, or command sets will only be accessible after the menu/dialog/whatever is displayed.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  Michael Gibson
12027.3 In reply to 12027.1 
and the shortcut keys can be accessed by script like this: (Moi v4+ required):

code:
var shortcuts = moi.shortcutKeys.getShortcuts();

for ( var i = 0; i < shortcuts.length; ++i )
{
     var shortcut = shortcuts.item(i);
     
      var key = shortcut.key;
      var command = shortcut.command;
     
      moi.ui.alert( key + ' ' + command );
}
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All