PtText widget extent

Hello.

Is it possible to find out the PtText widget extent without creating the
PtText widget?

Thanks

Augie

Augie Henriques <augieh@scieng.com> wrote:

Is it possible to find out the PtText widget extent without creating the
PtText widget?

In general, it depends on the resources of your PtText widget. How
would you want to specify the resources without having a widget to apply
them to?

But perhaps calling PfExtentText() and adding a hardcoded number of
pixels to the returned size would be good enough in your case?

\

Wojtek Lerch (wojtek@qnx.com) QNX Software Systems Ltd.

Wojtek Lerch <wojtek@qnx.com> wrote:
: Augie Henriques <augieh@scieng.com> wrote:

:> Is it possible to find out the PtText widget extent without creating the
:> PtText widget?

: In general, it depends on the resources of your PtText widget. How
: would you want to specify the resources without having a widget to apply
: them to?

This sounds very existential: If a PtText falls in a forest, but has never
been realized, does it have an extent?


Steve Reid stever@qnx.com
TechPubs (Technical Publications)
QNX Software Systems

Wojtek Lerch <wojtek@qnx.com> wrote in message
news:8tv00t$d5g$1@nntp.qnx.com

Augie Henriques <> augieh@scieng.com> > wrote:

Is it possible to find out the PtText widget extent without creating the
PtText widget?

In general, it depends on the resources of your PtText widget. How
would you want to specify the resources without having a widget to apply
them to?

But perhaps calling PfExtentText() and adding a hardcoded number of
pixels to the returned size would be good enough in your case?

I have a layout to perform which depends on the size and number of PtText
widgets. At the moment I create the PtText widgets, get the extent and
destroy them. Then I perform the necessary layout. Finally, the PtText
widgets get created.

Maybe you can suggest something better?

I figure that there may be a call that I could use to figure out how much
space a widget is going to take, without actually creating it.

Augie


Wojtek Lerch (> wojtek@qnx.com> ) QNX Software Systems Ltd.

Augie Henriques <augieh@scieng.com> wrote:
: I have a layout to perform which depends on the size and number of PtText
: widgets. At the moment I create the PtText widgets, get the extent and
: destroy them. Then I perform the necessary layout. Finally, the PtText
: widgets get created.

: Maybe you can suggest something better?

: I figure that there may be a call that I could use to figure out how much
: space a widget is going to take, without actually creating it.

You could create the widgets at a negative position such as (-1000, -1000)
so they won’t be displayed, then get the extent. Not quite what you want,
but it would give you better results and wouldn’t mess up the display.


Steve Reid stever@qnx.com
TechPubs (Technical Publications)
QNX Software Systems

Augie Henriques <augieh@scieng.com> wrote:

Wojtek Lerch <> wojtek@qnx.com> > wrote in message
news:8tv00t$d5g$> 1@nntp.qnx.com> …
Augie Henriques <> augieh@scieng.com> > wrote:

Is it possible to find out the PtText widget extent without creating the
PtText widget?

In general, it depends on the resources of your PtText widget. How
would you want to specify the resources without having a widget to apply
them to?

I have a layout to perform which depends on the size and number of PtText
widgets. At the moment I create the PtText widgets, get the extent and
destroy them. Then I perform the necessary layout. Finally, the PtText
widgets get created.

Maybe you can suggest something better?

Why are you destroying the widgets and then creating them again?
Wouldn’t it be better to just keep them?

I figure that there may be a call that I could use to figure out how much
space a widget is going to take, without actually creating it.

There’s no such thing. Since the final size depends of both the
resources you supply and the code of the widget, it’s not possible in
general to predict how your resources will affect the widget’s extent
without actually creating it. Even if it were possible, I don’t see why
it would be any simpler or faster…


Wojtek Lerch (wojtek@qnx.com) QNX Software Systems Ltd.

Steve Reid <stever@qnx.com> wrote:

Augie Henriques <> augieh@scieng.com> > wrote:
: I have a layout to perform which depends on the size and number of PtText
: widgets. At the moment I create the PtText widgets, get the extent and
: destroy them. Then I perform the necessary layout. Finally, the PtText
: widgets get created.

: Maybe you can suggest something better?

: I figure that there may be a call that I could use to figure out how much
: space a widget is going to take, without actually creating it.

You could create the widgets at a negative position such as (-1000, -1000)
so they won’t be displayed, then get the extent. Not quite what you want,
but it would give you better results and wouldn’t mess up the display.

Either that, or just don’t realize them. An unrealized widget is
faster than a realized one…


Wojtek Lerch (wojtek@qnx.com) QNX Software Systems Ltd.