ApModalWai Waiting indefinitely

Hey all,

Not sure if there’s a way around this, but here we go…

Basically, to display internal link modal dialogs/windows, I’ve been using
something similar to:

widg = ApCreateModule(…);

ApModalWait(widg, AP_MODAL_BLOCK | AP_EVENT_PROCESS);

This works wonderfully and is so simple compared to many of the examples
given. I have just recently found one problem with this implementation. If
I destroy the widget during it’s REALIZE callback, the widget does get
destroyed, but then ApModalWait appears to modal block waiting for a widget
to be destroyed that was already destroyed.

i.e…in RealizeCallback
{
if(network_error)
{
PtDestroyWidget(widget);
}

}

Any ideas on a nice way around this?


Thanx all,

Yamin

“Yamin” <y2bismil@uwaterloo.ca> wrote in message
news:aesd0e$pbh$1@inn.qnx.com

Hey all,

Not sure if there’s a way around this, but here we go…

Basically, to display internal link modal dialogs/windows, I’ve been
using
something similar to:

widg = ApCreateModule(…);

ApModalWait(widg, AP_MODAL_BLOCK | AP_EVENT_PROCESS);

This works wonderfully and is so simple compared to many of the examples
given. I have just recently found one problem with this implementation.
If
I destroy the widget during it’s REALIZE callback, the widget does get
destroyed, but then ApModalWait appears to modal block waiting for a
widget
to be destroyed that was already destroyed.

i.e…in RealizeCallback
{
if(network_error)
{
PtDestroyWidget(widget);
}

}

Any ideas on a nice way around this?


Thanx all,

Yamin

Hey all,

Well, I think I found a way out of my little problem. It works, but it’s
still a workaround…here it is.

Basically, what I do, is in the realize call back, I call PtUnrealizeWidget,
instead of PtDestroyWidget.

Then on return from ApCreateModule, I do a test.

if( WidgetisRealized(widget) )
{
ApModalWait(…)
}
else
{
PtDestroyWidget()
}


That seem safe to everyone?

Yamin

Yamin Bismilla <y2bismil@hotmail.com> wrote:

“Yamin” <> y2bismil@uwaterloo.ca> > wrote in message
news:aesd0e$pbh$> 1@inn.qnx.com> …
Hey all,

Not sure if there’s a way around this, but here we go…

Basically, to display internal link modal dialogs/windows, I’ve been
using
something similar to:

widg = ApCreateModule(…);

ApModalWait(widg, AP_MODAL_BLOCK | AP_EVENT_PROCESS);

This works wonderfully and is so simple compared to many of the examples
given. I have just recently found one problem with this implementation.
If
I destroy the widget during it’s REALIZE callback, the widget does get
destroyed, but then ApModalWait appears to modal block waiting for a
widget
to be destroyed that was already destroyed.

i.e…in RealizeCallback
{
if(network_error)
{
PtDestroyWidget(widget);
}

}

Any ideas on a nice way around this?


Thanx all,

Yamin



Hey all,

Well, I think I found a way out of my little problem. It works, but it’s
still a workaround…here it is.

Basically, what I do, is in the realize call back, I call PtUnrealizeWidget,
instead of PtDestroyWidget.

Then on return from ApCreateModule, I do a test.

if( WidgetisRealized(widget) )
{
ApModalWait(…)
}
else
{
PtDestroyWidget()
}



That seem safe to everyone?

Yamin

I am no expert on this, but what I usually did
was have a setup routine for a module (link instance
setup routine from PhAB), then if an
error occurred, I would return Pt_END from the
setup routine. ApModuleWait would then return.

Regards.