Forum Discussion

chaklasiyanikun's avatar
6 years ago
Solved

Inside a task node open a dialogbox in Roku

I know task node works like thread and not support dialog inside a task node. But, Is there any way to open a dialog box inside a task node. I also used getparent(). But no luck. my code is below. ...
  • NB_'s avatar
    6 years ago

    chaklasiyanikun wrote:

    ...

    Here give me a warning not to exist dialog field. Is there any other option for this?


    seems to me you were on the right track, since wanting to display a modal dialog and that is easy to do using the .dialog field of the Scene. So you just have to grab the scene with getScene(). 

    i'd do something like this: 

        dlg = createObject("roSGNode", "Dialog")
        port2 = createObject("roMessagePort")
        dlg.observeField("buttonSelected", port2)
        dlg.observeField("wasClosed", port2)
    
        dlg.title = "Warning"
        dlg.message = "Not a valid URL request"
        dlg.buttons = ["OK"]
        
        dlg.getScene().dialog = dlg                  
        while wait(0, port2) = invalid
            ' pass
        end while
        dlg.close = true 'out of propriety