Solved

Disable Main Window close button and pulldown

Posted on 1998-11-24
12
342 Views
Last Modified: 2013-12-26
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
Comment
Question by:andrewmchorney
  • 9
  • 3
12 Comments
 

Expert Comment

by:ydsh
ID: 1294399
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
 

Author Comment

by:andrewmchorney
ID: 1294400
We will be trying out this solution shortly. Thanks for the quick response.

Andrew
0
 

Author Comment

by:andrewmchorney
ID: 1294401
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
 

Author Comment

by:andrewmchorney
ID: 1294402
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
 

Author Comment

by:andrewmchorney
ID: 1294403
This does not disable the close menu item or the close action for the window menu button.


0
 

Author Comment

by:andrewmchorney
ID: 1294404
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:andrewmchorney
ID: 1294405
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
 

Expert Comment

by:ydsh
ID: 1294406
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
 

Author Comment

by:andrewmchorney
ID: 1294407
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
 

Author Comment

by:andrewmchorney
ID: 1294408
ydsh

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

Andrew
0
 

Accepted Solution

by:
ydsh earned 10 total points
ID: 1294409
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
 

Author Comment

by:andrewmchorney
ID: 1294410
Solution and explaination was excellent.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MFC Dialog 9 48
Windows Drag & Drop Location 2 94
Dell Alienware Graphics Amplifier Driver for non-Alienware systems 18 194
Excel file not created as expected 7 50
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now