From e3b104fb6138c7dff50c4a4e8ef9d7cc0588c25a Mon Sep 17 00:00:00 2001 From: kevin Date: Sun, 31 Jan 2021 11:07:29 -0500 Subject: [PATCH] cwUi.h/cpp : Fixed bug in _parseValueMsg() and updated comments in cwUi.h --- cwUi.cpp | 2 +- cwUi.h | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/cwUi.cpp b/cwUi.cpp index db256f7..cd676a1 100644 --- a/cwUi.cpp +++ b/cwUi.cpp @@ -650,7 +650,7 @@ namespace cw break; case 's': - if((valueRef.u.s = nextNonWhiteChar(s)) == nullptr ) + if((valueRef.u.s = nextNonWhiteChar(s)) != nullptr ) valueRef.tid = kStringTId; break; diff --git a/cwUi.h b/cwUi.h index 1dba1b2..ffe8756 100644 --- a/cwUi.h +++ b/cwUi.h @@ -48,10 +48,39 @@ namespace cw // Return the uuid of the first matching 'eleName' or 'appId'. unsigned findElementUuId( handle_t h, const char* eleName ); unsigned findElementUuId( handle_t h, unsigned appId ); + + // Create multiple UI elements from an object_t representation. rc_t createFromObject( handle_t h, const object_t* o, unsigned wsSessId, unsigned parentUuId=kInvalidId, const char* eleName=nullptr); rc_t createFromFile( handle_t h, const char* fn, unsigned wsSessId, unsigned parentUuId=kInvalidId); rc_t createFromText( handle_t h, const char* text, unsigned wsSessId, unsigned parentUuId=kInvalidId); + + // + // Create Sincgle UI elements on the UI instance identified by wsSessId. + // + // uuIdRef: Returns the automatically generated id for this element. + // It is unique across all elements associated with this ui::handle. + // Note that this id is NOT generated per wsSession, it is only generated + // the first time a particular element of this ui::handle is created. + // + // wsSessId: Identifies a particular instance (websock session) of the UI. + // Multiple instances of a UI may exist for a single application instance each will have a unique wsSessId. + // Set this value to kInvalidId to create this element on all existing websock sessions. Note that this is + // an unusual use since UI elements are usually created when new sessions are connected and therefore + // a specific wsSessId is available. + // + // parentUuId: uuid of parent element that the new element will be a child of. + // + // eleName: (optional) HTML ele id of the new element. + // + // appId: (optional) Application id. This is the application variable which this UI element represents. + // This id is generally the same across all UI instances. + // + // clas: (optional) HTML class of the new element + // + // title: (optional) Visible Text label associated with this element. + // + rc_t createDiv( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title ); rc_t createTitle( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title ); rc_t createButton( handle_t h, unsigned& uuIdRef, unsigned wsSessId, unsigned parentUuId, const char* eleName, unsigned appId, const char* clas, const char* title );