Link to home
Start Free TrialLog in
Avatar of andrewmchorney
andrewmchorney

asked on

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
Avatar of ydsh
ydsh

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);                                                              

Avatar of andrewmchorney

ASKER

We will be trying out this solution shortly. Thanks for the quick response.

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


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.
This does not disable the close menu item or the close action for the window menu button.


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.
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
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
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.
ydsh

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

Andrew
ASKER CERTIFIED SOLUTION
Avatar of ydsh
ydsh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Solution and explaination was excellent.