Skip to content

Commit

Permalink
Update glowcommlab.js for winput
Browse files Browse the repository at this point in the history
  • Loading branch information
BruceSherwood committed Nov 7, 2018
1 parent 6c74af9 commit b19645c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion labextension/vpython/src/glowcommlab.js
Expand Up @@ -313,7 +313,7 @@ function process_binding(event) { // event associated with a previous bind comma

var sliders = {}

function control_handler(obj) { // button, menu, slider, radio, checkbox
function control_handler(obj) { // button, menu, slider, radio, checkbox, winput
"use strict";
var evt = {idx: obj.idx}
if (obj.objName === 'button') {
Expand All @@ -335,6 +335,10 @@ function control_handler(obj) { // button, menu, slider, radio, checkbox
} else if (obj.objName === 'menu') {
evt.value = obj.index
evt.widget = 'menu'
} else if (obj.objName === 'winput') {
evt.text = obj.text
evt.value = obj.number
evt.widget = 'winput'
} else {
console.log('unrecognized control', 'obj=', obj, obj.text)
}
Expand Down Expand Up @@ -726,6 +730,13 @@ function handle_cmds(dcmds) {
cfg = fix_location(cfg)
glowObjs[idx] = wtext(cfg)
break
}
case 'winput': {
cfg.objName = obj
cfg.bind = control_handler
cfg = fix_location(cfg)
glowObjs[idx] = winput(cfg)
break
}
case 'checkbox': {
cfg.objName = obj
Expand Down

0 comments on commit b19645c

Please sign in to comment.