Hi
I’m new to Xojo, beginning (tinkering) stage of creating an app.
I want to set the width of iOSButtons according to the width of their Captions.
I can’t see from the iOS Autolayout documentation that there is an easy way of doing this, but maybe I’m missing something?
Specifically what I want to do is to use a Text array to draw a sequence of Buttons left-to-right and justified across a View or Container… ie. with proportional spacing between them but (reasonably) consistent leading and trailing edges (based on the Caption length) within each Button.
If I wasn’t working within iOS, I think I could use Caption character count to do this. In other words, I would create a String array, derive a PushButton width from each String (a set number of points for maximum-width characters eg. ‘W’ or ‘M’ as a specified constant x the character count + leading edge constant + trailing edge constant), then plug the obtained values into Autolayout rules (again via an array or reference table) and draw the PushButtons in their left-to-right sequence.
However as I understand it iOSButton.Caption only takes a Text value… and method len( ) won’t take Text as data type, will only take a String.
So is there a way to obtain an iOSButton Caption’s character count? Or some other work-around with len ( ) or another function?
Or (even better) is there some way to achieve the above ‘sizing-according-to-caption’ using the existing iOS AutoLayout rules?
The rules enable an iOSButton to be specified in relation to the properties of other iOS objects… as far as I can understand, pretty much any drawing property except the caption of the iOSButton itself… ?
thanks Andrew