WWW-www.enlightenment.org pushed a commit to branch master. http://git.enlightenment.org/website/www-content.git/commit/?id=e65a6b6fabd958d91ff810d1e2ab243653f7c0ba
commit e65a6b6fabd958d91ff810d1e2ab243653f7c0ba Author: Larry de Oliveira Lira Junior <[email protected]> Date: Thu Dec 10 07:37:11 2015 -0800 Wiki page javascript_tutorial changed with summary [] by Larry de Oliveira Lira Junior --- pages/tutorial/javascript_tutorial.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pages/tutorial/javascript_tutorial.txt b/pages/tutorial/javascript_tutorial.txt index 2d5e20c..1170c0c 100644 --- a/pages/tutorial/javascript_tutorial.txt +++ b/pages/tutorial/javascript_tutorial.txt @@ -72,18 +72,20 @@ Import Elementary module Elm = require('elm').Elm; </code> -Create a new Windown with autohide +Create a new Window with autohide (the window is hide automatic when close is pressed): <code javascript> win = new Elm.WinStandard(null); win.setTitle("Hello, World!"); win.setAutohide(true); </code> +Create a new Button (passed window has parent) and set new label text to button: <code javascript> btn = new elm.Elm.Button(win); btn.setText(null, "Good-Bye, World!"); </code> +Set button basic size and positions: <code javascript> btn.setSize(120, 30); btn.setPosition(60, 15); @@ -91,10 +93,12 @@ btn.setSizeHintWeight(1.0, 1.0); btn.setSizeHintAlign(1.0, 1.0); </code> +The method ''on'' is used to register callback on events, in this case we need catch the ''clicked'' event, we register a function (second argument) to print a log message when button ''btn'' is clicked <code javascript> btn.on('clicked', function () { console.log('clicked'); } ); </code> +To finish is needy show all elements, for that use ''setVisible(true)'' <code javascript> btn.setVisible(true); win.setSize(240, 60); --
