Newbie Photon programming question

I have two PtToggleButtons in a PtGroup acting like radio buttons.
EXCLUSIVE and NO_SELECT_ALLOWED flags are set. This functionaly is
nice because the buttons automagically set and unset when pressed.
However sometimes I want to block the buttons from being changed in the
callback. I cant figure out how to do this. No matter what I try the buttons
change when the return is done from the callback.

Art Hays <avhays@nih.gov> wrote:

I have two PtToggleButtons in a PtGroup acting like radio buttons.
EXCLUSIVE and NO_SELECT_ALLOWED flags are set. This functionaly is
nice because the buttons automagically set and unset when pressed.
However sometimes I want to block the buttons from being changed in the
callback. I cant figure out how to do this. No matter what I try the buttons
change when the return is done from the callback.

Turn on the Pt_BLOCKED flag in the group’s Pt_ARG_FLAGS. If you want the
toggle buttons to look ghosted you will additionally need to turn on the
Pt_GHOST bit in the toglebuttons’ Pt_ARG_FLAGS.

I tried this but it doesnt work. Let me explain the sequence more
clearly:

1.) Have two radio buttons, “Channel A”, “Channel B”. Current state:
Channel A is unset, Channel B is set. Flags are EXCLUSIVE and NO_SELECT_
ALLOWED.
2.) User clicks on “Channel A”.
3.) Channel A callback is entered.
4.) I want to do something in this callback so that when the callback returns
the Channel A button wont change to set state.

If I set Pt_BLOCKED in this callback the Channel A button will still change to
set when the return is done. It will be blocked for subsequent button presses.


Previously, David LeBlanc wrote in qdn.public.qnxrtp.photon:

Art Hays <> avhays@nih.gov> > wrote:
I have two PtToggleButtons in a PtGroup acting like radio buttons.
EXCLUSIVE and NO_SELECT_ALLOWED flags are set. This functionaly is
nice because the buttons automagically set and unset when pressed.
However sometimes I want to block the buttons from being changed in the
callback. I cant figure out how to do this. No matter what I try the buttons
change when the return is done from the callback.

Turn on the Pt_BLOCKED flag in the group’s Pt_ARG_FLAGS. If you want the
toggle buttons to look ghosted you will additionally need to turn on the
Pt_GHOST bit in the toglebuttons’ Pt_ARG_FLAGS.

Previously, Art Hays wrote in qdn.public.qnxrtp.photon:

I tried this but it doesnt work. Let me explain the sequence more
clearly:

1.) Have two radio buttons, “Channel A”, “Channel B”. Current
state:
Channel A is unset, Channel B is set. Flags are EXCLUSIVE and
NO_SELECT_ALLOWED.
2.) User clicks on “Channel A”.
3.) Channel A callback is entered.
4.) I want to do something in this callback so that when the
callback returns the Channel A button wont change to set state.

If I set Pt_BLOCKED in this callback the Channel A button will still
change to set when the return is done. It will be blocked for
subsequent button presses.

Have you tried simply setting “Channel B” while in the “Channel A”
callback? I know this is a kluge - you want to deny the click through
some automatic callback action, but by the time Channel A’s callback
in invoked, the button is already set. You need to set B again to
unset A. (I can’t recall, but you might also have to unset A
explicitly).

Cheers,
Andrew

Art Hays wrote:

I tried this but it doesnt work. Let me explain the sequence more
clearly:

1.) Have two radio buttons, “Channel A”, “Channel B”. Current state:
Channel A is unset, Channel B is set. Flags are EXCLUSIVE and NO_SELECT_
ALLOWED.
2.) User clicks on “Channel A”.
3.) Channel A callback is entered.
4.) I want to do something in this callback so that when the callback returns
the Channel A button wont change to set state.

If I set Pt_BLOCKED in this callback the Channel A button will still change to
set when the return is done. It will be blocked for subsequent button presses.

Previously, David LeBlanc wrote in qdn.public.qnxrtp.photon:
Art Hays <> avhays@nih.gov> > wrote:
I have two PtToggleButtons in a PtGroup acting like radio buttons.
EXCLUSIVE and NO_SELECT_ALLOWED flags are set. This functionaly is
nice because the buttons automagically set and unset when pressed.
However sometimes I want to block the buttons from being changed in the
callback. I cant figure out how to do this. No matter what I try the buttons
change when the return is done from the callback.

Turn on the Pt_BLOCKED flag in the group’s Pt_ARG_FLAGS. If you want the
toggle buttons to look ghosted you will additionally need to turn on the
Pt_GHOST bit in the toglebuttons’ Pt_ARG_FLAGS.

Even though I do not know what you really want, how about adding the following coding
into your
channel A’s callback:

int
A( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )

{

/* eliminate ‘unreferenced’ warnings */
widget = widget, apinfo = apinfo, cbinfo = cbinfo;

PtArg_t Args[1];

PtSetArg( &Args[0], Pt_ARG_FLAGS, 0, Pt_SET);
PtSetResources( ABW_ToggleButtonA, 1, Args );

PtFlush();

return( Pt_CONTINUE );

}

Regards


WeiBing Tong

Aquila Mining Systems Ltd.
1450 City Councillors, Suite 330
Montreal, QC
Canada H3A 2E6
Tel: (514) 874-9917 ext 239
Fax: (514) 874-4005
Email: wbtong@aquilamsl.com

Thanks to all those who have replied to my post. Nothing that was suggested
would work. It would seem that it’s too late to change the toggle when
you are in the callback.


Previously, WeiBing Tong wrote in qdn.public.qnxrtp.photon:

Art Hays wrote:

I tried this but it doesnt work. Let me explain the sequence more
clearly:

1.) Have two radio buttons, “Channel A”, “Channel B”. Current state:
Channel A is unset, Channel B is set. Flags are EXCLUSIVE and NO_SELECT_
ALLOWED.
2.) User clicks on “Channel A”.
3.) Channel A callback is entered.
4.) I want to do something in this callback so that when the callback returns
the Channel A button wont change to set state.

If I set Pt_BLOCKED in this callback the Channel A button will still change to
set when the return is done. It will be blocked for subsequent button presses.

Previously, David LeBlanc wrote in qdn.public.qnxrtp.photon:
Art Hays <> avhays@nih.gov> > wrote:
I have two PtToggleButtons in a PtGroup acting like radio buttons.
EXCLUSIVE and NO_SELECT_ALLOWED flags are set. This functionaly is
nice because the buttons automagically set and unset when pressed.
However sometimes I want to block the buttons from being changed in the
callback. I cant figure out how to do this. No matter what I try the buttons
change when the return is done from the callback.

Turn on the Pt_BLOCKED flag in the group’s Pt_ARG_FLAGS. If you want the
toggle buttons to look ghosted you will additionally need to turn on the
Pt_GHOST bit in the toglebuttons’ Pt_ARG_FLAGS.


Even though I do not know what you really want, how about adding the following coding
into your
channel A’s callback:

int
A( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )

{

/* eliminate ‘unreferenced’ warnings */
widget = widget, apinfo = apinfo, cbinfo = cbinfo;

PtArg_t Args[1];

PtSetArg( &Args[0], Pt_ARG_FLAGS, 0, Pt_SET);
PtSetResources( ABW_ToggleButtonA, 1, Args );

PtFlush();

return( Pt_CONTINUE );

}

Regards


WeiBing Tong

Aquila Mining Systems Ltd.
1450 City Councillors, Suite 330
Montreal, QC
Canada H3A 2E6
Tel: (514) 874-9917 ext 239
Fax: (514) 874-4005
Email: > wbtong@aquilamsl.com

HAve you tried managing the button yourself.
ie don’t mark it exclusive.

Art Hays wrote:

Thanks to all those who have replied to my post. Nothing that was suggested
would work. It would seem that it’s too late to change the toggle when
you are in the callback.

Previously, WeiBing Tong wrote in qdn.public.qnxrtp.photon:
Art Hays wrote:

I tried this but it doesnt work. Let me explain the sequence more
clearly:

1.) Have two radio buttons, “Channel A”, “Channel B”. Current state:
Channel A is unset, Channel B is set. Flags are EXCLUSIVE and NO_SELECT_
ALLOWED.
2.) User clicks on “Channel A”.
3.) Channel A callback is entered.