mircea
1
Fuse version: 0.28
Operating system: Windows 10 (64bit)
Here’s the code:
<App Background="#fff">
<JavaScript>
console.log('init');
function panel_placed(args) {
console.log('panel_placed');
}
</JavaScript>
<Panel Placed="{panel_placed}"/>
</App>
The placed function is never called: https://dl.dropboxusercontent.com/s/fqr4jmxwj0dmzj2/shot_161026_130230.jpg
kusma
2
You need to add planel_placed
to module.exports
.
mircea
4
Just so I don’t start a new thread, can you tell me why var “a” doesn’t show the panel’s value?
<App Background="#fff">
<JavaScript>
var Observable = require('FuseJS/Observable');
var a = Observable(0);
var b = Observable(0);
function init() {
b = 100;
}
init();
function panel_placed(args) {
a = args.height;
}
module.exports = {
panel_placed: panel_placed,
a: a,
b: b,
};
</JavaScript>
<StackPanel Placed="{panel_placed}">
<Text>a:</Text>
<Text Value="{a}"/>
<Text>b:</Text>
<Text Value="{b}"/>
</StackPanel>
</App>
the function panel_placed gets called but the variable is not updated
kusma
5
You’re just replacing the local variable a
, not the value in the Observable
. Try writing to a.value
instead of a
in panel_placed
.