3 ms·
Can the native widgets be used instead of the Canvas widgets in the browser hosted view? The definition of layout is nice, but handling state changes is still
by diskzero 6y ago
Can the native widgets be used instead of the Canvas widgets in the browser hosted view?
The definition of layout is nice, but handling state changes is still imperative. Is there a way to have values update without having to explicitly respond to signals?
- ogoffart 6y agoIf you mean the native browser widget, this is currently not planed. The browser view is just a way to preview the result, but the real product is meant to be used natively without a browser. On the desktop platform, we can make use of a native style (using the styles from Qt in the current implementation) As for the handling of the state change, they are not imperative. The values update automatically as the property changes. (For example the text of this button changes when you click it: https://www.sixtyfps.io/editor/?snippet=%0Aimport+%7B+Button+%7D+from+%22sixtyfps_widgets.60%22%3B%0Aexport+Demo+%3A%3D+Window+%7B%0A++++property+%3Cint%3E+counter%3A+10%3B%0A++++width%3A+200px%3B%0A++++height%3A+100px%3B%0A++++VerticalLayout+%7B%0A++++++++Button+%7B++%0A++++++++++++text%3A+%22the+value+is+%22+%2B+counter%3B%0A++++++++++++clicked%3D%3E+%7B+counter+%2B%3D+1+%7D%0A++++++++%7D%0A++++%7D%0A%7D%0A# https://www.sixtyfps.io/editor/?snippet=%0Aimport+%7B+Button... )
- diskzero 6y agoGot it. Can you show an example of modifiying the button label outside of the button click? I am curious how you would modify values outside of the scope of the event handler.
- ogoffart 6y agoIn the following example, the text is bound to the text of a line edit: https://www.sixtyfps.io/editor/?snippet=import+%7B+LineEdit+%7D+from+%22sixtyfps_widgets.60%22%3B%0Aexport+Demo+%3A%3D+Window+%7B%0A++++name+%3A%3D+LineEdit+%7B+text%3A+%22World%22%3B+%7D%0A++++Text+%7B%0A++++++++y%3A+50px%3B%0A++++++++text%3A+%22Hello%2C+%22+%2B+name.text%3B%0A++++%7D%0A%7D https://www.sixtyfps.io/editor/?snippet=import+%7B+LineEdit+... Is that the kind of example you were looking for?
- diskzero 6y agoThat is great. Thanks!