can't unblock button

i have a button on my app that is pt_blocked by default through the resources tab of phab. when a selected dialog is activated the realize code of that dialog is supposed to unblock the button… its not working :frowning:
here’s my code

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

{
unsigned long flags;
/
eliminate ‘unreferenced’ warnings */
widget = widget, apinfo = apinfo, cbinfo = cbinfo;
PtSetResource(ABW_PtCalDistanceButton, Pt_ARG_FLAGS,0,0);
PtGetResource(ABW_PtCalDistanceButton, Pt_ARG_FLAGS, &flags, 0 );
printf(“init called\n”);
printf( “blocked?: %s\n”,
*flags & Pt_BLOCKED ? “Yes”:“No” );
return( Pt_CONTINUE );

}

when this function run the last printf statment always prints yes, this means that even though i reset all flags the pt_blocked flag still remains…

anyone know why??

vince

Previously, vince wrote in qdn.public.qnxrtp.photon:

i have a button on my app that is pt_blocked by default through the
resources tab of phab. when a selected dialog is activated the realize
code of that dialog is supposed to unblock the button… its not
working > :frowning:
here’s my code

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

{
unsigned long flags;
/
eliminate ‘unreferenced’ warnings */
widget = widget, apinfo = apinfo, cbinfo = cbinfo;
PtSetResource(ABW_PtCalDistanceButton, Pt_ARG_FLAGS,0,0);

This should be:

PtSetResource(ABW_PtCalDistanceButton, Pt_ARG_FLAGS, 0, Pt_BLOCKED);

PtGetResource(ABW_PtCalDistanceButton, Pt_ARG_FLAGS, &flags, 0 );
printf(“init called\n”);
printf( “blocked?: %s\n”,
*flags & Pt_BLOCKED ? “Yes”:“No” );
return( Pt_CONTINUE );

}

when this function run the last printf statment always prints yes,
this means that even though i reset all flags the pt_blocked flag
still remains…

anyone know why??

vince

You haven’t actually reset any flags with the above code. The fourth
argument is a mask, and the third is the value. The mask must have a
1 for every bit whose value you want to change. By passing 0 for all
bits in the mask, you have essentially said “do nothing”. To reset
all flags (not generally a good idea), pass -1 (all bits set) for the
mask, as:

PtSetResource(ABW_PtCalDistanceButton, Pt_ARG_FLAGS, 0, -1);

Cheers,
Andrew