diff --git a/cmUi.c b/cmUi.c index 8f497c0..1ed7d8f 100644 --- a/cmUi.c +++ b/cmUi.c @@ -618,7 +618,7 @@ cmUiRC_t _cmUiCreateCtl( cmUi_t* p, unsigned appId, unsigned panelId, cmUiCId_t else { if( cmArrayIsValid(ap->ctlArrH) == false || usrId >= cmArrayCount(ap->ctlArrH) ) - ctl = cmArrayClr(cmUiCtl_t,ap->ctlArrH,usrId); + ctl = cmArrayClr(cmUiCtl_t,ap->ctlArrH,usrId); else { ctl = cmArrayPtr(cmUiCtl_t,ap->ctlArrH,usrId); @@ -1501,6 +1501,19 @@ cmUiRC_t cmUiClearPanel( cmUiH_t uiH, unsigned appId, unsigned panelId ) return rc; } +cmUiRC_t cmUiSelectPanel( cmUiH_t uiH, const cmChar_t* label ) +{ + cmUiRC_t rc = kOkUiRC; + cmUi_t* p = _cmUiHandleToPtr(uiH); + + + + + return rc; + +} + + cmUiRC_t cmUiNextRect( cmUiH_t uiH, unsigned appId, unsigned panelId, int x, int y, int w, int h ) { cmUi_t* p = _cmUiHandleToPtr(uiH); @@ -2095,6 +2108,29 @@ const cmChar_t* cmUiListEleLabel( cmUiH_t uiH, unsigned appId, unsigned id, unsi return cmArrayPtr(cmUiListEle_t, ctl->idArrH, index )->label; } +unsigned cmUiListEleLabelToIndex( cmUiH_t uiH, unsigned appId, unsigned id, const cmChar_t* label ) +{ + cmUi_t* p = _cmUiHandleToPtr(uiH); + cmUiCtl_t* ctl; + cmUiRC_t rc; + unsigned i,n; + + if( label == NULL ) + return cmInvalidIdx; + + if((rc = _cmUiFastFindCtl(p,appId,id,&ctl,true)) != kOkUiRC ) + return cmInvalidIdx; + + if( cmArrayIsValid( ctl->idArrH )==false || (n = cmArrayCount( ctl->idArrH))==0 ) + return cmInvalidIdx; + + for(i=0; iidArrH, i )->label,label) == 0 ) + return i; + + return cmInvalidIdx; +} + cmUiRC_t cmUiLastRC( cmUiH_t uiH ) diff --git a/cmUi.h b/cmUi.h index b1a4251..9e42e98 100644 --- a/cmUi.h +++ b/cmUi.h @@ -88,7 +88,7 @@ extern "C" { 4) Come up with a threading model. For example maybe control creation should use a blocking scheme since it is - generally to time consuming to do during real-time operation + generally too time consuming to do during real-time operation anyway. If the control flow generated from driver event callbacks then allows value, but not structural changes, then non blocking will be necessary. @@ -247,6 +247,8 @@ extern "C" { // Destroy all the controls in a panel. cmUiRC_t cmUiClearPanel( cmUiH_t uiH, unsigned appId, unsigned panelId ); + cmUiRC_t cmUiSelectPanel( cmUiH_t uiH, const cmChar_t* label ); + //------------------------------------------------------------------------------------------ // Location: @@ -376,6 +378,7 @@ extern "C" { unsigned cmUiListEleCount( cmUiH_t uiH, unsigned appId, unsigned id ); unsigned cmUiListEleId( cmUiH_t uiH, unsigned appId, unsigned id, unsigned index ); const cmChar_t* cmUiListEleLabel( cmUiH_t uiH, unsigned appId, unsigned id, unsigned index ); + unsigned cmUiListEleLabelToIndex( cmUiH_t uiH, unsigned appId, unsigned id, const cmChar_t* label ); // Query/set the current error state. cmUiRC_t cmUiLastRC( cmUiH_t uiH );