I’ve been spending a lot of time in the documentation and this forum and still can’t get this to work.
I have a weblistbox that will navigate to a detail page if the user clicks a button to view details. Here is the contents of that button.
if lbRecords.SelectedRowIndex > -1 then
var nID As Integer = lbRecords.RowTagAt(lbRecords.SelectedRowIndex)
Session.SaveState(“YourClassListing”,nID.ToString)
Session.ID_ReadOnly = nID
var wContactInfo As New ContactInfo
wContactInfo.Show
The nID variable contains the record ID selected when the button is pressed to see the details.
That works fine. If the user then clicks the “back” button, I expected the session.hashtagchanged event would fire which it does, but the parameters of the hashtagchanged (name and data) are blank. Is this because I’m running in debug mode as opposed to xojo cloud? I just want to make sure that I’m doing this correctly.
I believe that by using the ‘Back’ button in the browser you’re essentially reloading the App/Session, creating a new Session. You should put navigation items in your App, letting Xojo go from WebPage to WebPage in the App. Hope that makes sense.
when they press the back button how will it know to redisplay that page. I’ve tried putting that in the shown event of a web page but nothing seems to happen when I press the back button on a subsequent page selected.
Don’t forget that SaveState can actually take 3 parameters.
Name as String
Data as String = “”
Replace as Boolean = False
I find that the simplest way to use this is to call SaveState whenever something significant happens that you might want the user to be able to go back to. For instance:
On Page.Shown, just the name.
User fills out fields and submits, maybe name and data.
Now this feature is a stack, so every time you save state, another entry is put on the stack. If you want to replace the most recent item, you set the Replace parameter to True.
You may also consider to display the ContactInfo in a webdialog. This way the user still sees the window in the background which helps them keep track of where they are in your app.