If I have built a custom control based on an iOSContainerControl, how can I determine the iosView that it is sitting on from within that control?
- why would you reach way outside your boundaries (this is not a good design to do so)
- why not raise an event that the enclosing view can implement to return the view to your control
Events aren’t JUST for user interaction
If you have a control on a layout (regardless of iOS desktop etc) and it needs info from whatever its on an event works really well
Thanks Norman, that’s what I’m now using but was hoping for a single step approach (as in Desktop) rather than having to create an event/addHandler for each layer of embedding.
…except that, now I find that Open Events inside iosContainerControls that are inside iosScrollableAreas don’t fire.
Seems like this…<https://xojo.com/issue/44743>
Well, you can create a method to go from parent to parent, until you reach the view. Or even possibly the screen.
Thanks Michel - but that fails when get to an iosScrollable area - where the parent of the selected control is nil, rather than the scrollable area. Another bug submission I suppose.
Thank you jean-paul. I guess introspection would get similar results. It will still need to ripple down to the base control but I will try it to see if it gets past the problem with iOSScrollableArea.parent.
We do indeed need something like Self.TrueWindow for all subclassed iOScontrols and iOSContainerControl. I want for instance to use thePicturePicker from a dynamic ContainerControl, and I would really love to have that instead of the convolutions I have to do now.
I will now proceed to the next church to light a candle to Isidore of Seville, in hope he performs a miracle, and this feature gets implemented by Xojo.
45561 - iOS we need the equivalent of self.TrueWindow for subclassed controls and IOSContainerControl
I use iOSContainerControls to provide dialogs.
For instance, I have this dialog where the user can chose between the regular PicturePicker, and my own that fetches pictures present in the document folder.
The PicturePicker can only show when referenced to the iOSView, not the iOSContainerControl. Yet, I can only do self.
Please add something like self.TrueView so we don’t have to resort to convoluted methods to get that. It should be much easier, since you have access to the view hierarchy.
I seem to recall that we added a CurrentView property to the screen object. That should get what you want.
There is no CurrentScreen, but indeed, I had forgotten that there is not content. This will do nicely :
Thank you Greg.
Michel, I think the code you wrote will only return the first iOS view in the view controller.
So if you use self.pushTo(someView) several times, your code will always return the same view.
[quote=294189:@JrmieLeroy]Michel, I think the code you wrote will only return the first iOS view in the view controller.
So if you use self.pushTo(someView) several times, your code will always return the same view.[/quote]
No, it returns the view currently displayed, no matter how many are in the pile.