PtToggleButton

Hey,

I’m trying to set the state of my button under program control. Basically I
have an
‘Options’ window with a checkbox and I’m saving it to a config file when the
window
closes. I can get the state of it with the PtGetResource() and checking for
Pt_SET
and that part works fine. What I can’t seem to do is to set it when the
window
opens if it is set in the config file. I’m sure the code is executing and
the widget
updates since I can change the text for the toggle when the window opens but
even when I try PtSetResources(PtToggle, Pt_ARG_FLAGS, Pt_SET, 0) it
doesn’t do anything. I tried a PtFlush() but that doesn’t work either.

Help??

Thanks…

Lee R. Copp <Lee.R.Copp@michiganscientific.com> wrote:

Hey,

I’m trying to set the state of my button under program control. Basically I
have an
‘Options’ window with a checkbox and I’m saving it to a config file when the
window
closes. I can get the state of it with the PtGetResource() and checking for
Pt_SET
and that part works fine. What I can’t seem to do is to set it when the
window
opens if it is set in the config file. I’m sure the code is executing and
the widget
updates since I can change the text for the toggle when the window opens but
even when I try PtSetResources(PtToggle, Pt_ARG_FLAGS, Pt_SET, 0) it

Try “PtSetResources(PtToggle, PtPt_ARG_FLAGS, Pt_SET, Pt_SET);”

flag-type resources use the final parameter of PtSetResource()
(or of PtSetArg() if you’re building an argument list for use
with PtSetResources()…) to indicate which bit in the flag you
wish to change. As written, you told the library you didn’t
wishs to change any bits… :slight_smile:

Help??

Hope this does the trick. Have a second look at the Programmer’s
Guide section on manipulating widget resources from code. You
have to pay close attention to the type of a resource when you
set or get it from code.


Norbert Black
QSSL Training Services

Try “PtSetResources(PtToggle, PtPt_ARG_FLAGS, Pt_SET, Pt_SET);”

That did the trick…

flag-type resources use the final parameter of PtSetResource()
(or of PtSetArg() if you’re building an argument list for use
with PtSetResources()…) to indicate which bit in the flag you
wish to change. As written, you told the library you didn’t
wishs to change any bits… > :slight_smile:

Dooh!!!

Hope this does the trick. Have a second look at the Programmer’s
Guide section on manipulating widget resources from code. You

I read thru that again and found the part under ‘flags’ which explained
what was going on. It is actually pretty cool how it does it. I was
worried about setting just Pt_SET and clearing the other stuff but
Photon takes care of that for me.

Thanks…

Lee R. Copp <Lee.R.Copp@michiganscientific.com> wrote:

Try “PtSetResources(PtToggle, PtPt_ARG_FLAGS, Pt_SET, Pt_SET);”

That did the trick…

flag-type resources use the final parameter of PtSetResource()
(or of PtSetArg() if you’re building an argument list for use
with PtSetResources()…) to indicate which bit in the flag you
wish to change. As written, you told the library you didn’t
wishs to change any bits… > :slight_smile:

Drat. Make that “wish to change”… :confused:

Dooh!!!

Into every life, a few Homer Simpson moments must fall. You
should see some of mine:slight_smile:

Hope this does the trick. Have a second look at the Programmer’s
Guide section on manipulating widget resources from code. You

I read thru that again and found the part under ‘flags’ which explained
what was going on. It is actually pretty cool how it does it. I was
worried about setting just Pt_SET and clearing the other stuff but
Photon takes care of that for me.

Thanks…

No worries. Glad it all worked out.


Norbert Black
QSSL Training Services