need to figure out correct interaction between command, key, and menuitem elements
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 29 Nov 2005 22:13:23 +0000 (22:13 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 29 Nov 2005 22:13:23 +0000 (22:13 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@2126 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/main/menu.js
Open-ILS/xul/staff_client/server/main/menu_frame_menus.xul
Open-ILS/xul/staff_client/server/main/menu_frame_overlay.xul

index 56b0e23..d4f4277 100644 (file)
@@ -20,39 +20,43 @@ main.menu.prototype = {
                obj.panels = obj.tabbox.lastChild;
 
                var cmd_close_window = this.w.document.getElementById('cmd_close_window');
-                       if (cmd_close_window) 
-                               cmd_close_window.addEventListener('command', 
-                                       function() { 
-                                               obj.w.close(); 
-                                       }, false);
+                       if (cmd_close_window)  {
+                               var f = function() { obj.w.close(); };
+                               cmd_close_window.addEventListener('command', f, false);
+                               cmd_close_window.addEventListener('keypress', f, false);
+                       }
                        
                var cmd_new_window = this.w.document.getElementById('cmd_new_window');
-                       if (cmd_new_window)
-                               cmd_new_window.addEventListener('command', 
-                                       function() { 
-                                               obj.window.open('/xul/server/main/menu_frame.xul','test' + obj.window.appshell_name_increment++ ,'chrome'); 
-                                       }, false );
+                       if (cmd_new_window) {
+                               var f = function() { 
+                                       obj.window.open('/xul/server/main/menu_frame.xul','test' + obj.window.appshell_name_increment++ ,'chrome'); 
+                               };
+                               cmd_new_window.addEventListener('command', f, false );
+                               cmd_new_window.addEventListener('keypress', f, false );
+                       }
 
                var cmd_new_tab = this.w.document.getElementById('cmd_new_tab');
-                       if (cmd_new_tab)
-                               cmd_new_tab.addEventListener('command',
-                                       function(ev) {
-                                               obj.new_tab();
-                                       }, false );
+                       if (cmd_new_tab) {
+                               var f = function(ev) {
+                                       obj.new_tab();
+                               };
+                               cmd_new_tab.addEventListener('command', f, false );
+                               cmd_new_tab.addEventListener('keypress', f, true );
+                       }
 
                var cmd_close_tab = this.w.document.getElementById('cmd_close_tab');
-                       if (cmd_new_tab)
-                               cmd_close_tab.addEventListener('command',
-                                       function(ev) {
-                                               obj.close_tab();
-                                       }, false );
+                       if (cmd_new_tab) {
+                               var f = function(ev) { obj.close_tab(); };
+                               cmd_close_tab.addEventListener('command', f, false );
+                               cmd_close_tab.addEventListener('keypress', f, false );
+                       }
 
                var cmd_broken = this.w.document.getElementById('cmd_broken');
-                       if (cmd_broken)
-                               cmd_broken.addEventListener('command', 
-                                       function() { 
-                                               alert('Not Yet Implemented'); 
-                                       }, false);
+                       if (cmd_broken) {
+                               var f = function() { alert('Not Yet Implemented'); };
+                               cmd_broken.addEventListener('command', f, false);
+                               cmd_broken.addEventListener('keypress', f, false);
+                       }
                
        },
 
index 915e4cc..064ba74 100644 (file)
@@ -6,12 +6,13 @@
 <script>dump('loading menu_frame_menus.xul\n');</script>
 
 <commandset id="universal_cmds" />
+<keyset id="menu_frame_keys" />
 
 <!-- The File menu on the main menu -->
 <menu id="main.menu.file" label="&main.menu.file.label;" accesskey="&main.menu.file.key;" >
        <menupopup id="main.menu.file.popup">
                <menuitem label="&main.menu.file.new.label;" accesskey="&main.menu.file.new.key;" key="file-new-key" command="cmd_new_window"/>
-               <menuitem label="&main.menu.file.new_tab.label;" accesskey="&main.menu.file.new_tab.key;" key="file-new-tab-key" command="cmd_new_tab"/>
+               <menuitem label="&main.menu.file.new_tab.label;" accesskey="&main.menu.file.new_tab.key;" key="new-tab-key" onkeypress="alert('test');" command="cmd_new_tab"/>
                <menuseparator />
        <!--
                <menuitem label="&main.menu.file.open.label;" accesskey="&main.menu.file.open.key;" key="file-open-key" command="cmd_broken" disabled="true"/>
index 153c8ed..82b649f 100644 (file)
@@ -9,7 +9,7 @@
 <commandset id="universal_cmds">
        <command id="cmd_close_window" key="close-window-key" />
        <command id="cmd_new_window" key="new-window-key" />
-       <command id="cmd_new_tab" key="new-tab-key" />
+       <command id="cmd_new_tab" oncommand="alert('event.type = ' + event.type + '  event.target.nodeName = ' + event.target.nodeName );" />
        <command id="cmd_close_tab" key="close-tab-key" />
 
        <command id="cmd_cat_main" key="cat-main-key" />
@@ -39,7 +39,7 @@
 <!-- Accelerator Keys (Accessor Keys are in DTD's) -->
 <keyset id="menu_frame_keys">
        <key id="new-window-key" modifiers="accel" key="N" command="cmd_new_window"/>
-       <key id="new-tab-key" modifiers="accel" key="T" command="cmd_new_tab"/>
+       <key id="new-tab-key" modifiers="accel" key="T" />
        <key id="open-key" modifiers="accel" key="O" command=""/>
        <key id="save-key" modifiers="accel" key="S" command=""/>
        <key id="close-tab-key" modifiers="accel" key="W" command="cmd_close_tab"/>