Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 354
  • Last Modified:

Disable Main Window close button and pulldown

I have some Xwindows/Motif programs in which we want to disable the double click close button at the upper left part of the window and the close menu item for the main window pulldown menu. I have no problems with the button and pulldown, I just want the automatic closing disabled.

Thanks,
Andrew
0
andrewmchorney
Asked:
andrewmchorney
  • 9
  • 3
1 Solution
 
ydshCommented:
Put the following codes into your program, suppose "toplevel" is the toplevel shell
of your program:
.
#include <Xm/MwmUtil.h>
.
        XtVaSetValues(toplevel,
               XmNmwmDecorations,MWM_DECOR_TITLE|MWM_DECOR_BORDER
                                    |MWM_DECOR_MINIMIZE|MWM_DECOR_MENU,
               XmNmwmFunctions, MWM_FUNC_MOVE|MWM_FUNC_MINIMIZE,
               NULL);                                                              

0
 
andrewmchorneyAuthor Commented:
We will be trying out this solution shortly. Thanks for the quick response.

Andrew
0
 
andrewmchorneyAuthor Commented:
Could you explain the lines of code as to how they relate to disabling action on main window close and main window close pulldown.


0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
andrewmchorneyAuthor Commented:
Another suggestion from engineers is to trap the close on the close button and window close menu item and treat is as though the exit button was selected.
0
 
andrewmchorneyAuthor Commented:
This does not disable the close menu item or the close action for the window menu button.


0
 
andrewmchorneyAuthor Commented:
I just talked to a technical support person at ICS whose product we bought to do window development. Apparently disabling the close button in CDE may not be possible.
0
 
andrewmchorneyAuthor Commented:
ydsh

The solution does work under CDE. Post a message to this question and I will declare the question answered and you will get credit for the question with a grade of "A".

Andrew
0
 
ydshCommented:
Dear Mr. andrewmchorney,
 
  I have to tell you that my solution works both on HP VUE and CDE. Besides, I have ported
the codes to Solaris2.5 which also has the CDE, and it works fairly well.
  As to the following definitions:
                    MWM_DECOR_TITLE|MWM_DECOR_BORDER
                    |MWM_DECOR_MINIMIZE|MWM_DECOR_MENU,
I suggest that you should refer to the Motif development books.
Good luck.

   yours
      ydsh
0
 
andrewmchorneyAuthor Commented:
ydsh

I had to put the code into the class constructor for the builder accessory code and it works quite well. Your solution was excellent.
0
 
andrewmchorneyAuthor Commented:
ydsh

declare the solution and I will accept the answer and you will get the points and a grade of A.

Andrew
0
 
ydshCommented:
Dear Mr. andrewmchorney,
    Generally speaking, there's two resources which are used frequestly with the
toplevel shell, as the name called, one is related to the decoration of the window
manager(XmNmwmDecorations), while the other is related to the functionality of the window menu(XmNmwmFunctions):
     MWM_DECOR_TITLE :        displaying  the window title bar
     MWM_DECOR_BORDER : displaying  allow the window border
     MWM_DECOR_MINIMIZE:   allowing the window to be minimized
     MWM_DECOR_MENU:        allowing the window menu to be displayed
     ... ( there's still other options which should not be chosen here...)

     MWM_FUNC_MOVE:           allowing the window to be moved
     MWM_FUNC_MINIMIZE:      allowing the window to be minimized

    As you can see here, there's no MWM_FUNC_CLOSE here which allow the window close
button to be displayed, so you can no longer close the window by press that button or double-click the left-right corner of the window.

    Have I presented a clear solution? :-)  Anyway, if any problem, please e-mail me at:
ydsh@hotmail.com, I am really interested in discussing such problems on Motif and UNIX programming. You are welcome!

yours,
   ydsh
0
 
andrewmchorneyAuthor Commented:
Solution and explaination was excellent.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 9
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now