Kendall Russell
|
Re: Setting a PtToggleButton that is part of a group
|
Kendall Russell
06/09/2011 4:13 PM
post86539
|
Re: Setting a PtToggleButton that is part of a group
I have found a "work-around", but I hope there is a better, more direct way to accomplish this.
What I am currently doing is:
1. Calling PtGetResource() to determine if the exclusivity bit is set for the group.
2. If so, call PtSetResource() to turn the exclusivity off for the group.
3. Call PtSetResource() for the specific toggle button widget to clear it.
4. Call PtSetResource() for the group to turn exclusivity back on.
[CODE]
int clear(PtWidget_t* pWidget, PtWidget_t* pGroupWidget)
{
short* pnBitVal = 0;
char bExclusiveBitSet = 0;
//DETERMINE STATUS OF EXCLUSIVITY BIT
PtGetResource(pGroupWidget, Pt_ARG_GROUP_FLAGS, &pnBitVal, Pt_GROUP_EXCLUSIVE);
//STORE STATUS
bExclusiveBitSet = (*pnBitVal) ? 1 : 0;
//TURN OFF EXCLUSIVITY IF IT IS ON
if(bExclusiveBitSet)
{
PtSetResource(pGroupWidget, Pt_ARG_GROUP_FLAGS, ~Pt_GROUP_EXCLUSIVE, Pt_GROUP_EXCLUSIVE);
}
//CLEAR Pt_SET FROM WIDGET
PtSetResource(pWidget, Pt_ARG_FLAGS, ~Pt_SET, Pt_SET);
//TURN EXCLUSIVITY BACK ON IF NECESSARY
if(bExclusiveBitSet)
{
PtSetResource(pGroupWidget, Pt_ARG_GROUP_FLAGS, Pt_GROUP_EXCLUSIVE, Pt_GROUP_EXCLUSIVE);
}
return 0;
}
[/CODE]
Is there an easier or more direct way to do this?
Thanks,
Kendall
> I have two PtToggleButtons
>
> PtToggleButtonA
> PtToggleButtonB
>
> I wrote code to clear the screen and I am using this code to unset the toggle
> buttons.
>
> PtSetResource(pWidget, Pt_ARG_FLAGS, Pt_FALSE, Pt_SET);
>
> This works as I expect when the two toggle buttons are not part of a group.
>
> I then made the two toggle buttons part of a group so that I could set them to
> be mutually exclusive.
>
> Now, when my application launches, neither button is selected. (As expected)
> When the user selects one button, it deselects the other (As expected)
> However, when my code runs to clear the screen (deselect both buttons) it no
> longer works.
>
> What am I missing?
>
> Any help is appreciated. Thanks.
|
|
|