managing dialogs

Hi,

I am trying to manage, or realize, a simple dialog. I am using PhAB and the
stuff seems to be hidden.

I can “realize” the PtWindow with the use of Menus and using “Dialog Module
type” callbacks. But I can’t seem to manage the window with source code.

What I’m trying to do is bring up a main window. When the user does this,
they have to chose the file menu->New. When they do this, they must select
a particular configuration. Depending on that configuration, a different
dialog will occur.

When they hit the “OK” button on the configuration window, the configuration
window should go away and the particular dialog should REALIZE.

I can get the Configuration window to disappear, but I cannot figure out how
to realize the particular dialog.


I make the configuration window go away by doing getting the parent of the
OK button and then Unrealizing it:

PtWidget_t *parent;

parent = PtWidgetParent(widget);
PtUnrealizeWidget(parent);



But then I need to do the following switch:


switch (currentScenario.weaponIndex)
{
case AGM_65:
/* MANAGE AGM_65 dialog */


break;
case AGM_130:

/* MANAGE AGM_130 dialog */
break;
case AIM_120:
break;

default:
printf(“UNKNOWN WEAPON!\n”);
}

I have tried to get the parent of widgets on the AGM_65 window
(ABW_AGM65WeaponPowerToggleButton is a widget on the AGM65 dialog)

parent = PtWidgetParent(ABW_AGM65WeaponPowerToggleButton);

but when I “Unrealize” this parent, it returns a -1.

I have tried to get the parent type of this toggle button.

parent = PtGetParent(ABW_AGM65WeaponPowerToggleButton, PtWindow);

but this returns a NULL value.

I have also just tried to unrealize the widget that I thought was the
window. The instance name I gave the AGM65 window is:

AGM65

So there is a widget created by PhAB called ABW_AGM65, but that doesn’t work
either. It returns a -1.

So…I don’t know what to do. I’m almost ready to send a phake event to the
menu button. But…that seems extreme. In my experience, this should be
easy. Can someone please tell me what little piece I am missing?

Thansk so much…

Hi David,

If I understand you correctly, you want to bring up different dialogs from the
same
button (or menu selection) based on other criteria.
You should design your dialogs in PhAB, and create Internal Links for each of
them.
Then in the ACTIVATE callback for the button, call ApCreateWidget using the
ABM…
manifest (from the internal link).

Example :

PtButton_Test_Activate_Callback(…)
{
switch (Criteria)
{
case 1 :
ApCreateWidget(ABM_PtDialog_1, widget, cbinfo);
break;
case 2 :
ApCreateWidget(ABM_PtDialog_2, widget, cbinfo);
break;
.
.
.
}

return (Pt_CONTINUE);
}

If this is what you want, and you still cannot get it to work, reply to this
message or send me an Email, and I will send you a small
example which you can compile.

Ian Todd,
NDT Technologies Inc.
iantodd@sympatico.ca



David Hurlburt wrote:

Hi,

I am trying to manage, or realize, a simple dialog. I am using PhAB and the
stuff seems to be hidden.

I can “realize” the PtWindow with the use of Menus and using “Dialog Module
type” callbacks. But I can’t seem to manage the window with source code.

What I’m trying to do is bring up a main window. When the user does this,
they have to chose the file menu->New. When they do this, they must select
a particular configuration. Depending on that configuration, a different
dialog will occur.

When they hit the “OK” button on the configuration window, the configuration
window should go away and the particular dialog should REALIZE.

I can get the Configuration window to disappear, but I cannot figure out how
to realize the particular dialog.

I make the configuration window go away by doing getting the parent of the
OK button and then Unrealizing it:

PtWidget_t *parent;

parent = PtWidgetParent(widget);
PtUnrealizeWidget(parent);

But then I need to do the following switch:

switch (currentScenario.weaponIndex)
{
case AGM_65:
/* MANAGE AGM_65 dialog */

break;
case AGM_130:

/* MANAGE AGM_130 dialog */
break;
case AIM_120:
break;

default:
printf(“UNKNOWN WEAPON!\n”);
}

I have tried to get the parent of widgets on the AGM_65 window
(ABW_AGM65WeaponPowerToggleButton is a widget on the AGM65 dialog)

parent = PtWidgetParent(ABW_AGM65WeaponPowerToggleButton);

but when I “Unrealize” this parent, it returns a -1.

I have tried to get the parent type of this toggle button.

parent = PtGetParent(ABW_AGM65WeaponPowerToggleButton, PtWindow);

but this returns a NULL value.

I have also just tried to unrealize the widget that I thought was the
window. The instance name I gave the AGM65 window is:

AGM65

So there is a widget created by PhAB called ABW_AGM65, but that doesn’t work
either. It returns a -1.

So…I don’t know what to do. I’m almost ready to send a phake event to the
menu button. But…that seems extreme. In my experience, this should be
easy. Can someone please tell me what little piece I am missing?

Thansk so much…

Hi Ian,

Thank you for your help. I finally figured this out after sifting through
the HELP online. They recommended using:

ApCreateModule()

but utilizing Internal Links via PhAB, much like you have recommended. I
coded up the ApCreateModule() and it worked.

For me, this is a challenge coming from Xt and Xm along with MS VC++ where
the convenience functions are abundant. Plus I like to know what is going
on, and using these “Internal Links” seems to hide functionality that I
probably will want to control. And to top it off, I don’t understand really
why I couldn’t “Realize” the widgets anyways. Do you know what I mean?

Anyway…enough of my rambling. Thanks for your assistance.

Dave Hurlburt
FAAC, Inc.

“NDT Technologies Inc.” <info@ndt.ca> wrote in message
news:3C3B2E6A.33AC5863@ndt.ca

Hi David,

If I understand you correctly, you want to bring up different dialogs from
the
same
button (or menu selection) based on other criteria.
You should design your dialogs in PhAB, and create Internal Links for each
of
them.
Then in the ACTIVATE callback for the button, call ApCreateWidget using
the
ABM…
manifest (from the internal link).

Example :

PtButton_Test_Activate_Callback(…)
{
switch (Criteria)
{
case 1 :
ApCreateWidget(ABM_PtDialog_1, widget, cbinfo);
break;
case 2 :
ApCreateWidget(ABM_PtDialog_2, widget, cbinfo);
break;
.
.
.
}

return (Pt_CONTINUE);
}

If this is what you want, and you still cannot get it to work, reply to
this
message or send me an Email, and I will send you a small
example which you can compile.

Ian Todd,
NDT Technologies Inc.
iantodd@sympatico.ca



David Hurlburt wrote:

Hi,

I am trying to manage, or realize, a simple dialog. I am using PhAB and
the
stuff seems to be hidden.

I can “realize” the PtWindow with the use of Menus and using “Dialog
Module
type” callbacks. But I can’t seem to manage the window with source
code.

What I’m trying to do is bring up a main window. When the user does
this,
they have to chose the file menu->New. When they do this, they must
select
a particular configuration. Depending on that configuration, a
different
dialog will occur.

When they hit the “OK” button on the configuration window, the
configuration
window should go away and the particular dialog should REALIZE.

I can get the Configuration window to disappear, but I cannot figure out
how
to realize the particular dialog.

I make the configuration window go away by doing getting the parent of
the
OK button and then Unrealizing it:

PtWidget_t *parent;

parent = PtWidgetParent(widget);
PtUnrealizeWidget(parent);

But then I need to do the following switch:

switch (currentScenario.weaponIndex)
{
case AGM_65:
/* MANAGE AGM_65 dialog */

break;
case AGM_130:

/* MANAGE AGM_130 dialog */
break;
case AIM_120:
break;

default:
printf(“UNKNOWN WEAPON!\n”);
}

I have tried to get the parent of widgets on the AGM_65 window
(ABW_AGM65WeaponPowerToggleButton is a widget on the AGM65 dialog)

parent = PtWidgetParent(ABW_AGM65WeaponPowerToggleButton);

but when I “Unrealize” this parent, it returns a -1.

I have tried to get the parent type of this toggle button.

parent = PtGetParent(ABW_AGM65WeaponPowerToggleButton, PtWindow);

but this returns a NULL value.

I have also just tried to unrealize the widget that I thought was the
window. The instance name I gave the AGM65 window is:

AGM65

So there is a widget created by PhAB called ABW_AGM65, but that doesn’t
work
either. It returns a -1.

So…I don’t know what to do. I’m almost ready to send a phake event to
the
menu button. But…that seems extreme. In my experience, this should
be
easy. Can someone please tell me what little piece I am missing?

Thansk so much…