Bill Caroselli wrote:
Guest <> someadress@some.site.com> > wrote:
G > Bill Caroselli wrote:
A PhAB appliaction calls a startup() routine. While initializing the
system detects a error condition. So the startup routine does an
ApCreateModule() to pop-up a warning dialog. However, the warning
dialog is hidden behind the base window.
How can I pop-up the warning dialog in front of the base window?
G > I think if you set the parent widget of the pop up to the base window (
G > using ApModuleParent ), the pop up it will be placed in front of it.
Well, it sounded like a good guess. But it didn’t actually work.
You can’t set the parent to the base window before the base window is
created.
The code in question looks for certain A/D boards. It then does:
if( num_boards <= 0 )
{
ApModuleParent( ABM_NoBoards_dial, AB_PARENT, ABW_base );
This doesn’t work because ABW_base it NULL when you do it.
ApCreateModule( ABM_NoBoards_dial, ABW_base, 0 );
}
but the warning dialog is hidden by the main window. It doesn’t do
much good there!
For the record I also tried:
if( num_boards <= 0 )
{
ApCreateModule( ABM_NoBoards_dial, ABW_base, 0 );
ApModuleParent( ABM_NoBoards_dial, AB_PARENT, ABW_base );
Calling ApModuleParent() doesn’t affect widgets that have already been
created. And yeah, ABW_base is NULL here.
}
and:
if( num_boards <= 0 )
{
ApModuleParent( ABM_NoBoards_dial, AB_PARENT, ABW_base );
ApCreateModule( ABM_NoBoards_dial, 0, 0 );
}
I’m assuming that the problem is that the main window hasn’t been
realized yet when the dialog module is created.
The main window hasn’t even been created.
What is the standard procedure for having a dialog pop-up on top of
the main window when it is called for in a module initialization
startup function?
One way is to make the pop-up a force-front window, like I described in
the other thread. The down side of this is that the popup will stay in
front of any non-force-front windows, including other applications.
Personally, I would find that annoying in a desktop application; but in
your case it may be OK.
Another way is to move it back to the front in the main window’s
post-realize setup callback. But this will look ugly, because the main
window will cover the popup for a split second. Also, clicking on the
main window will move it to the front of the popup, which you probably
don’t want.
Yet another way would be to create but not realize the popup, and then
reparent it in the main window’s pre-realize setup function.
And, of course, you could make the main window not show up at all.