cwIo.h/cpp, cwUi.h/cpp : Added emptyParent().

This commit is contained in:
kevin 2024-09-21 17:18:12 -04:00
parent def7727d23
commit 4f2174c82d
4 changed files with 40 additions and 1 deletions

View File

@ -3843,6 +3843,16 @@ cw::rc_t cw::io::uiSetLogLine( handle_t h, unsigned uuId, const char* text )
rc = ui::setLogLine(uiH,uuId,text);
return rc;
}
cw::rc_t cw::io::uiEmptyParent( handle_t h, unsigned uuId)
{
rc_t rc;
ui::handle_t uiH;
if((rc = _handleToUiHandle(h,uiH)) == kOkRC )
rc = ui::emptyParent(uiH,uuId);
return rc;
}
cw::rc_t cw::io::uiSetClickable( handle_t h, unsigned uuId, bool clickableFl )
{

3
cwIo.h
View File

@ -386,7 +386,8 @@ namespace cw
rc_t uiSetNumbRange( handle_t h, unsigned uuId, double minValue, double maxValue, double stepValue, unsigned decPl, double value );
rc_t uiSetProgRange( handle_t h, unsigned uuId, double minValue, double maxValue, double value );
rc_t uiSetLogLine( handle_t h, unsigned uuId, const char* text );
rc_t uiSetLogLine( handle_t h, unsigned uuId, const char* text );
rc_t uiEmptyParent( handle_t h, unsigned uuId); // empty a list or select of all children
rc_t uiSetClickable( handle_t h, unsigned uuId, bool clickableFl=true );
rc_t uiClearClickable( handle_t h, unsigned uuId );

View File

@ -1951,6 +1951,33 @@ cw::rc_t cw::ui::setLogLine( handle_t h, unsigned uuId, const char* text )
return rc;
}
cw::rc_t cw::ui::emptyParent( handle_t h, unsigned uuId )
{
ui_t* p = _handleToPtr(h);
rc_t rc = kOkRC;
const char* mFmt = "{ \"op\":\"empty\", \"uuId\":%i }";
const int mbufN = 256;
char mbuf[mbufN];
if( snprintf(mbuf,mbufN,mFmt,uuId) >= mbufN-1 )
{
rc = cwLogError(kBufTooSmallRC,"The msg buffer is too small for 'empty' msg.");
goto errLabel;
}
if((rc = _websockSend(p,kInvalidId,mbuf)) != kOkRC )
{
cwLogError(rc,"'empty' msg transmit failed.");
goto errLabel;
}
errLabel:
return rc;
}
cw::rc_t cw::ui::setClickable( handle_t h, unsigned uuId, bool clickableFl )
{ return _setPropertyFlag( h, UI_CLICKABLE_LABEL, uuId, clickableFl ); }

1
cwUi.h
View File

@ -130,6 +130,7 @@ namespace cw
rc_t setNumbRange( handle_t h, unsigned uuId, double minValue, double maxValue, double stepValue, unsigned decPl, double value );
rc_t setProgRange( handle_t h, unsigned uuId, double minValue, double maxValue, double value );
rc_t setLogLine( handle_t h, unsigned uuId, const char* text );
rc_t emptyParent( handle_t h, unsigned uuId );
rc_t setClickable( handle_t h, unsigned uuId, bool clickableFl=true );
rc_t clearClickable( handle_t h, unsigned uuId );