Split View Paradigms

I’m going to describe this wrong… please bear with me.

I’m overly simplifying but I’d like to be a able to use the left side of a split view list tabs.
So that when you tap on one items, it pops you into a workflow on the right, but leaves the left side visible so you can select a different workflow.

So far so good. But… when I change the contents on the right side, it looses the context of where it was at. It seems to collapse the chain of screens that had been progressed to.

Before you ask why I don’t just use tabs, there are a load of reasons too deep to discuss here.

Thanks in advance

it looses the context of where it was at. It seems to collapse the chain of screens that had been progressed to.

When you push a new screen into the detail section, iOS maintains a history of what went there.
It should be showing a ‘back’ link at the top left corner of the page in the rght hand pane, so that people can work backwards.

How are you displaying something new in the right hand side when a new task is selected on the left?
What do you do if a new workflow is selected while another is only half completed?

You may need to hold a ‘state’ at the application level so that you can keep track

1 Like

Yes it shows a back link. All that works.
When working with tabs you can switch to a different tab, and then back to the original and that state, with whatever bread crumb trail of back buttons were could be, have all been preserved.

When I use the self.ParentSplitView.Detail = (my screen) it doesn’t have connection to that context so you lose it all.
I’d like to be able to retain it.

Hope that makes sense.

The hierarchy is only maintained with PushTo. If you want to be able to change with self.ParentSplitView.Detail = (my screen) then I would suggest you add a function to the screens that can participate to save their state and you can manually add a button to go back that restores the state. Ive done this before with JSON and having all views inherit from a common super class. When you want to swap, you collect the JSON save state of the current screen and store it, then load the new view.

i’n not sure how to save their state. I don’t know what object is storing the sequence of screens. It’s not the screen itself (I don’t think) or it would be retired when I set the details = xyz.


self.ParentSplitView.Detail = (my screen)

You have a place where you call self.ParentSplitView.Detail = (my screen). One way to do this is to add a function EncodeState() as JSONItem on your Views, and variable to the App StateStack() as JSON then you can do this instead:

dim currentState as JSONItem = self.ParentSplitView.Detail.EncodeState()
self.ParentSplitView.Detail = (my screen)

Then if you add a back button to the view, you can handle it and restore the previous view like this:

dim newState as JSONItem = App.StateStack.Pop()
dim newView as MySpecialView
self.ParentSplitView.Detail = newView

Obviously this is all untested but it should give you an idea of one way to approach the problem.

1 Like

I’ll try tonight.

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.