Is it normal that the Open and Close event of iOSControls included within an iOSContainerControl which is the Content of one ScrollableArea aren’t fired ? Others seems to work. If yes is there a workaround ? Tested with Examples/iOS/Controls/ScrollableArea. Added some controls like switch and slider. Nothing happen when the application is launched. ValueChanged event at least for the switch and the slider are well fired.
That’s a known issue.
Any chance to have <https://xojo.com/issue/44743> solved shortly ?
You can use the Open and Close of the iOSContainerControl itself.
As for the slider and switch, I would try a multiple timer with something like 20 period to monitor these controls values.
Open event of the iOSContainerControl isn’t fired also. I’ve a big project awaiting a solution for this issue.
Comme on dit par chez nous : Why make it simple when we can make it complicated
Strange. I quickly created a small test project with a ScrollableArea, and the iOSContainerControl into it.
Here, the iOSContainerControl event fires quite normally under 2016R2.1.
Likewise, Open and ValueChange do fire quite normally in Switch and Slider.
I have downloaded the project attached to 44743. Indeed when an iOSContainerControl is embedded dynamically, Open does not fire. The best solution I can think of is to place the code that was to go in Open right after the embedding code. Which in the case of Jeremie’s code is in the view,'s Open.
In the same project, Switch ValueChanged fires, but not Open.
I added a Slider. Open does not fire either, but ValueChange does.
So there are two simple solutions :
- Place the iOSContainerControl at design time
- Place the code you wanted to put in Open immediately after you embed. It may be a tad too early, in that case start a timer there and place the code in the Action event.
BTW I hate complexity, and try to avoid it like a plague. Keep it simple is my motto.
Here is a quick project where a multiple timer emulates the Open and ValueChanged event :
Thanks in advance
In my latest project, I had to replace the Open event of a ContainerControl by a single timer with period 10 placed on it. The Action event fires 10 ms after the control opens, and replaces the failed Open event.
In case that gets fixed, my code won’t break.
I had a look on the example you posted in August. I don’t see why we should use a workaround for something which is supposed to work like described in the documentation and that we paid for.
Pierre, please don’t take your frustrations on me. I am just a user like you. Next time I will not bother you with workarounds.
Michel, apologies if I hurt you. Was not in my intention, of course. Your contributions are much appreciated. I’d use I instead we.
I’ve a lot of controls within a container control. Most of these controls are subclass of other controls with init code in their open event. Moreover init part depend of some parameters. I tried to put together all init code … I’m not ready to deliver this kind of work
Has anyone come up with a workaround for the close event. The timer workaround for the open event works great by the way Michel.
You’ll need to use the close event of the container control itself.
Sorry for the delay in response. The container control has probably 50 or so data fields saving to several SQLite databases. I’m trying to use a single “Done” button to save the data. This was the original setup when I had the controls directly on the scrollable area of the View but I ran into a 950 or so pixel limitation. It would display properly in the simulator and the phone itself but not in the layout. After reaching the limitation, all the controls would just plop on top of each other. As I said it still worked but having to add more controls, I was flying blind hence putting them on the container control. I’ve since done a workaround so the end user doesn’t have to push numerous save buttons. Hoping to get this App released by the end of April and will post the link so you can see the end result.
It might be easier to dynamically create the TextFields just before displaying your view.
If you subclass iOSTextField and add a “Tag” property, you’ll be able to cycle through all Textfield controls in the view and know which control does what using the tag property.
This way, you won’t loose time setting up manually each control on the layout.