PushTo a view from a Canvas in ContainerControl

  1. 3 weeks ago

    I have a view with a couple of canvases acting as buttons. They're a bit higher in size since I have some text I want to display in each. I recently added another canvas, and because of space limitations on smaller iPhone screens, I thought to use a ContainerControl and ScrollableArea. It appears the PushTo event does not work in a ContainerControl. Does anyone have a workaround to this?

    Two solutions:

    1. Add an Event Definition to the ContainerControl.
    Call that event in your Canvas and pass the view to be pushed to
    In the iOSview that holds the ContainerControl handle the event

    2. Add the following properties to the container control:

    Public Property parentView as iOSView
    Get
      
      if mParentView <> Nil then
        Return iOSView(mParentView.Value)
      end if
      
      
    End Get
    
    Set
      
      mParentView = xojo.core.WeakRef.Create(value)
      
    End Set
    
    End Property
    Private Property mParentView as xojo.Core.WeakRef

    In the iOSView.Open event:

    ContainerControl1.parentView = self

    You can then call parentView.PushTo(SomeOtherView) in you Canvas buttons

  2. Jeremie L

    Aug 1 Pre-Release Testers, Xojo Pro, XDC Speakers Answer Europe (France) - getpackr.io

    Two solutions:

    1. Add an Event Definition to the ContainerControl.
    Call that event in your Canvas and pass the view to be pushed to
    In the iOSview that holds the ContainerControl handle the event

    2. Add the following properties to the container control:

    Public Property parentView as iOSView
    Get
      
      if mParentView <> Nil then
        Return iOSView(mParentView.Value)
      end if
      
      
    End Get
    
    Set
      
      mParentView = xojo.core.WeakRef.Create(value)
      
    End Set
    
    End Property
    Private Property mParentView as xojo.Core.WeakRef

    In the iOSView.Open event:

    ContainerControl1.parentView = self

    You can then call parentView.PushTo(SomeOtherView) in you Canvas buttons

  3. 2 weeks ago

    Thanks Jeremie! I will give this a try and let you know if I have any issues

or Sign Up to reply!