Problem with Pt_ARG_FLAGS

How can I unset a flag using PtSetArg and PtSetResource?

The help of Qnx only show how to set a flag (and it works fine)…

Hercot Jean-Yves wrote:

How can I unset a flag using PtSetArg and PtSetResource?

The help of Qnx only show how to set a flag (and it works fine)…


HI

try something like this
PtSetResource(widget,Pt_ARG_FLAGS,Pt_FALSE,FLAGTOREMOVE);

/Johan Björk

Hercot Jean-Yves <fa063821@skynet.be> wrote:
: How can I unset a flag using PtSetArg and PtSetResource?

: The help of Qnx only show how to set a flag (and it works fine)…

Here’s what the docs say:

When setting a flag, the third argument to PtSetArg() is a bit field
specifying the value of the bits to be set. The fourth argument is a bit
mask indicating which elements of the bit field should be used.


Note: For the value, use Pt_TRUE, Pt_FALSE, or a combination of
specific bits and their complements. Don’t use a value of 1,
since it contains just one bit that’s on; that bit might not
correspond to the bit you’re trying to set.

For example, the following argument list specification turns on the
combo box widget’s Pt_COMBOBOX_STATIC flag (so that the combo
box always displays the list of items):

PtSetArg(&args[4], Pt_ARG_CBOX_FLAGS,
Pt_TRUE, Pt_COMBOBOX_STATIC);

When you call PtSetResources(), the widget uses the bit mask to
determine which bits of its internal flag resource representation to alter.
It takes the bit values from the value specified.

Isn’t that clear enough?


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

It seems I have miss that part of the docs…

Sorry and thank you. :slight_smile:


“Steve Reid” <stever@qnx.com> a écrit dans le message news:
b5n6pq$s2g$2@nntp.qnx.com

Hercot Jean-Yves <> fa063821@skynet.be> > wrote:
: How can I unset a flag using PtSetArg and PtSetResource?

: The help of Qnx only show how to set a flag (and it works fine)…

Here’s what the docs say:

When setting a flag, the third argument to PtSetArg() is a bit field
specifying the value of the bits to be set. The fourth argument is a bit
mask indicating which elements of the bit field should be used.


Note: For the value, use Pt_TRUE, Pt_FALSE, or a combination of
specific bits and their complements. Don’t use a value of 1,
since it contains just one bit that’s on; that bit might not
correspond to the bit you’re trying to set.

For example, the following argument list specification turns on the
combo box widget’s Pt_COMBOBOX_STATIC flag (so that the combo
box always displays the list of items):

PtSetArg(&args[4], Pt_ARG_CBOX_FLAGS,
Pt_TRUE, Pt_COMBOBOX_STATIC);

When you call PtSetResources(), the widget uses the bit mask to
determine which bits of its internal flag resource representation to
alter.
It takes the bit values from the value specified.

Isn’t that clear enough?


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

The docs for PtSetArg and PtSetResources seems clear enough,
but using PtSetResource (no ‘s’) to clear a flag doesn’t seem clear at all.

The definition is given as:
#define PtSetResource( widget, type, value, len ) …

with an example of:
PtSetResource( widget, Pt_ARG_FILL_COLOR, Pg_BLUE, 0 );

which would lead you (or at least me) to try this, which doesn’t work:

PtGetResource( widget, Pt_ARG_FLAGS, &lp, 0 );
mylong = *lp;
if ( status )
mylong |= Pt_SET;
else
mylong &= ~Pt_SET;
PtSetResource( widget, Pt_ARG_FLAGS, mylong, 0 );


Additional examples in the docs like Johan Björk’s would be very helpful:

to clear a flag: PtSetResource(widget,Pt_ARG_FLAGS, Pt_FALSE, Pt_SET );
to set a flag: PtSetResource(widget,Pt_ARG_FLAGS, Pt_TRUE, Pt_SET );


“Steve Reid” <stever@qnx.com> wrote in message
news:b5n6pq$s2g$2@nntp.qnx.com

Hercot Jean-Yves <> fa063821@skynet.be> > wrote:
: How can I unset a flag using PtSetArg and PtSetResource?

: The help of Qnx only show how to set a flag (and it works fine)…

Here’s what the docs say:

When setting a flag, the third argument to PtSetArg() is a bit field
specifying the value of the bits to be set. The fourth argument is a bit
mask indicating which elements of the bit field should be used.


Note: For the value, use Pt_TRUE, Pt_FALSE, or a combination of
specific bits and their complements. Don’t use a value of 1,
since it contains just one bit that’s on; that bit might not
correspond to the bit you’re trying to set.

For example, the following argument list specification turns on the
combo box widget’s Pt_COMBOBOX_STATIC flag (so that the combo
box always displays the list of items):

PtSetArg(&args[4], Pt_ARG_CBOX_FLAGS,
Pt_TRUE, Pt_COMBOBOX_STATIC);

When you call PtSetResources(), the widget uses the bit mask to
determine which bits of its internal flag resource representation to
alter.
It takes the bit values from the value specified.

Isn’t that clear enough?


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