cwUi.h: Added 'title' widget, and other minor HTML/JS/CSS changes.

This commit is contained in:
kevin.larke 2020-04-28 17:39:18 -04:00
parent a46453f371
commit 9b3fec0f95
5 changed files with 58 additions and 14 deletions

View File

@ -423,7 +423,8 @@ namespace cw
// get the ui ele name
if((rc = o->get("name",eleName, cw::kNoRecurseFl | cw::kOptionalFl)) != kOkRC )
{
if( rc == kLabelNotFoundRC && divAliasFl )
// div's and titles don't need a 'name'
if( rc == kLabelNotFoundRC && (divAliasFl || textCompare(eleType,"title")==0) )
rc = kOkRC;
else
{

View File

@ -3,6 +3,7 @@ body {
background-color: LightCyan;
}
.title_disconnected {
color: red;
}
@ -58,7 +59,7 @@ label {
background-color: LightBlue;
}
.uiRow {
.uiRow {
display: flex;
flex-direction: row;
align-items: center;

View File

@ -13,7 +13,10 @@
</head>
<body>
<p id="appTitleId">Disconnected</p>
<div id="appTitleDiv" class="uiRow">
<p id="appTitleId">UI Test:</p>
<p id="connectTitleId">Disconnected</p>
</div>
<div id="0" class="uiAppDiv">
</div>

View File

@ -4,8 +4,8 @@ var _nextEleId = 0;
function set_app_title( suffix, className )
{
var ele = document.getElementById('appTitleId');
ele.innerHTML = "UI Test:" + suffix
var ele = document.getElementById('connectTitleId');
ele.innerHTML = suffix
ele.className = className
}
@ -376,7 +376,14 @@ function ui_create_col_div( parent_ele, d )
function ui_create_title( parent_ele, d )
{
return ui_create_ele( parent_ele, "label", d, "uiTitle" );
var ele = ui_create_ele( parent_ele, "label", d, "uiTitle" );
if( ele != null )
{
ele.innerHTML = d.title;
}
return ele;
}
function ui_create_button( parent_ele, d )

View File

@ -10,8 +10,8 @@
row: {
button:{ name: myBtn1Id, title:"Push Me 1" },
check:{ name: myCheck1Id, title:"Check Me 1", value:true },
button:{ name: myBtn1Id, title:"Push Me" },
check:{ name: myCheck1Id, title:"Check Me", value:true },
select:{ name: mySel, title:"Select",
children:
{
@ -20,13 +20,45 @@
option:{ name: myOpt3, title:"Sel 3" }
},
},
},
},
row: {
button:{ name: myBtn2Id, title:"Push Me 2" },
check:{ name: myCheck2Id, title:"Check Me 2" },
button:{ name: myBtn2Id, title:"Push 2" },
check:{ name: myCheck2Id, title:"Check 2" },
number:{ name: myFloater, title:"Floater", min:0.0, max:12.34, step:0.1, decpl:4 },
}
},
panel: {
row: {
col: {
title:"Bank 0",
},
col: {
title: "x",
title:{ title:"mute" },
title:{ title:"touch" },
title:{ title:"fader" },
},
col: {
title:"0",
check:{ name: mute0Chk },
check:{ name: touch0Chk },
number:{ name: fader0Numb, min:0, max:1023, step:1, decpl:0 },
},
col: {
title:"1",
check:{ name: mute1Chk },
check:{ name: touch1Chk },
number:{ name: fader1Numb, min:0, max:1023, step:1, decpl:0 },
}
}
}
}
}