Hi,
I played a while with the xml declarations. To get the next level I want to create a small calculator app for better understanding of Fuse.
During this I got challenged by implementing the click logic for my calculator buttons. I created a grid with nodes of my custom CalculatorButtons, which are Rectangle based and provided via the ux:Class tag.
My simplified view looks like:
<Grid Rows="1, 9">
<Grid Columns="2,2,2,1">
<CalculatorButton LabelText="m+" ux:Name="m_plus" Clicked="{calculatorClickHandler}" />
</Grid>
<Grid Columns="6,1" >
<Grid Columns="2,2,2" >
<CalculatorButton LabelText="7" ux:Name="n_7" Clicked="{calculatorClickHandler}" />
</Grid>
<Grid Rows="1,1,1,1,4" >
<CalculatorButton LabelText="÷" ux:Name="a_divide" Clicked="{calculatorClickHandler}" />
</Grid>
</Grid>
The according JS-Part:
<JavaScript>
var calculatorClickHandler = function(args) {
console.log(args.sender);
}
module.exports = {
calculatorClickHandler : calculatorClickHandler
}
</JavaScript>
Now I have two questions:
- Question - how to handle mit clicked target: I looks like the only thing I can access from JS regarding my clicked target are the values provided by the arguments of calculatorClickHandler. I did not found any way to access more details of my clicked target, like the instance, or even better data properties of my target.
I played around with internal properties like: <string ux:Property="LabelText" />
Also if I tried to generate bindable properties I was not able to access them from outside by JS. Is there nothing like public properties for custom classes, which are accessible via JS?
- Question - bubbling of click event For better code style I tried to move Clicked-handling-declaration to the „root“-node of my grid, to prevent to declare x times the Clicked bounding. Is such bubbling of events possible? I did not find any solution for this.