I am building a photon application for a device with no mouse input - only keyboard - and a monchrome display. So I have to select dialog items via TAB and cursor keys.
What I need is good visual feedback of which widget actually has the input focus (e.g frame, white color, and the like). The resources for that offered in PhAb (roundness) are rather poor and almost invisible on monochrome. So I built my own focus callbacks (see below). This works pretty well for simple widgets (buttons, sliders,…)
but not for compound widgets (combo-boxes, …)
Is there something in PhAb I have not yet discovered?
I think other programmers may have faced similar problems before.
My code I don’t want to use:
int DlgElementGotFocus( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
PgColor_t *pFillColor;
const long *plBasicFlags;
const long *plFlags;
/* eliminate 'unreferenced' warnings */
widget = widget, apinfo = apinfo, cbinfo = cbinfo;
pFocussedWidget = widget;
PtGetResource( widget, Pt_ARG_FLAGS, &plFlags, 0 );
lFlags = *plFlags;
PtGetResource( widget, Pt_ARG_BASIC_FLAGS, &plBasicFlags, 0 );
lBasicFlags = *plBasicFlags;
PtGetResource( widget, Pt_ARG_FILL_COLOR, &pFillColor, 0 );
fillColor = *pFillColor;
PtSetResource( widget, Pt_ARG_FLAGS, Pt_TRUE, Pt_HIGHLIGHTED );
PtSetResource( widget, Pt_ARG_BASIC_FLAGS, Pt_TRUE, Pt_ALL_INLINES );
PtSetResource( widget, Pt_ARG_FILL_COLOR, Pg_WHITE, 0 );
return( Pt_CONTINUE );
}
int DlgElementLostFocus( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
/* eliminate 'unreferenced' warnings */
widget = widget, apinfo = apinfo, cbinfo = cbinfo;
//printf(" L%lu %lu \n", lFlags, widget);
PtSetResource( widget, Pt_ARG_FLAGS, Pt_FALSE, Pt_HIGHLIGHTED );
PtSetResource( widget, Pt_ARG_FLAGS, Pt_TRUE, lFlags );
PtSetResource( widget, Pt_ARG_BASIC_FLAGS, Pt_FALSE, Pt_ALL_INLINES );
PtSetResource( widget, Pt_ARG_BASIC_FLAGS, Pt_TRUE, lBasicFlags );
PtSetResource( widget, Pt_ARG_FILL_COLOR, fillColor, 0 );
return( Pt_CONTINUE );
}