How to check if WebPage has been instantiated

  1. 2 months ago

    Craig B

    May 14 Pre-Release Testers, Xojo Pro Dallas, TX

    Hi All,

    I am trying to keep from creating multiple instances of the same webpage.
    Is there a way to check to see if a page exists before I create it?

    Thanks.

    Similar to

    for i as Integer to (Session.PageCount - 1)
      dim oPage as WebPage = Session.PageAtIndex(i)
      if oPage isa pgPageYoureLookingFor then
        oPage.Show
        exit for i
    
      end
    
    next i

    Written in the post editor, if it works straight out of the forum that'd be kinda nifty.

  2. Tim P

    May 14 Pre-Release Testers Answer Rochester, NY
    Edited 2 months ago

    Similar to

    for i as Integer to (Session.PageCount - 1)
      dim oPage as WebPage = Session.PageAtIndex(i)
      if oPage isa pgPageYoureLookingFor then
        oPage.Show
        exit for i
    
      end
    
    next i

    Written in the post editor, if it works straight out of the forum that'd be kinda nifty.

  3. Craig B

    May 14 Pre-Release Testers, Xojo Pro Dallas, TX

    LOL!

    Give me a few and I will let you know.

    Thanks Tim!

  4. Craig B

    May 14 Pre-Release Testers, Xojo Pro Dallas, TX

    Slight change (otherwise perfect!):

    for i As Integer = 0  to (Session.PageCount - 1)
      dim oPage as WebPage = Session.PageAtIndex(i)
      if oPage isa wpHome then
        oPage.Show
        exit for i
        
      end
      
    next i

    This is the best I could do for a cookie:
    https://www.roblox.com/library/36244635/One-Virtual-Cookie

  5. Tim P

    May 14 Pre-Release Testers Rochester, NY

    D'oh, forgot to set the integer to 0.

or Sign Up to reply!