Announcement

Collapse
No announcement yet.

Close Application Tabs Programmatically

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Close Application Tabs Programmatically

    With the setting "Open items in a tab" one can since version 8 from a menu application open each selected menu item (i.e. application item) in a new tab. This is just great as one can easily open and work with several part of the full application.

    Sometimes, however, an application tab is only needed for a specific task/process, e.g. may be prompted for some information in a control form application and based on this, the task is performed. Afterwards the application tab is not relevant anymore. In this case it would be good if it could be closed programmatically, rather than the user having to manually close it. Is this possible?
    Best regards,

    Frank

  • #2
    you can close it by using the SC_EXIT macro.

    Have you tried it?.

    Regards

    Comment


    • #3
      Unfortunately, I cannot get the SC_EXIT macro to work properly. The problem is that it returns to the previous application which is the menu, but it opens a new instance of it. Thus, there is the original menu in the left side (as I use a vertical menu application) and then a new instance of the same menu in the tab that was already opened. SC_EXIT does not exit the tab.

      Perhaps that behaviour could be considered a bug. What do you think?
      Best regards,

      Frank

      Comment


      • #4
        If you can use JS, you can try triggering the same JS function that SC attach to the 'x' icon for closing tabs.

        Move your mouse over the 'x' inside the tab to see the name and parameter of the JS function to use

        I just tried in the browser JS console and executing
        Code:
        del_aba_td('item_25'); 
        did close my tab.

        Comment


        • #5
          Originally posted by robydago View Post
          If you can use JS, you can try triggering the same JS function that SC attach to the 'x' icon for closing tabs.

          Move your mouse over the 'x' inside the tab to see the name and parameter of the JS function to use

          I just tried in the browser JS console and executing
          Code:
          del_aba_td('item_25'); 
          did close my tab.
          Okay, I must admin that I am somewhat of a novice in JS when used to handling web pages.
          When I move my mouse over the 'x' icon on the tab, I just a get tool tip containing the name of the tab itself. How do you get the JS function name to show?

          I have reported the behaviour of SC_EXIT to ScriptCase. It is kind of gross and must be considered a bug.
          Best regards,

          Frank

          Comment


          • #6
            Depends on the browser.
            With Chrome I get the URLs or onclick JS functions displayed on the bottom left of the chrome window when the mouse is over a link.
            If that's not sohwn, right click on the 'x' icon and select 'Inspect' to see the page code.

            Comment


            • #7
              Originally posted by robydago View Post
              Depends on the browser.
              With Chrome I get the URLs or onclick JS functions displayed on the bottom left of the chrome window when the mouse is over a link.
              If that's not sohwn, right click on the 'x' icon and select 'Inspect' to see the page code.
              Tab context menu Yes No Creates a context menu to manage the menu tabs
              Menu tabs navigation Yes No Activates the tab navigation when many tabs are opened at the same time.
              If I turn any these options turned on, I cannot see the JS functions under the developer tools.

              However, better yet: ScriptCase has come back and acknowledged that the problem with SC_EXIT that I described above is a bug so it will be fixed.
              Last edited by Orion; 07-21-2016, 05:12 AM.
              Best regards,

              Frank

              Comment


              • #8
                Because the application runs in an iframe, you may need to prefix with parent., so
                del_aba_td('item_25'); becomes parent.del_aba_td('item_25');

                Comment


                • #9
                  Originally posted by bradk View Post
                  Because the application runs in an iframe, you may need to prefix with parent., so
                  del_aba_td('item_25'); becomes parent.del_aba_td('item_25');

                  Ah, good to know.
                  Best regards,

                  Frank

                  Comment


                  • #10
                    Code:
                    parent.del_aba_td('item_25');


                    Yep.
                    I just tested it and it works in a scriptcase JS button on a form.
                    With PHP it should work with
                    sc_ajax_javascript();

                    Comment

                    Working...
                    X