toggle buttons return values

QNX RTOS 6.1A:
I’m having problems getting the value as to whether a toggle button is set or unset. I was trying to use the PtGetResource() function with Pt_SET to see a return value and determine whether the toggle was set.

char *tbuf;
PtGetResource (ABW_PtPass, Pt_SET, &tbuf, 0);


The information that was returned was garbage data so i am not sure whether i was reading it wrong or whether the PtGetResource should not be used with a toggle button.

Is there an easy way to determine whether a button is set?

There is only 1 module and the check is being done on the same panel as the checkbox.

Thx for any help!

Slc_Project <qnx_slcproject@canada.com> wrote:
: QNX RTOS 6.1A:
: I’m having problems getting the value as to whether a toggle button is set or unset. I was trying to use the PtGetResource() function with Pt_SET to see a return value and determine whether the toggle was set.

: char *tbuf;
: PtGetResource (ABW_PtPass, Pt_SET, &tbuf, 0);


: The information that was returned was garbage data so i am not sure whether i was reading it wrong or whether the PtGetResource should not be used with a toggle button.

: Is there an easy way to determine whether a button is set?

Pt_SET is one bit in the Pt_ARGS_FLAGS resource, so your code isn’t going to
work. See “Getting resources” in the Manipulating Resources in Application
Code chapter of the Photon Programmer’s Guide for the correct way.


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

Steve Reid <stever@qnx.com> wrote:

Slc_Project <> qnx_slcproject@canada.com> > wrote:
: QNX RTOS 6.1A:
: I’m having problems getting the value as to whether a toggle button is set or unset. I was trying to use the PtGetResource() function with Pt_SET to see a return value and determine whether the toggle was set.

: char *tbuf;
: PtGetResource (ABW_PtPass, Pt_SET, &tbuf, 0);



: The information that was returned was garbage data so i am not sure whether i was reading it wrong or whether the PtGetResource should not be used with a toggle button.

: Is there an easy way to determine whether a button is set?

Pt_SET is one bit in the Pt_ARGS_FLAGS resource, so your code isn’t going to
work. See “Getting resources” in the Manipulating Resources in Application
Code chapter of the Photon Programmer’s Guide for the correct way.

There also is a shortcut for getting this particular resource: the
PtWidgetFlags() macro. Try something like this:

if ( PtWidgetFlags( ABW_PtPass ) & Pt_SET ) …


Wojtek Lerch QNX Software Systems Ltd.

Wojtek Lerch wrote:

Steve Reid <> stever@qnx.com> > wrote:

Slc_Project <> qnx_slcproject@canada.com> > wrote:
: QNX RTOS 6.1A:
: I’m having problems getting the value as to whether a toggle button is set or unset. I was trying to use the PtGetResource() function with Pt_SET to see a return value and determine whether the toggle was set.


: char *tbuf;
: PtGetResource (ABW_PtPass, Pt_SET, &tbuf, 0);



: The information that was returned was garbage data so i am not sure whether i was reading it wrong or whether the PtGetResource should not be used with a toggle button.


: Is there an easy way to determine whether a button is set?


Pt_SET is one bit in the Pt_ARGS_FLAGS resource, so your code isn’t going to
work. See “Getting resources” in the Manipulating Resources in Application
Code chapter of the Photon Programmer’s Guide for the correct way.


There also is a shortcut for getting this particular resource: the
PtWidgetFlags() macro. Try something like this:

if ( PtWidgetFlags( ABW_PtPass ) & Pt_SET ) …

OHH! that rocks!
this really should be mentioned on the places where Pt_ARG_FLAGS docs are!

phearbear <phearbear@spray.se> wrote:
: OHH! that rocks!
: this really should be mentioned on the places where Pt_ARG_FLAGS docs are!

I’ll add it to my list of things to do. Thanks for the suggestion.


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