View topic - Trying to Unrealized a child widget during construction

Trying to Unrealized a child widget during construction

Read-only archive of qnx.gui (Creating graphical applications within a GUI environment, such as Photon or PhAB) at inn.qnx.com

Trying to Unrealized a child widget during construction

Postby RIchard Doucet » Tue Feb 14, 2006 1:27 pm

I have a compound widget which allows multiple PtPane has children, but only
one of those PtPane should be visible at any given time. During the
construction of the widget, any PtPane which are not to be visible are
unreliazed via PtUnrealizeWidget(); this is done by attaching a callback via
Pt_SET_CHILD_REALIZED_F. Problem is that the compount widget does not
properly damage itself, resulting in these "unrealized" panes in becoming
visible. If the widget is damaged (via bringing a dialog/window in front of
this widget), it is redrawn properly. Is there a way to force this compound
widget to redraw itself just after its realization?
RIchard Doucet
 

Re: Trying to Unrealized a child widget during construction

Postby RIchard Doucet » Tue Feb 21, 2006 2:14 pm

Anybody have any suggestions for this issue?

"RIchard Doucet" <doucetr@DONTaeclSPAM.caME> wrote in message
news:dssldr$f9t$1@inn.qnx.com...
I have a compound widget which allows multiple PtPane has children, but
only one of those PtPane should be visible at any given time. During the
construction of the widget, any PtPane which are not to be visible are
unreliazed via PtUnrealizeWidget(); this is done by attaching a callback
via Pt_SET_CHILD_REALIZED_F. Problem is that the compount widget does not
properly damage itself, resulting in these "unrealized" panes in becoming
visible. If the widget is damaged (via bringing a dialog/window in front
of this widget), it is redrawn properly. Is there a way to force this
compound widget to redraw itself just after its realization?
RIchard Doucet
 

Re: Trying to Unrealized a child widget during construction

Postby Wojtek Lerch » Tue Feb 21, 2006 3:31 pm

The safest way is to use the Pt_DELAY_REALIZE flag. Realizing a widget
hierarchy is a complicated and fragile process, and as you have
discovered, interfering with it by calling PtUnrealizeWidget() while
some of your widgets might be half-realized can sometimes mess things
up. (BTW The same goes for inserting new widget into the hierarchy
being realized.)

The Pt_DELAY_REALIZE flag allows you to completely separate the code
that decides which children need to be visible from the code that runs
when your widgets are being realized on unrealized. Whenever your
widget changes its mind about which child should be visible, just set
the flag of one pane and call PtUnrealizeWidget(), and unset the flag of
the other pane and call PtRealizeWidget(). You don't even need to pay
attention to whether your widget is realized or not -- trying to
unrealize or realize children of a (completely) unrealized parent is
safe and does nothing. This method is tested many times every day: all
our list widgets use it to control their scrollbars.

RIchard Doucet wrote:
Anybody have any suggestions for this issue?

"RIchard Doucet" <doucetr@DONTaeclSPAM.caME> wrote in message
news:dssldr$f9t$1@inn.qnx.com...

I have a compound widget which allows multiple PtPane has children, but
only one of those PtPane should be visible at any given time. During the
construction of the widget, any PtPane which are not to be visible are
unreliazed via PtUnrealizeWidget(); this is done by attaching a callback
via Pt_SET_CHILD_REALIZED_F. Problem is that the compount widget does not
properly damage itself, resulting in these "unrealized" panes in becoming
visible. If the widget is damaged (via bringing a dialog/window in front
of this widget), it is redrawn properly. Is there a way to force this
compound widget to redraw itself just after its realization?
Wojtek Lerch
 

Re: Trying to Unrealized a child widget during construction

Postby bilcar » Wed Feb 22, 2006 12:34 pm

Just a thought here. Can't you achieve this by leaving all the panes
realized and bringing whichever one should be visible to the top?

The only prerequisite here is that all of the panes are the same size and in
the same location.


"RIchard Doucet" <doucetr@DONTaeclSPAM.caME> wrote in message
news:dssldr$f9t$1@inn.qnx.com...
I have a compound widget which allows multiple PtPane has children, but
only one of those PtPane should be visible at any given time. During the
construction of the widget, any PtPane which are not to be visible are
unreliazed via PtUnrealizeWidget(); this is done by attaching a callback
via Pt_SET_CHILD_REALIZED_F. Problem is that the compount widget does not
properly damage itself, resulting in these "unrealized" panes in becoming
visible. If the widget is damaged (via bringing a dialog/window in front
of this widget), it is redrawn properly. Is there a way to force this
compound widget to redraw itself just after its realization?
bilcar
Senior Member
 
Posts: 573
Joined: Wed Feb 04, 2004 5:50 pm
Location: Crete, IL


Return to qnx.gui

Who is online

Users browsing this forum: No registered users and 2 guests