From 1a112829157fc4d674ec091442bb28179a016b10 Mon Sep 17 00:00:00 2001 From: "kevin.larke" Date: Tue, 24 Mar 2020 08:53:42 -0400 Subject: [PATCH] cwUi : Create message changed 'value' field to 'children'. --- cwUi.cpp | 2 +- html/uiTest/js/ui.js | 2 +- html/uiTest/ui.cfg | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cwUi.cpp b/cwUi.cpp index dace083..7f4166d 100644 --- a/cwUi.cpp +++ b/cwUi.cpp @@ -157,7 +157,7 @@ namespace cw newEle = _createEle( p, parentEle, appId, jsId ); - unsigned i = snprintf( buf, bufN, "{ \"op\":\"create\", \"parent\":\"%s\", \"value\":{ \"%s\":{ \"jsId\":\"%s\", \"appId\":%i, \"uuId\":%i, \"class\":\"%s\", \"title\":\"%s\" ", parentJsId, eleTypeStr, jsId, appId, newEle->uuId, clas, title ); + unsigned i = snprintf( buf, bufN, "{ \"op\":\"create\", \"parent\":\"%s\", \"children\":{ \"%s\":{ \"jsId\":\"%s\", \"appId\":%i, \"uuId\":%i, \"class\":\"%s\", \"title\":\"%s\" ", parentJsId, eleTypeStr, jsId, appId, newEle->uuId, clas, title ); i = format_attributes(buf, bufN, i, std::forward(args)...); diff --git a/html/uiTest/js/ui.js b/html/uiTest/js/ui.js index 01141b1..9f2da47 100644 --- a/html/uiTest/js/ui.js +++ b/html/uiTest/js/ui.js @@ -484,7 +484,7 @@ function ws_on_msg( jsonMsg ) switch( d.op ) { case 'create': - for (const ele_type in d.value) + for (const ele_type in d.children) { ui_create( d.parent, ele_type, d.value[ele_type] ) //console.log(`${ele_type}: ${d.value[ele_type]}`); diff --git a/html/uiTest/ui.cfg b/html/uiTest/ui.cfg index 5bf4a5c..967d528 100644 --- a/html/uiTest/ui.cfg +++ b/html/uiTest/ui.cfg @@ -1,12 +1,14 @@ { div: { + title:"My panel", children: { button:{ id:myBtnId, title:"Push Me" }, - select:{ id:mySelectId, title:"Selector", optionL: { myId0:"Option 0", myId2:"Option 1", myId3:"Option 3" }} + check:{ id:myCheckId, title:"Check Me" }, + select:{ id:mySelectId, title:"Selector", values: [ myId0:"Option 0", myId2:"Option 1", myId3:"Option 3" ] } }