sketchucation logo sketchucation
    • Login
    šŸ¤‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Closing a WebDialog

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 2 Posters 648 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Al HartA Offline
      Al Hart
      last edited by

      I have an OK button on my WebDialog, and want it to close the dialog.

      What is the proper command to close a WebDialog from a button?

      Al Hart

      http:wiki.renderplus.comimageseefRender_plus_colored30x30%29.PNG
      IRender nXt from Render Plus

      1 Reply Last reply Reply Quote 0
      • E Offline
        ekaj42
        last edited by

        The answer should be that you use the WebDialog.close method, but that hasn't worked for me. I have tried to close my dialog from a button using two methods:
        A). Used WebDialog.add_action_callback to add a callback, which in turn calls WebDialog.close on the WebDialog, and call this callback in the script behind my close button.
        B). The script behind my close button uses window.close() in javascript.
        Either way, only the html page within the WebDialog seems to be closed. I am left with the dialog window still sitting there, displaying a "This program cannot display the webpage" message.

        Just to be clear, here is my close button code in HTML:

        <input type="button" class="okcancel" value="Cancel" onclick="close_dialog();" />
        

        Here is the javascript that button runs:

        function close_dialog() {
        window.location='skp_close_dialog';
        }
        

        Here is where I register my callback that closes the WebDialog (@dialog is the dialog I opened earlier):

        			@dialog.add_action_callback("close_dialog") {
        				|d,params|
        				@dialog.close
        			}
        

        It seems like it should be pretty simple, but it just doesn't close right. If anybody out there knows why this happens, I'd appreciate hearing about it.

        1 Reply Last reply Reply Quote 0
        • E Offline
          ekaj42
          last edited by

          Wow, face red! It took me until I'd posted the problem & looked at my reply sitting there that I saw my error. I was missing a colon in my javascript that called the callback ('skp_close_dialog' should be 'skp:close_dialog'). Once I fixed that, the problem went away.

          So the answer is, Webdialog.close works just great.

          1 Reply Last reply Reply Quote 0
          • Al HartA Offline
            Al Hart
            last edited by

            Thanks,

            I have mine working now as well.

            Al Hart

            http:wiki.renderplus.comimageseefRender_plus_colored30x30%29.PNG
            IRender nXt from Render Plus

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Buy SketchPlus
            Buy SUbD
            Buy WrapR
            Buy eBook
            Buy Modelur
            Buy Vertex Tools
            Buy SketchCuisine
            Buy FormFonts

            Advertisement