Thursday, 8 May 2014

How to create Menu & MainToolbar customize Keyboard shortcut ?

<zk>
  <zscript><![CDATA[
    changeLabel(int keyCode) {
      alert(keyCode);
    }
  ]]></zscript>
  <menubar ctrlKeys="@f" onCtrlKey="changeLabel(event.getKeyCode())">
    <menuitem id="file" label="File" />
    <menuitem id="new" label="New" onClick="alert(self.label)"/>
    <menuitem id="open" label="Open" onClick="alert(self.label)"/>
    <menuitem id="save" label="Save" onClick="alert(self.label)"/>
    <menuitem id="exit" label="Exit" onClick="alert(self.label)"/>
  </menubar>
</zk>

In MVVM you just set onCtrlKey="@command('yourcommand')" .

No comments:

Post a Comment