Results 1 to 2 of 2
  1.    #1  
    I'm trying to use the code from UI Widgets to display a Dialog box with "Save" and "Cancel" side by side. In the example, the setup code is as follows:
    MydialogAssistant.prototype.setup = function(widget) {
    	this.widget = widget;
    	/* this function is for setup tasks that have to happen when the scene is first created */		
    	/* use Mojo.View.render to render view templates and add them to the scene, if needed. */	
    	/* setup widgets here */	
    	/* add event handlers to listen to events from widgets */
    	d = new Date();
    	this.t_attr = {
    		label:	'Time',
    		modelProperty:	'value',
    		minuteInterval : 10
    	this.t_model = {
    		value : d
    	this.controller.setupWidget('time_field', this.t_attr, this.t_model); =;
    	this.cancel = this.cancel.bindAsEventListener(this);
    As you can see, the parameter "widget" is passed to the setup() function. The code that puts the dialog up is:
    DialogAssistant.prototype.buttonPressed = function(){
    			template: 'dialogs/dialog/mydialog-scene',
    			assistant: new MydialogAssistant(this, this.callback.bind(this)),
    			preventCancel: true
    Where is "widget" passed to setup()? When I tried to do the same code in my code, I get:
    Error: Caught exception in _Dialog widget 'undefined' setup():

    Dazed and confused! Help?
  2.    #2  
    Sorry, the error was being caused by a typo. Somehow "widget" gets passed to setup() and everything is okay even though I don't understand how it works.

Posting Permissions