Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


Code Block
var button = Widget.createController('button').getView();

All methods in the widget controller are private unless you prefix the method with $, which makes it accessible to the Alloy project and other widgets. For example, if the following code was defined in a widget controller:

Code Block
$.init = function (args) {
    // Button object with id=button
    $.button.title = args.title || 'Si'; 
    $.button.color = args.color || 'black'; 
    // global variable
    message = args.message || 'Hola mundo';


Use models the same way as with a regular Alloy project except to create a model or collection inside a widget controller, use the the Widget.createModel(model_name, [params]) and Widget.createCollection(model_name, [params]) methods, respectively.  You can also use the Model and Collection tags in widget views.


The main TSS file is called widget.tss instead of index.tss.