I would like to display a window that is on top an remains on top off all others, that is in the center of the screen and that cannot be move. Are the any construction time parameters to do this ?
I hope not!!! Consider the fact that I may want to run your application, and another one with the same "god like" attitude. Which one wins????? Hopefully not yours, not the other one, but the one that I _want_ to be displayed above all others. Which simply means that it is not your applications place to decide the policy that _I_ want!!!!!
rwscott identifies a problem with what you want -- multiple applications can fight for the top-most real-estate.
Usually, it is enough for a dialog to remain above its parent window, which mwm, twm, and several other window managers do automatically.
If you have another need, then you need to reconsider your user interface. Some people want a status window constantly displayed in the foreground; that status could perhaps be part of the application`s main window, or it could be brought to the foreground only when some new information is displayed within it.
There are some window managers which do offer an option for designating a window to be in the foreground, but I don`t know how they arbitrate among various applications wanting this service. I am told that fvwm offers this feature. To do this right, you would need window manager cooperation and arbitration.
I asked how to do it. I did not ask for a moral mister "I`m a genius in GUI behaviors." Do you know what type of app I`m programming ? Do you know why I need to have those features ? No you don`t. So since you don`t have all the facts, your opinion is worthless.
A possible way to do this is to create your widget tree with an overideshell widget as the root since the configuration request for overideridshell will not be intercepted by the window manager. Unfortunately, a side effect of this method is that your window will not have the title bar, min/max buttons and side decorates. No big deal if you really want your window to behave like this, you could create the title bar and other decorates yourself. To make your window always stay on top, you need to handle the VisibilityNotify event, when youe see your window is obscured, then you raise it. Hope this will work for you.
But what if you try to run 2 copies of this application? Your system will be hung up.
Sorry, I know it is bad form to reply to something like this, but I`m in the mood )
You are right, I`m sure you always are!! I do not know the type of app, or why you think you need these features. To me, your question sounded like "I really don`t know what I`m doing, but I would like to have absolute control over a users environment. Can you help me?" I could, but your reponse just reinforces my feeling of "I really don`t know what I`m doing" If your app, or reason for needing these features is really valid, you need to be forcing your users to use your window manager. Sorry for being so blunt, but in my opinion, if you really understood the consequences of what you want, you would know which man pages to read to make it happen.
I`m working for a small company that makes medical software. When we sell our systems, only our software is installed on the machine, nothing else. The computer is used only for one pupose, running our software. We have multiple versions, builds and releases of our software. To help our QA dept. we`ve decided to add a new feature in our app a splash screen. Now do you get the center, top and no move ? -)
I like Motif`s auto-raising windows, but often lose my dialog boxes underneath the underlying windows, so I can sympathise with your situation.
However, one thing I`ve just noticed, that might help you, is that `transient` windows always seem to stay on top of their associated window, great ! I use Tcl/Tk for my gooey stuff, but I`m sure Motif uses the term `transient` too.
Alternatively, if you`re only running the one application, you might want to run it *instead* of mwm, just replace `exec mwm` with exec your application in your .xinitrc. You won`t have any captions or iconify buttons, and you won`t be able to move your windows around with the mouse, but will appear where you put them and stay there until you remove them. When you exit the application, you`ll also exit X, which is probably acceptable for a custom-built system.
Usually, a "splash screen" or introductory screen is the only window displayed by the application, while it is starting up. Here is some information that you can use to create this screen, with sample code
Note that the code doesn`t make an effort to keep the screen on top of whatever other applications are running, mostly because it pays attention to what you`d call the moralizing arguments capitulated in this other discussion
I think, also, that the nature of this forum is such that it`s reasonable for people to question why someone would want to do a particular feature; rather than give you enough rope to hang yourself, as it were, we`d rather keep you from making a noose. There are many, many pitfalls in dealing with this software.
You can make the window MODAL to start with. Then you can add an eventhandler for the VisibilityChangeMask. In the callback method you can check the xvisibility state and have you popup method called if the state is obscured (partially or fully).
While this behavior is not recommended, the following demonstrates one way of restricting the user`s interaction.
This program displays an information dialog which occupies
the entire screen. This window stays on top and cannot be moved
or lowered. Selecting "Cancel" will terminate this test program.
#include
#include
#include
#include /* For MWM_DECOR_ALL */
/* Create a pushbutton whose callback pops up a dialog box */
main(argc, argv)
int argc;
char *argv[];
{
XtAppContext app;
Widget toplevel,
dialog;
XmString str;
Display *display;
Arg args[10];
int decor,
mwm_functions,
ia = 0;
/*
* Control what is displayed around the window frame, i.e
* nothing.
*/
decor = 0;
decor &= ~MWM_DECOR_ALL;
XtSetArg (args[ia], XmNmwmDecorations, decor); ia++;
/*
* Control what MWM functions (resize/move/close etc.) are
* available. We don`t want any controls available.
*/
mwm_functions = 0;
mwm_functions &= ~MWM_FUNC_ALL;
XtSetArg (args[ia], XmNmwmFunctions, mwm_functions); ia++;
I like Motif`s auto-raising windows, but often lose my dialog boxes underneath the underlying windows, so I can sympathise with your situation.
However, one thing I`ve just noticed, that might help you, is that `transient` windows always seem to stay on top of their associated window, great ! I use Tcl/Tk for my gooey stuff, but I`m sure Motif uses the term `transient` too.
Alternatively, if you`re only running the one application, you might want to run it *instead* of mwm, just replace `exec mwm` with exec your application in your .xinitrc. You won`t have any captions or iconify buttons, and you won`t be able to move your windows around with the mouse, but will appear where you put them and stay there until you remove them. When you exit the application, you`ll also exit X, which is probably acceptable for a custom-built system.
Center, top an no move
I hope not!!! Consider the fact that I may want to run your application, and another one with the same "god like" attitude. Which one wins????? Hopefully not yours, not the other one, but the one that I _want_ to be displayed above all others. Which simply means that it is not your applications place to decide the policy that _I_ want!!!!!
Center, top an no move
rwscott identifies a problem with what you want -- multiple applications can fight for the top-most real-estate.
Usually, it is enough for a dialog to remain above its parent window, which mwm, twm, and several other window managers do automatically.
If you have another need, then you need to reconsider your user interface. Some people want a status window constantly displayed in the foreground; that status could perhaps be part of the application`s main window, or it could be brought to the foreground only when some new information is displayed within it.
There are some window managers which do offer an option for designating a window to be in the foreground, but I don`t know how they arbitrate among various applications wanting this service. I am told that fvwm offers this feature. To do this right, you would need window manager cooperation and arbitration.
Center, top an no move
I asked how to do it. I did not ask for a moral mister "I`m a genius in GUI behaviors." Do you know what type of app I`m programming ? Do you know why I need to have those features ? No you don`t. So since you don`t have all the facts, your opinion is worthless.
Center, top an no move
A possible way to do this is to create your widget tree with an overideshell widget as the root since the configuration request for overideridshell will not be intercepted by the window manager. Unfortunately, a side effect of this method is that your window will not have the title bar, min/max buttons and side decorates. No big deal if you really want your window to behave like this, you could create the title bar and other decorates yourself. To make your window always stay on top, you need to handle the VisibilityNotify event, when youe see your window is obscured, then you raise it. Hope this will work for you.
But what if you try to run 2 copies of this application? Your system will be hung up.
Center, top an no move
HI,
I`m curious what sort of app would need to be always on top.
Can you tell us?
-scorch
Center, top an no move
Sorry, I know it is bad form to reply to something like this, but I`m in the mood )
You are right, I`m sure you always are!! I do not know the type of app, or why you think you need these features. To me, your question sounded like "I really don`t know what I`m doing, but I would like to have absolute control over a users environment. Can you help me?" I could, but your reponse just reinforces my feeling of "I really don`t know what I`m doing" If your app, or reason for needing these features is really valid, you need to be forcing your users to use your window manager. Sorry for being so blunt, but in my opinion, if you really understood the consequences of what you want, you would know which man pages to read to make it happen.
Nuff` said. Good luck....
Center, top an no move
Sure.
I`m working for a small company that makes medical software. When we sell our systems, only our software is installed on the machine, nothing else. The computer is used only for one pupose, running our software. We have multiple versions, builds and releases of our software. To help our QA dept. we`ve decided to add a new feature in our app a splash screen. Now do you get the center, top and no move ? -)
Thanks cth2000 for your help.
Center, top an no move
I like Motif`s auto-raising windows, but often lose my dialog boxes underneath the underlying windows, so I can sympathise with your situation.
However, one thing I`ve just noticed, that might help you, is that `transient` windows always seem to stay on top of their associated window, great ! I use Tcl/Tk for my gooey stuff, but I`m sure Motif uses the term `transient` too.
Alternatively, if you`re only running the one application, you might want to run it *instead* of mwm, just replace `exec mwm` with exec your application in your .xinitrc. You won`t have any captions or iconify buttons, and you won`t be able to move your windows around with the mouse, but will appear where you put them and stay there until you remove them. When you exit the application, you`ll also exit X, which is probably acceptable for a custom-built system.
Hope this helps,
Dave.
Center, top an no move
I get it.
I like to use a system modal dialog, but I imagine your design constraints are such that you need to take over more control.
Sounds cool!
-scorch
Center, top an no move
Actually, this isn`t a great suggestion, because applications need the window manager to install colormaps and to arbitrate focus among windows.
Center, top an no move
Usually, a "splash screen" or introductory screen is the only window displayed by the application, while it is starting up. Here is some information that you can use to create this screen, with sample code
http//www.motifzone.com/tmd/tmd_letter_archive.html#intro_screen
Note that the code doesn`t make an effort to keep the screen on top of whatever other applications are running, mostly because it pays attention to what you`d call the moralizing arguments capitulated in this other discussion
http//www.motifzone.com/tmd/tmd_letter_archive.html#wm_stuff
I think, also, that the nature of this forum is such that it`s reasonable for people to question why someone would want to do a particular feature; rather than give you enough rope to hang yourself, as it were, we`d rather keep you from making a noose. There are many, many pitfalls in dealing with this software.
Center, top an no move
Thanks dbl
Center, top an no move
Fairy nuff.
Center, top an no move
You can make the window MODAL to start with. Then you can add an eventhandler for the VisibilityChangeMask. In the callback method you can check the xvisibility state and have you popup method called if the state is obscured (partially or fully).
Center window
I would like to display a window that is in the center of the screen. Because I am beginner in CDE/MOTIF, can you send me a whole resource in C++?
Thank You
Center, top an no move
While this behavior is not recommended, the following demonstrates one way of restricting the user`s interaction.
This program displays an information dialog which occupies
the entire screen. This window stays on top and cannot be moved
or lowered. Selecting "Cancel" will terminate this test program.
#include
#include
#include
#include /* For MWM_DECOR_ALL */
/* Create a pushbutton whose callback pops up a dialog box */
main(argc, argv)
int argc;
char *argv[];
{
XtAppContext app;
Widget toplevel,
dialog;
XmString str;
Display *display;
Arg args[10];
int decor,
mwm_functions,
ia = 0;
XtSetLanguageProc (NULL, NULL, NULL);
toplevel = XtVaAppInitialize(&app, "Demos", NULL, 0, &argc,
argv, NULL,
XtNmappedWhenManaged, False,
NULL);
XtSetArg (args[ia], XmNautoUnmanage, False); ia++;
/*
* Control what is displayed around the window frame, i.e
* nothing.
*/
decor = 0;
decor &= ~MWM_DECOR_ALL;
XtSetArg (args[ia], XmNmwmDecorations, decor); ia++;
/*
* Control what MWM functions (resize/move/close etc.) are
* available. We don`t want any controls available.
*/
mwm_functions = 0;
mwm_functions &= ~MWM_FUNC_ALL;
XtSetArg (args[ia], XmNmwmFunctions, mwm_functions); ia++;
dialog = XmCreateInformationDialog (toplevel, "notice",
args, ia);
XtAddCallback (dialog, XmNcancelCallback, exit, 0);
XtUnmanageChild (XmMessageBoxGetChild(dialog,
XmDIALOG_OK_BUTTON));
XtUnmanageChild (XmMessageBoxGetChild(dialog,
XmDIALOG_HELP_BUTTON));
display = XtDisplay(dialog);
str = XmStringCreateLocalized ("Here is my message!");
XtVaSetValues (dialog,
XmNmessageString, str,
XmNdialogStyle, XmDIALOG_SYSTEM_MODAL,
XtNwidth,
DisplayWidth(display,
DefaultScreen(display)),
XmNdialogStyle, XmDIALOG_SYSTEM_MODAL,
XtNwidth, DisplayWidth(display,
DefaultScreen(display)),
XtNheight, DisplayHeight(display,
DefaultScreen(display)),
XmNnoResize, True,
NULL);
XmStringFree (str);
XtManageChild (dialog);
/* Realize toplevel (and it`s children). */
XtRealizeWidget (toplevel);
XtPopup (toplevel, XtGrabNone);
XtAppMainLoop (app);
} /* End main(). */
I like Motif`s auto-raising
I like Motif`s auto-raising windows, but often lose my dialog boxes underneath the underlying windows, so I can sympathise with your situation.
However, one thing I`ve just noticed, that might help you, is that `transient` windows always seem to stay on top of their associated window, great ! I use Tcl/Tk for my gooey stuff, but I`m sure Motif uses the term `transient` too.
Alternatively, if you`re only running the one application, you might want to run it *instead* of mwm, just replace `exec mwm` with exec your application in your .xinitrc. You won`t have any captions or iconify buttons, and you won`t be able to move your windows around with the mouse, but will appear where you put them and stay there until you remove them. When you exit the application, you`ll also exit X, which is probably acceptable for a custom-built system.
Hope this helps,
Andrew - poker calculator