Using .wtgw files in standalone Photon applications

I created a window with buttons in it with PhAB. I developed a standalone
Photon program, that opens the .wgtw database with ApOpenDBFile(), then
registers classes with ApAddClass(), and finally created the window widgets
and all widgets within with ApCreateWidgetFamily(). It works fine.
My problem is, I only get a PtWidget_t pointer to the window, and I need
pointers to the buttons in it as well.
If I use ApCreateWidget for the button again, it is recreated and I have to
buttons.

Thanks
Markus


Markus Loffler
Quality Real-Time Systems
http://qrts.com

You have to walk through the widget hierarchy, starting with the Window
Widget until you get to the widgets inside the window that you’re
interrested in and memorize their pointers.

I don’t remember the name of the API function that allow walking through the
widgets hierarchy but there is one somewhere.

Then you can test if the widget belongs to the class you’re looking for or
use some other method of identifying the widgets. The trick I do is look
for a specific string in the Pt_ARG_USER_DATA resource that tells my app the
pseudo name of the widget…


“Markus Loffler” <loffler@ces.clemson.edu> wrote in message
news:8mmd8i$4gs$1@inn.qnx.com

I created a window with buttons in it with PhAB. I developed a standalone
Photon program, that opens the .wgtw database with ApOpenDBFile(), then
registers classes with ApAddClass(), and finally created the window
widgets
and all widgets within with ApCreateWidgetFamily(). It works fine.
My problem is, I only get a PtWidget_t pointer to the window, and I need
pointers to the buttons in it as well.
If I use ApCreateWidget for the button again, it is recreated and I have
to
buttons.

Take a look at PtWidgetChildBack() and …Front() and then
look at PtWidgetBrotherInFront() and …Back().

These routines may be used to move through the widget tree.
There are also routines PtWidgetTree() and …TreeTraverse().

Now that you can traverse the tree, the question remains how
to identify a specific widget when you have its pointer. I
use the USER_DATA field, although this is not the only way.


Markus Loffler <loffler@ces.clemson.edu> wrote:

I created a window with buttons in it with PhAB. I developed a standalone
Photon program, that opens the .wgtw database with ApOpenDBFile(), then
registers classes with ApAddClass(), and finally created the window widgets
and all widgets within with ApCreateWidgetFamily(). It works fine.
My problem is, I only get a PtWidget_t pointer to the window, and I need
pointers to the buttons in it as well.
If I use ApCreateWidget for the button again, it is recreated and I have to
buttons.

Thanks
Markus


Markus Loffler
Quality Real-Time Systems
http://qrts.com


Mitchell Schoenbrun --------- maschoen@pobox.com

Ok, I got actually the idea of walking through the tree, but your idea with
the Pt_ARG_USER_DATA is great. Thanks a lot.
Markus

“Marc Lupien” <marclupien@hotmail.com> wrote in message
news:8mnsji$q9h$1@inn.qnx.com

You have to walk through the widget hierarchy, starting with the Window
Widget until you get to the widgets inside the window that you’re
interrested in and memorize their pointers.

I don’t remember the name of the API function that allow walking through
the
widgets hierarchy but there is one somewhere.

Then you can test if the widget belongs to the class you’re looking for or
use some other method of identifying the widgets. The trick I do is look
for a specific string in the Pt_ARG_USER_DATA resource that tells my app
the
pseudo name of the widget…


“Markus Loffler” <> loffler@ces.clemson.edu> > wrote in message
news:8mmd8i$4gs$> 1@inn.qnx.com> …
I created a window with buttons in it with PhAB. I developed a
standalone
Photon program, that opens the .wgtw database with ApOpenDBFile(), then
registers classes with ApAddClass(), and finally created the window
widgets
and all widgets within with ApCreateWidgetFamily(). It works fine.
My problem is, I only get a PtWidget_t pointer to the window, and I need
pointers to the buttons in it as well.
If I use ApCreateWidget for the button again, it is recreated and I have
to
buttons.

Thanks for all your help.
Loading the wgtw database works fine now, but what do I do if I want to link
the wgtw file statically to my “from scratch” Photon application? I know to
use bindres and use ApOpenDBase instead of ApOpenDBaseFile. But how do I set
the first parameter of ApOpenDBase (of type ApEventLink_t *)?
Thanks in advance
Markus


“Mitchell Schoenbrun” <maschoen@tsoft.com> wrote in message
news:sou7r05463a161@corp.supernews.com

Take a look at PtWidgetChildBack() and …Front() and then
look at PtWidgetBrotherInFront() and …Back().

These routines may be used to move through the widget tree.
There are also routines PtWidgetTree() and …TreeTraverse().

Now that you can traverse the tree, the question remains how
to identify a specific widget when you have its pointer. I
use the USER_DATA field, although this is not the only way.


Markus Loffler <> loffler@ces.clemson.edu> > wrote:
I created a window with buttons in it with PhAB. I developed a
standalone
Photon program, that opens the .wgtw database with ApOpenDBFile(), then
registers classes with ApAddClass(), and finally created the window
widgets
and all widgets within with ApCreateWidgetFamily(). It works fine.
My problem is, I only get a PtWidget_t pointer to the window, and I need
pointers to the buttons in it as well.
If I use ApCreateWidget for the button again, it is recreated and I have
to
buttons.

Thanks
Markus


Markus Loffler
Quality Real-Time Systems
http://qrts.com



\

Mitchell Schoenbrun --------- > maschoen@pobox.com