# MobilesScreen.Show cannot determine parent view

**URL:** <https://forum.xojo.com/t/mobilesscreen-show-cannot-determine-parent-view/62180>\
**Category:** iOS\
**Created:** [March 22, 2021, 10:03am UTC](https://forum.xojo.com/t/mobilesscreen-show-cannot-determine-parent-view/62180 "2021-03-22T10:03:21Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christoph\_Emrich](https://forum.xojo.com/user_avatar/forum.xojo.com/christoph_emrich/32/1727_2.png) [@Christoph\_Emrich](https://forum.xojo.com/u/Christoph_Emrich)\
**Post date:** [March 22, 2021, 10:03am UTC](https://forum.xojo.com/t/mobilesscreen-show-cannot-determine-parent-view/62180/1 "2021-03-22T10:03:22Z")

</div>

In my iOS project I have a TabBar which shows a mobile screen `Screen1`. On that screen, I have a button which is supposed to show another mobile screen `Screen2` with this code:  
`var ms as new Screen2`  
`ms.show`

Tapping the button gives me a NilObjectException:

> Unable to determine parent view. Try passing it in instead.

See the attached sample project. What is wrong with the code and how can I show another screen with a TabBar?

[https://www.amazon.de/clouddrive/share/qYLl4f6c2vm3IWvi2NKTZVZ536gS2pxKj0ULrpge0Sr](https://www.amazon.de/clouddrive/share/qYLl4f6c2vm3IWvi2NKTZVZ536gS2pxKj0ULrpge0Sr)

Thank you  
Christoph

---

<div class="post-metadata">

**Author:** ![Greg\_O\_Lone](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o_lone/32/49_2.png) [@Greg\_O\_Lone](https://forum.xojo.com/u/Greg_O_Lone)\
**Post date:** [March 22, 2021, 11:37am UTC](https://forum.xojo.com/t/mobilesscreen-show-cannot-determine-parent-view/62180/2 "2021-03-22T11:37:15Z")

</div>

Show is for Modal views. Try PushTo.

---

<div class="post-metadata">

**Author:** ![Christoph\_Emrich](https://forum.xojo.com/user_avatar/forum.xojo.com/christoph_emrich/32/1727_2.png) [@Christoph\_Emrich](https://forum.xojo.com/u/Christoph_Emrich)\
**Post date:** [March 22, 2021, 12:07pm UTC](https://forum.xojo.com/t/mobilesscreen-show-cannot-determine-parent-view/62180/3 "2021-03-22T12:07:03Z")

</div>

`PushTo` is API 1.0, no? It’s still available but it requires an `iOSView` and I don’t have that anymore in my app. I only have `MobileScreens` now.

Also, there is `Show` and `ShowModal` where the latter would be for showing modal screens. `Show` works in all other cases for me except when there is a TabBar involved.

---

<div class="post-metadata">

**Author:** ![Greg\_O\_Lone](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o_lone/32/49_2.png) [@Greg\_O\_Lone](https://forum.xojo.com/u/Greg_O_Lone)\
**Post date:** [March 22, 2021, 12:22pm UTC](https://forum.xojo.com/t/mobilesscreen-show-cannot-determine-parent-view/62180/4 "2021-03-22T12:22:33Z")

</div>

Heh, you are correct. It’s a little early here.

---

<div class="post-metadata">

**Author:** ![Greg\_O\_Lone](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o_lone/32/49_2.png) [@Greg\_O\_Lone](https://forum.xojo.com/u/Greg_O_Lone)\
**Post date:** [March 22, 2021, 12:26pm UTC](https://forum.xojo.com/t/mobilesscreen-show-cannot-determine-parent-view/62180/5 "2021-03-22T12:26:21Z")

</div>

Does this work?

```
ms.Show(self)
```

---

<div class="post-metadata">

**Author:** ![Christoph\_Emrich](https://forum.xojo.com/user_avatar/forum.xojo.com/christoph_emrich/32/1727_2.png) [@Christoph\_Emrich](https://forum.xojo.com/u/Christoph_Emrich)\
**Post date:** [March 22, 2021, 12:30pm UTC](https://forum.xojo.com/t/mobilesscreen-show-cannot-determine-parent-view/62180/6 "2021-03-22T12:30:19Z")

</div>

Unfortunately not. I tried it this morning and debugged it step-by-step but the debugger would skip the “Opening” and “Activated” events and go right to the “Closing” event of the MobileScreen. Without stopping in the debugger, nothing happens on the screen, so you won’t even see the screen open and close.

I also tried other screens as parent screens but none seem to work.

---

<div class="post-metadata">

**Author:** ![Christoph\_Emrich](https://forum.xojo.com/user_avatar/forum.xojo.com/christoph_emrich/32/1727_2.png) [@Christoph\_Emrich](https://forum.xojo.com/u/Christoph_Emrich)\
**Post date:** [March 22, 2021, 12:40pm UTC](https://forum.xojo.com/t/mobilesscreen-show-cannot-determine-parent-view/62180/7 "2021-03-22T12:40:51Z")

</div>

I have just filed a bug report: \<[https://xojo.com/issue/64114](https://xojo.com/issue/64114)\>

---

<div class="post-metadata">

**Author:** ![DerkJ](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/e495f1/32.png) [@DerkJ](https://forum.xojo.com/u/DerkJ)\
**Post date:** [March 22, 2021, 1:25pm UTC](https://forum.xojo.com/t/mobilesscreen-show-cannot-determine-parent-view/62180/8 "2021-03-22T13:25:21Z")

</div>

Tested the example project, this does work for me (in the simulator).

I do see you are using a TabBar. perhaps you may wanna try ms.ShowModal instead and passing in the parent screen ?

[https://documentation.xojo.com/api/user\_interface/mobile/mobilescreen.html#mobilescreen-showModal](https://documentation.xojo.com/api/user_interface/mobile/mobilescreen.html#mobilescreen-showModal)

---

<div class="post-metadata">

**Author:** ![Christoph\_Emrich](https://forum.xojo.com/user_avatar/forum.xojo.com/christoph_emrich/32/1727_2.png) [@Christoph\_Emrich](https://forum.xojo.com/u/Christoph_Emrich)\
**Post date:** [March 22, 2021, 1:47pm UTC](https://forum.xojo.com/t/mobilesscreen-show-cannot-determine-parent-view/62180/9 "2021-03-22T13:47:29Z")

</div>

CORRECTION: ms.show(self) works. I tried to simplify the sample project. In my project there is an iOSMobileTable that’s causing the issue. Trying to show the MobileScreen from the SelectionChanged event does not work.
