Hi
Is it possible to change the textsize for labels or buttons and have them to self adjust to the new size automatically ?
I am afraid not, since I didnt find any autosize options in the inspector menus but maybe there are other ways
thanks
Hi
Is it possible to change the textsize for labels or buttons and have them to self adjust to the new size automatically ?
I am afraid not, since I didnt find any autosize options in the inspector menus but maybe there are other ways
thanks
Hello Horacio,
Christian has a control called Elastic Window at Elastic Window Web Page which seems to work well. There is a fee, and you can make your own - it will just take some time.
I believe Elastic Window is for Desktop Applications and Elastic Webpage is for Web Applications.
ElasticWindow is 150$ but thanks for the tip !!
A blog from Geoff in January describes their progress on IOS Auto Layout.
http://www.xojo.com/blog/en/2014/01/ios-progress-report.php
Jim
[quote=113350:@Horacio Vilches]Hi
Is it possible to change the textsize for labels or buttons and have them to self adjust to the new size automatically ?
I am afraid not, since I didnt find any autosize options in the inspector menus but maybe there are other ways[/quote]
I see you are coming from VB where this option exists
You can probably get the same result with this in a TextField TextChange event :
Sub TextChange()
Dim d As Double
Dim p As New Picture(self.width, 22, 32)
p.Graphics.TextSize = me.TextSize
p.Graphics.TextFont = me.TextFont
me.width = (p.Graphics.StringWidth(me.text))+20
End Sub
I have added 20 pixels to compensate for rounding errors in StringWidth.
For a button or label there is no TextChange event, so you have to use a similar code where you set the control text. Instead of “Me” just replace by the name of the control.
Horacio, if you think you received a solution to your query, please click the “answer” icon on the upper right of the post ?. This will let other readers know you have received help.
I tried it and it works perfectly thanks
but i don’t understand it cos Im not familiar with objects graphics and picture
can you explain please
thanks
[quote=113397:@Horacio Vilches]I tried it and it works perfectly thanks
but i don’t understand it cos Im not familiar with objects graphics and picture
can you explain please[/quote]
Don’t forget to mark answered when you estimate having received the answer to your question.
I use the StringWidth method of the Graphics class http://documentation.xojo.com/index.php/Graphics which gives the width in pixels of a string for a particular font (TextFont) and font size (TextSize). In order to access a Graphics object, I create first a picture p and use its Graphics object. Then when I have the width of the string (Me.Text), I add 20 pixels and make it the width of the control.
Basically I do not use the picture itself for anything else than giving me access to the string size.