Pushing to Master/Detail

  1. 2 months ago

    Jeff T

    Aug 8 Midlands of England, Europe
    Edited 2 months ago

    Most of the split view examples seem to show pushing a view as the responsibility of 'the view that is already there'

    So Master has View A
    Detail has View B

    You want View C in detail, so you add a public method to View B , in which it creates a View C and does self.pushto(myViewC)

    To make that happen from App or a method, you have to know what kind of view is in Detail, so that you can get a pointer to the existing view, and call the relevant method.
    After the ViewC appears, if I want to show View D, I need to know it's a ViewC I need to kick.

    Ive tried to create App level methods that push a view into Master or Detail regardless of what is there already, but nothing I have tried seems to work.
    (No point posting what Ive tried.. most of it gets syntax error or invalid casting)

    Is there a way to say 'shove a View C into the detail pane regardless of what is there now'?

    And does it make sense to create one global instance of each view so that I can use singletons instead of creating new and hoping for destructors to happen?

    Seems its PushTo that is the issue.

    Assigning directly, works fine
    Using PushTo and sending the same view again, instant untrappable stop.

    myThingview = new thingview
    Self.ParentSplitView.master = myThingview

    works reliably for me, and should mean that I am freeing up the previous instance nicely

  2. Jason K

    Aug 8 Pre-Release Testers

    Look at the MainView of iOSKit under example views. It will show you how to do master/detail views, or just standard PushTo.

  3. Jeff T

    Aug 8 Midlands of England, Europe

    Sadly, iOSKit fails for me in the same way as one of my earlier attempts.

    It will load up one detail view successfully.
    Clicking on another choice in the master window, the simulator immediately shuts down the debug app without generating a trappable exception.
    Im using Xojo 2017 R3 , Simulator V10.0

  4. Art G

    Aug 9 Prescott AZ

    Have you tried App.CurrentScreen.Content?

    Public Sub GoToView(mview As iOSView)
      If iOSSplitView.Available Then
        Dim split As New iOSSplitView
          
        split.Master = mview
          
        Dim detail As New FormView
        split.Detail = detail
          
        App.CurrentScreen.Content = split
      Else
        App.CurrentScreen.Content = mview
      End If
      
    End Sub
  5. Jeff T

    Aug 9 Answer Midlands of England, Europe

    Seems its PushTo that is the issue.

    Assigning directly, works fine
    Using PushTo and sending the same view again, instant untrappable stop.

    myThingview = new thingview
    Self.ParentSplitView.master = myThingview

    works reliably for me, and should mean that I am freeing up the previous instance nicely

or Sign Up to reply!