B4J Question [ABMaterial] How to detect whether ModalSheet is Open or not

Discussion in 'B4J Questions' started by Anser, May 9, 2019.

  1. Anser

    Anser Well-Known Member Licensed User

    Hi,

    Is there any method to detect whether a model sheet is already open or not on a page?

    Here is the scenario:-

    I have a page with a button and when the button is clicked it opens a ModalSheet.
    Once the model sheet is opened, on the Model sheet itself, I have a back button to close the modal sheet.
    To close this modal sheet, the user is supposed to click the back button available on the model sheet and go back to the original screen that he was viewing before opening the Modal Sheet.

    Unfortunately, some users are clicking on the browser's back button. Doing so will take the user to the previous page. This is not what I need. If the user clicks on the browser's back button, the app should be able to detect whether the model sheet is already open or not, if the modal sheet is already open then it should close the already open modal sheet and then remain on the same page.

    Any hints will be appreciated.:)
     
  2. alwaysbusy

    alwaysbusy Expert Licensed User

    Have you tried Page.IsModalsheetOpen("modalsheetname")?
     
    Anser likes this.
  3. Anser

    Anser Well-Known Member Licensed User

    Yes. This was the one I was looking for. Thank you. May I ask you one more question.
    I need to detect this when the user clicks on the Back button of the BROWSER, so which is the right event in the page to place this check?
     
  4. alwaysbusy

    alwaysbusy Expert Licensed User

    There is only page.DisableBackButton = true (to use in BuildPage only!). There is no event that can be raised.
     
  5. Anser

    Anser Well-Known Member Licensed User

    May I know where exactly to place the code. I placed page.DisableBackButton = true inside BuildPage(). Unfortunately, even after adding this code, the back button is not disabled on the browser
    Code:
    public Sub BuildPage()
        
    ' initialize the theme
        BuildTheme
       
        
    ' initialize this page using our theme
        page.InitializeWithTheme(Name, "/ws/" & ABMShared.AppName & "/" & Name, False, ABMShared.SessionMaxInactiveIntervalSeconds, theme)
        
    page.ShowLoader=True
        
    page.PageHTMLName = "index.html"
        
    page.PageTitle = "Sales Performance Charts"
        
    page.PageDescription = "Sales Performance Charts"
        
    page.PageKeywords = ""
        
    page.PageSiteMapPriority = ""
        
    page.PageSiteMapFrequency = ABM.SITEMAP_FREQ_YEARLY
        
    page.DisableBackButton = True
        
    page.ShowConnectedIndicator = True
       
        
    'To be enabled, if we Plan to use Google Charts
        page.AddExtraJavaScriptFile("https://www.google.com/jsapi")
                   
        
    ' adding a navigation bar
        ABMShared.BuildNavigationBar(page"Sales Chart","../images/mylogo.jpg""""""")
               
        
    ' create the page grid
        page.AddRows(1,True"").AddCells12(1,"")

        
    page.BuildGrid 'IMPORTANT once you loaded the complete grid AND before you start adding components
           
    End Sub
     
  6. alwaysbusy

    alwaysbusy Expert Licensed User

    Yes, this is the correct place. I use this all the time. Which browser are you using? Note that the button itself is not disabled, it just shouldn't do anything when clicked.
     
  7. Anser

    Anser Well-Known Member Licensed User

    I am using Chrome. On Chrome, the browser's BACK button is not getting disabled.
    I checked on Mozilla FireFox and found that the BACK button is disabled. Disabled means even if we click nothing will happen.

    So the problem is ONLY on Google Chrome
     
  8. alwaysbusy

    alwaysbusy Expert Licensed User

    I think it may be a cache problem in your Chrome browser because I tested it in Chrome.
     
    Anser likes this.
  9. Anser

    Anser Well-Known Member Licensed User

    Ye
    Yes. You are right
     
    Harris and alwaysbusy like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice