PhAB-module realization

im only interested in following issue: if i want to realize and unrealize
a PhAB-module from code, should i use then ApCreateModule() and
PtUnrealizeWidget() for it?

thanks!

mirtch <mirtch@gmx.net> wrote:

im only interested in following issue: if i want to realize and unrealize
a PhAB-module from code, should i use then ApCreateModule() and
PtUnrealizeWidget() for it?

Usually not. In general, ApCreateModule() and PtDestroyWidget().

PtUnrealizeWidget() just makes the widgets invisible, but keeps all
their data (resources, etc.) in memory. ApCreateModule() always creates
new widgets – if you call ApCreateModule() followed by
PtUnrealizeWidget() 1000 times, you’ll end up with 1000 invisible copies
of all the widgets sitting in memory, which is probably not what you
want.

One exception is dialog modules. If you have created and unrealized a
dialog, calling ApCreateModule() again will just realize it and bring it
to the front. You can safely use PtUnrealizeWidget() to temporarily
hide a dialog (remember: only a dialog), and then call either
ApCreateModule() or PtRealizeWidget() to unhide it – the difference
between unrealizing and destroying is that realizing will bring back the
widgets in the state they were in when they got unrealized (and preserve
any changes that the user might have made to the size and position of
the window, the contents of text fields, etc.), whereas if you destroy
the widgets, ApCreateModule() will create the new ones from scratch,
based on how you set them up in PhAB, and then it’ll run your your setup
function to allow you to fill in any blanks.

Wojtek Lerch wrote:


the window, the contents of text fields, etc.), whereas if you destroy
the widgets, ApCreateModule() will create the new ones from scratch,
based on how you set them up in PhAB, and then it’ll run your your setup
function to allow you to fill in any blanks.

Is it possible to ApCreateModule something that is
unrealized to begin with? (ie not displayed as if unrealized)

I have an application consisting of various dialogues, but
due to some of them having dynamic data I create them all at
app startup time.

The effect is all these dialogues flashing on screen as they
get created and pushed to the background by the next
one being created.
One way I guess is to play with the (x,y).
Another is to not be lazy and update data on a module only if the module
has been created already, and stop updating when the module is
destroyed.

Any other ideas?

acellarius@yahoo.com wrote:

Is it possible to ApCreateModule something that is
unrealized to begin with? (ie not displayed as if unrealized)

For a window module, the widgets won’t be realized if the pre-realize
setup function returns Pt_HALT.

I have an application consisting of various dialogues, but
due to some of them having dynamic data I create them all at
app startup time.

The effect is all these dialogues flashing on screen as they
get created and pushed to the background by the next
one being created.
One way I guess is to play with the (x,y).

Nah, that’s ugly…

Another is to not be lazy and update data on a module only if the module
has been created already, and stop updating when the module is
destroyed.

If you have a lot of modules that needs updating, and only very few at a
time can ever be visible, wouldn’t that save you a lot of CPU cycles?
Even if you decide to create all the windows but keep most of them
unrealized for some reason (for instance, because creating takes more
time than realizing), checking if a widget is realized still takes a
negligible amount of time compared to setting a widget’s resource…

Wojtek Lerch wrote:

acellarius@yahoo.com > wrote:
Is it possible to ApCreateModule something that is
unrealized to begin with? (ie not displayed as if unrealized)

For a window module, the widgets won’t be realized if the pre-realize
setup function returns Pt_HALT.

They are all Dialogues.

If you have a lot of modules that needs updating, and only very few at a
time can ever be visible, wouldn’t that save you a lot of CPU cycles?
Even if you decide to create all the windows but keep most of them
unrealized for some reason (for instance, because creating takes more
time than realizing), checking if a widget is realized still takes a
negligible amount of time compared to setting a widget’s resource…

As I say, stop being lazy…
Although, it will be a bit messy having to update&check the status
of a dialogues in order to decide whether to update it’s resources.

Thanks anyway

Hope this was relevant to the OP-sorry for interjecting…