Jim Douglas <jim@dramatec.co.uk> wrote:
: The documentation for the PtPanelGroup appears to be slightly innacurate. I
: copied the example given and it did not work as shown in the docs. I was
: using the technique of a single panel populated by the contents of a picture
: widget, following the code example given under Pt_CB_PG_PANEL_SWITCHING.
After getting a polite correction from Wojtek, and playing around with the
code, I think I understand what happened.
: The two lines of code shown to populate the panel (widget) from a picture
: module (ABM_pic_module_0)
: ApCreateModule( ABM_pic_module_0, widget, NULL );
: PtRealizeWidget( ABW_pic_module_0 );
: results in a blank display. It works if you change the second line to
: PtReRealizeWidget( widget );
It’s ApCreateModule() whose docs aren’t clear enough. If you specify a widget
as the second argument, the children of the picture module become children
of the widget, and the picture module isn’t created, so ABW_pic_module_0 is
NULL.
As an alternative, you can do this:
PtSetParentWidget( widget );
ApCreateModule( ABM_pic_module_0, NULL, NULL );
PtRealizeWidget( ABW_pic_module_0 );
If the second argument to ApCreateModule() is NULL, it seems that the
picture module is created and is made a child of the default parent (i.e.
“widget”). This means that ABW_pic_module_0 is set, so you can realize it.
If you do this, the panel includes the frame for the picture module.
: Getting rid of the contents of the panel is achieved by
: PtClearWidget( widget );
: as shown in the docs, but you might be forgiven for thinking that the same
: end could be achieved by
: PtDestroyWidget( ABW_pic_module_0 );
: But this results in the PtPanelGroup widget being destroyed.8-( Could
: someone please explain what is going on, and if necessary amend the docs?
I don’t know why this happens. Perhaps someone else can help you with this.
Steve Reid stever@qnx.com
TechPubs (Technical Publications)
QNX Software Systems