Joe Hezina <hezinjo@snapon.com> wrote:
I’m loading various picture modules onto PtPane on base window. When I use
PtClearWidget to destroy all children of the pane (which now are widgets
from my module and the module itself(??)), it does not seem to release the
memory, because app. memory keeps growing and growing with each new module
re-loaded. By cca 20k each ApCreateModule call. It gets to the point the
Photon just stops redrawing anything that does not have immediate focus.
You’re creating a two things each time you do the
ApCreateModule() call with picture modules:
a) an in-memory template which describes the widgets in the
module
b) copies of the widgets themselves, which get parented in the
container you use in the ApCreateModule() parent
parameter
The PtClearWidget() is causing the copies of the widgets to be
destroyed, but the template is still there.
I think the solution to your problem is not to use
ApCreateModule() for repeated creations. Open the picture module
as a database, and then grab the widgets you need from it as
individuals or as a family. If you make everbody else in the
module the child of a PtGroup, you can just grab them all using
ApCreateWidgetFamily() against the PtGroup.
The doc. for PtClearWidget state the call will destory all “nonprocreated”
chidren - what does it exactly mean “nonprocreated”?
Procreated children are the component widgets of a compound
widgets. For instance, PtMultiText is really a
PtMultiTextContainer that contains the PtMultiText and
(optionally, depending on what text is involved and the
dimensions of the widget) one or two PtScrollbars and a PtBasic.
Most compound widgets don’t allow you to drop other widgets into
them, either in PhAB or from code. You can’t put PtButtons
inside a PtMultiText or PtComboBox, for instance.
Things get complicated when you get a PtScrollContainer, which
can have not only procreated children (the slidebars and basic),
but also things like PtButtons, etc. These latter are
“nonprocreated” children. So, when you do a PtClearWidget(), you
want the PtScrollContainer to get rid of the PtButton, etc., but
leave the scrollbars. Clearer?
Norbert Black
QSSL Training Services