Hi David,
If you check the docs for PtGetResouces there is a warning message about
not changing the value in the widget directly it can cause strange
things to happen. Here is what the warning says :
\
Because PtGetResource() returns a pointer directly into the internals of
the widget, don’t modify the resource value directly. If you wish to
retrieve the value of a given resource and then modify that value:
1.
Get the resource.
2.
Copy the resource to a temporary variable.
3.
Modify the temporary variable.
4.
Using the modified copy, set the resource.
For example:
int *gauge_value;
PtArg_t
arg;
/* This will get the gauge value and store it in the variable gauge_value */
PtSetArg(&arg, Pt_ARG_GAUGE_VALUE, &gauge_value, 0);
PtGetResources(ABW_AGM130HorizontalSlider, 1,&arg);
/* Now modify the value for this example I am just setting it to zero */
*gauge_value = 0;
/* Now set the gauge value resource */
PtSetArg(&arg, Pt_ARG_GAUGE_VALUE, *gauge_value, 0);
PtSetResources(ABW_AGM130HorizontalSlider, 1, &arg);
You can use the PtSetResources and PtGetResources to set multiple
resources at once. The help docs shows this.
Let me know if this helps
Regards
Brenda
David Hurlburt wrote:
“David Hurlburt” <> dhurlburt@faac.com> > wrote in message
news:a1l02s$jgi$> 1@inn.qnx.com> …
Hi,
I’m writing some code which accesses a slider’s value and then increments
it.
I have some basic code:
Pt_Arg arg;
PtSetArg(&arg, Pt_ARG_GAUGE_VALUE, 0, 0);
PtGetResources(ABW_AGM130HorizontalSlider, 1, &arg);
I go through this particular code 6 times without failure. On the 7th
loop
I get a “TASK EXCEPTION”.
Is there something special I need to do that I’m not?
Thanks
Dave Hurlburt
Addendum…
I just printed out the widget id value and it seems this global value
changes. Anybody have an idea how this would happen?
int lvalue = (int) ABW_AGM130HorizontalSlider;
6 times is the same - the 7th it changes. This is a global item created by
PhAB. I have no idea where to chase this one…
\