Dialog box

Hi I'm working on adding a dialog box to my code but I'm stuck trying to add it. I follow the Dialog example. 1. Scenario before adding the dialog: I have the following code in main.js which help me to connect the device with my app:

var ApplicationBehavior = Behavior.template({
    onDisplayed: function(application) {
        application.discover("pulsedevice");
    },
    onQuit: function(application) {
        application.forget("pulsedevice");
    },
})
application.behavior = new ApplicationBehavior();
  1. When I add the functionality of the Dialog box I comment the code above and add the following line in order to the dialogs show up in my app:
application.behavior = new MODEL.ApplicationBehavior( application );   
  1. The problems is that I don't know how to mix the two
application.behaviour

in one that uses

MODEL.ApplicationBehavior

, but at the same time help me to set up the connection with the device. Can someone help me please.

Comments

  • I am also having this exact issue. I would like to use a dialog but I don't know how to use both application behaviors.

  • I am also having this exact issue. I would like to use a dialog but I don't know how to use both application behaviors.

  • Hey I solved the problem just doing this:

    var ApplicationBehavior = Behavior.template({
        onDisplayed: function(application) {
            application.discover("pulsedevice");
            application.behavior = new MODEL.ApplicationBehavior( application );
        },
        onQuit: function(application) {
            application.forget("pulsedevice");
        },
    })
    application.behavior = new ApplicationBehavior();
    
Sign In or Register to comment.