How can you tell if a web page that uses “implicit instance” has already been opened? I was thinking it might be possible to use something like “isA” but not really sure. At the moment I have a whole heap of session properties that I set to false on session start and then when each page is loaded I change the appropriate one to true and then check this when I need to know if it has been opened already but I am thinking that their must be a better way of doing this internally within Xojo.
If its an implicit instance than it ‘opens’ when session is created.
What you probably want to do is update your session properties on the Shown event of the first web page that gets shown to the user.
something like…
for i = 0 to Session.pageCount - 1
if Session.PageAtIndex(i) isa wpPageClass then
// it's been opened
end if
next
Thanks Brad, that is an interesting way of doing it.
Philip, the issue is that I need to know if a page has already been shown because once a page has been shown the open event doesnt appear to fire again so if you have changed information on the page at runtime then when you show the page again it has all the changes you made which may be desirable but for my case this is not what I want, I need the page to be back to its defaults. So by checking if the page is already loaded before I do the page.show allows me to set everything back. Also on the shown event I read data from the database using a timer but the data doesnt need to be updated so I use the check to see if the page has already been shown then I dont bother reading the database etc again. This greatly improves the user experience and reduces latency and bandwidth,