Skip to content

Instantly share code, notes, and snippets.

@lauromoura
Created September 28, 2015 20:23
Show Gist options
  • Save lauromoura/fe8b9a6722214e41e0d4 to your computer and use it in GitHub Desktop.
Save lauromoura/fe8b9a6722214e41e0d4 to your computer and use it in GitHub Desktop.
//Copyright (C) 2008-2014 Expersite Solutions
//
// author: Lauro Moura
// email: lauromoura@expertisesolutions.com.br
// Based on work of Larry Lira
// email: larry@expertisesolutions@gmail.com.br
function addWidget(f, parent, bx) {
var widget = new f(parent);
widget.visibility_set(true);
bx.pack_end(widget);
return widget;
}
function button_click() {
console.log("Hello, world!");
}
elm = require('elm');
efl = require('efl');
var win = new elm.Elm_Win (null, 'name', 0);
win.title_set('EFl JS Hello World');
win.autodel_set(true);
var bg = new elm.Elm_Bg (win);
bg.size_hint_weight_set(1.0, 1.0);
win.resize_object_add(bg);
bg.visibility_set(true);
box = new elm.Elm_Box(win);
box.size_hint_weight_set(1.0, 1.0);
win.resize_object_add(box);
// t1 = addWidget(elm.Elm_Label, win, box);
// t1.text_set(null, "Hi there");
// t1.size_hint_weight_set(1.0, 1.0);
// t1.size_hint_align_set(-1.0, -1.0);
bt = addWidget(elm.Elm_Button, win, box);
bt.text_set("elm.text", "Click me!");
bt.event_clicked(button_click);
win.size_set(320,240);
box.visibility_set(true);
win.visibility_set(true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment