Dialog on Top

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?

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?
I think if you set the parent widget of the pop up to the base window (

using ApModuleParent ), the pop up it will be placed in front of it.

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?

What you really want is to make the base window pop up behind the
warning dialog, right? :slight_smile: If I understand correctly, you’re
creatinging the dialog in a PhAB initialization function, before your
base window exist – is that correct?

You could make the dialog a force-front window, but that would make it
impossible to move it behind any non-force-front window. Would that
be OK?

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.

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

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?

Wojtek Lerch <Wojtek_L@yahoo.ca> wrote:
WL > 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?

WL > What you really want is to make the base window pop up behind the
WL > warning dialog, right? :slight_smile: If I understand correctly, you’re
WL > creatinging the dialog in a PhAB initialization function, before your
WL > base window exist – is that correct?

Yes!

WL > You could make the dialog a force-front window, but that would make it
WL > impossible to move it behind any non-force-front window. Would that
WL > be OK?

This would be OK. When the user hits the “OK” button on the dialog the
whole application terminates.

Where do I find the “force_front” flag?

Wojtek Lerch <Wojtek_L@yahoo.ca> wrote:
WL > Bill Caroselli wrote:

Where do I find the “force_front” flag?

WL > Set Ph_WM_STATE_ISFRONT in Pt_ARG_WINDOW_STATE.

That did the trick.

Thank you!

Bill Caroselli wrote:

Where do I find the “force_front” flag?

Set Ph_WM_STATE_ISFRONT in Pt_ARG_WINDOW_STATE.

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.

New dialog question.

I have a dialog created with PhAB and called into existance with a
Dialog type callback from an activate callback.

The Dialog is dismissed (unrealized?) with a “Done” type callback.

All works well for the first iteration. When I click on the activate
callback to re-establish the dialog my program crashes.

There is a setup function for this dialog. It simply populates several
text status strings.

Why is my program crashing? How can I get this to work?

Bill Caroselli wrote:

New dialog question.

I have a dialog created with PhAB and called into existance with a
Dialog type callback from an activate callback.

The Dialog is dismissed (unrealized?) with a “Done” type callback.

Destroyed.

All works well for the first iteration. When I click on the activate
callback to re-establish the dialog my program crashes.

There is a setup function for this dialog. It simply populates several
text status strings.

Why is my program crashing? How can I get this to work?

It should work. A lot of apps have a dialog like that. Can you
reproduce this crash with a minimal PhAB app with two windows and
nothing but one button in each window?

Wojtek Lerch <Wojtek_L@yahoo.ca> wrote:
WL > Bill Caroselli wrote:

New dialog question.

I have a dialog created with PhAB and called into existance with a
Dialog type callback from an activate callback.

The Dialog is dismissed (unrealized?) with a “Done” type callback.

WL > Destroyed.

All works well for the first iteration. When I click on the activate
callback to re-establish the dialog my program crashes.

There is a setup function for this dialog. It simply populates several
text status strings.

Why is my program crashing? How can I get this to work?

WL > It should work. A lot of apps have a dialog like that. Can you
WL > reproduce this crash with a minimal PhAB app with two windows and
WL > nothing but one button in each window?

Thank you. I found this problem. It was my fault.

I’m very good at QNX coding but I’m still a newbie at Photon
programming. What the hell. I’m color blind too and no one ever likes
the screens I make up anyway. Life was much better when we had a
seperate Photon programmer!