First you need to add these two property in your xml file
<property key="myInteger" type="integer" defaultValue="1000">
<caption>My integer</caption>
<description>My integer setting</description>
</property>
<property key="buttonAction" type="action">
<caption>On click</caption>
<description>Action to be performed when button is clicked</description>
</property>
In mendix add this widget inside a dataview. and select attribute which you want to pass.
//Get attribute value
let number = parseInt(props.myInteger.displayValue);
//For update mendix attribute
props.myInteger.setTextValue(number*number);
//Call a microflow/nanoflow
if(buttonAction && buttonAction.canExecute){
buttonAction.execute();
}
In microflow you will get updated object .
Hope this will help you.
By custom widget, you mean custom pluggable widget?
If so, you can call a microflow and pass your number as the output. That microflow can then show a message with the parameter.
This forum question might help:
https://community.mendix.com/link/space/widgets/questions/99506