Hi,
To determine Radio button activities, i am reading Pt_ARG_USER_DATA
resource via PtGetResource API. (Pt_ARG_USER_DATA is selected with unique
values for radio button#1 is 1 and radio button #2 is 2)
Ex:
PtGetresource(ABW_TOGGLE_BUTTONS, Pt_ARG_USER_DATA, &i, 0);
With this i am getting CORE DUMP ERROR.
Hi,
To determine Radio button activities, i am reading Pt_ARG_USER_DATA
resource via PtGetResource API. (Pt_ARG_USER_DATA is selected with unique
values for radio button#1 is 1 and radio button #2 is 2)
Ex:
PtGetresource(ABW_TOGGLE_BUTTONS, Pt_ARG_USER_DATA, &i, 0);
With this i am getting CORE DUMP ERROR.
Can somebody help me?
Thanks,
Suresh.
\
I think you want something like this:
int i = 2;
PtSetresource(ABW_TOGGLE_BUTTONS, Pt_ARG_USER_DATA, &i, sizeof(int));
PtGetresource(ABW_TOGGLE_BUTTONS, Pt_ARG_USER_DATA, &i, sizeof(int));
I have not tested this, I could be talking rubbish.
Hi,
To determine Radio button activities, i am reading Pt_ARG_USER_DATA
resource via PtGetResource API. (Pt_ARG_USER_DATA is selected with unique
values for radio button#1 is 1 and radio button #2 is 2)
Ex:
PtGetresource(ABW_TOGGLE_BUTTONS, Pt_ARG_USER_DATA, &i, 0);
With this i am getting CORE DUMP ERROR.
Can somebody help me?
How do you declare i? Pt_ARG_USER_DATA is an Alloc resource, so you need
to pass the address of a pointer to the correct type of data. For example,
if you’re storing an integer in this resource, you should declare i as:
int *i;
For more information, see the Manipulating Resources in Application Code
chapter of the Photon Programmer’s Guide.
Steve Reid stever@qnx.com
TechPubs (Technical Publications)
QNX Software Systems
Suresh Kumar <> skavula@nordson.com> > wrote:
To determine Radio button activities, i am reading Pt_ARG_USER_DATA
resource via PtGetResource API. (Pt_ARG_USER_DATA is selected with unique
values for radio button#1 is 1 and radio button #2 is 2)
Ex:
PtGetresource(ABW_TOGGLE_BUTTONS, Pt_ARG_USER_DATA, &i, 0);
With this i am getting CORE DUMP ERROR.
How do you declare i? Pt_ARG_USER_DATA is an Alloc resource, so you need
to pass the address of a pointer to the correct type of data. For example,
if you’re storing an integer in this resource, you should declare i as:
int *i;
It might also be worth mentioning that if you’re setting up the user
data in PhAB, PhAB stores it in the widget as a string rather than an
int. In other words, you need to declare your i as “char *i” (or, if
you’re as pedantic as I am, as “const char *i”), and after getting the
resource, test the value by comparing strings, i.e. either
if ( ! strcmp( i, “1” ) ) …
or, if you know that all those strings are only one character long,
if ( i[0] == ‘1’ ) …
(Of course, since i is a pointer, it would also be a good idea to rename
it to something that doesn’t suggest that it’s an integer…
Hi,
To determine Radio button activities, i am reading Pt_ARG_USER_DATA
resource via PtGetResource API. (Pt_ARG_USER_DATA is selected with unique
values for radio button#1 is 1 and radio button #2 is 2)
Ex:
PtGetresource(ABW_TOGGLE_BUTTONS, Pt_ARG_USER_DATA, &i, 0);
With this i am getting CORE DUMP ERROR.
How you should get the resource depends on how you set it. So far, you
have not mentioned how you’re setting it. If you’re setting it from
your code rather than by hand in PhAB, a code sample might make things
clearer.
How you should get the resource depends on how you set it. So far, you
have not mentioned how you’re setting it. If you’re setting it from
your code rather than by hand in PhAB, a code sample might make things
clearer.
Thanks for your Reply, I am setting Pt_ARG_USER_DATA from PhAB not
from code, But i want to get this data from code.
I just attached the following callback to a button in a PhAB
application, and it displayed the button’s user data in the PtNotice box
without crashing:
int
cb( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{