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:
Get the resource.
Copy the resource to a temporary variable.
Modify the temporary variable.
Using the modified copy, set the resource.
/* This will get the gauge value and store it in the variable gauge_value */
PtSetArg(&arg, Pt_ARG_GAUGE_VALUE, &gauge_value, 0);
/* 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
David Hurlburt wrote:
“David Hurlburt” <> email@example.com> > wrote in message
news:a1l02s$jgi$> firstname.lastname@example.org> …
I’m writing some code which accesses a slider’s value and then increments
I have some basic code:
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
I get a “TASK EXCEPTION”.
Is there something special I need to do that I’m not?
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…