DISABLING ALT-F4 FOR A SPECIFIC WINDOW.

ITEM: RTA000031440



QUESTION:                                                                       
Is it possible to disable the use of ALT-F4 by X Windows for a single           
window?  There is an application that makes use of Alt-F4 to mark text.         
When the combination is used, the window is closed, which is obviously          
undesirable.                                                                    
                                                                                
---------- ---------- ---------- --------- ---------- ----------                
A: I successfully disabled the ALT-F4 window close action with                  
   AIX 3.2.3 extended (X11r5) using the following steps:                        
                                                                                
   To override the default window menu, I created my own menu.                  
   This entry was placed in my user's $HOME/.mwmrc defaults file:               
                                                                                
    Menu BobDaveMenu                                                            
    {                                                                          
        "Restore"   _R      AltF5      f.normalize                         
        "Move"      _M      AltF7      f.move                              
        "Size"      _S      AltF8      f.resize                            
        "Minimize"  _n      AltF9      f.minimize                          
        "Maximize"  _x      AltF10     f.maximize                          
        "Lower"     _L      AltF3      f.lower                             
        no-label                            f.separator                         
        "Close"     _C                      f.kill                              
    }                                                                           
                                                                                
   Note: This is exactly the same window menu as the DefaultWindowMenu,         
   but the "AltF4" definition in the "Close" line has been removed.        
   The BobDave menu is enclosed within curly brackets which may not             
   translate properly.                                                          
                                                                               
   So that the window manager knows to use the BobDave window menu,             
   I placed the following line in my $HOME/.Xdefaults file:                     
                                                                                
    Mwm*BobDave*WindowMenu:       BobDaveMenu                                   
                                                                                
   This instructs the window manager to use the BobDaveMenu for all             
   windows with the resource name BobDave.                                      
                                                                                
   To test the new definition, I restarted the window manager.  I then          
   used the -name flag to identify this particular aixterm with the             
   resource name BobDave as below:                                              
                                                                                
    aixterm -name BobDave                                                       
                                                                                
   Once the BobDave aixterm had been opened, it could not be closed with       
   the ALTF4 key combination.  These changes only affected the             
   BobDave aixterm.  No other operations of the BobDave aixterm were            
   affected.                                                                    
                                                                                
   When testing your question I made the following notes:                       
                                                                                
   -This test was unsuccessful with AIX 3.2.2 and AIXWindows 1.2.2.             
    The problem was fixed with AIX 3.2.3 and AIXWindows 1.2.3 (X11r5.)          
    It is possible that your application was already written to suppress        
    the ALTF4 close action, but you may need to upgrade your               
    AIXWindows lpp to obtain this fix.                                          
                                                                                
    To suppress the AltF4 close action on AIXWindows 1.2.2, it was         
    necessary to redefine the DefaultWindowMenu to us an alternative            
    key combination to close the window.  Unfortunately this change            
    affected all the windows on that Xsession.                                  
                                                                                
   -The 3.2.3 extended /usr/lib/X11/system.mwmrc, has a "NoAccWindowMenu"       
    menu defined that has all the Alt actions removed.   If you have       
    further translation problems, it may be easier to use this window           
    menu for your application as opposed to defining your own.  This            
    can be accomplished by assigning your application's resource name           
    in your $HOME/.Xdefaults to use the NoAccWindowMenu.                        
                                                                                
   -You will need to find the resource name of your application.                
    Once the resource name of you application has been obtained, simply         
    replace the "BobDave" resource name from my example, with the               
    resource name of your application.                                          
                                                                                
---------- ---------- ---------- --------- ---------- ----------               
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
This item was created from library item Q629335      CFTFF                      
                                                                                
Additional search words:                                                        
AIXWINDOWS ALT CFTFF DISABLING ENVIRONMENT F4 IX JUN93 RISCSYSTEM               
RISCXWIN SOFTWARE SPECIFIC WINDOW                                               
                                                                                
                                                                                
                                                                                
                                                                                
                                                                               


WWQA: ITEM: RTA000031440 ITEM: RTA000031440
Dated: 11/1996 Category: RISCXWIN
This HTML file was generated 99/06/24~12:43:12
Comments or suggestions? Contact us