Scripting 'fit to content'

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
glenn9
Posts: 234
Joined: Wed Jan 15, 2020 10:45 pm

Scripting 'fit to content'

Post by glenn9 »

Hi everyone,

is it possible to script in the property browser 'fit to content' (when I hover over it the tooltip just shows either width or height but no 'fit to content' command?)

Thanks for any help.

Regards,

Glenn
glenn9
Posts: 234
Joined: Wed Jan 15, 2020 10:45 pm

Re: Scripting 'fit to content'

Post by glenn9 »

apologies, my question didn't make sense, what i meant to ask is it possible to script the property browser option 'fit to content'!

Thanks,

Glenn
bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Scripting 'fit to content'

Post by bogs »

I don't think you can do it that simply, in one line, but you can add up the widths of your objects for instance, and put that in a variable, then the height and put that in a variable, then something like (psuedo)~
set the left of this stack to ( the left of your left most object - 5)
set the width of this stack to (varW + 10)
set the height of this stack to (varH + 10)

Something like that, anyway.
Image
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Scripting 'fit to content'

Post by Klaus »

Not sure, but I suspect this is not scripted but something the engine does "on the spot".
LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1235
Joined: Thu Apr 11, 2013 11:27 am

Re: Scripting 'fit to content'

Post by LCMark »

All the PI is doing is (I believe):

Code: Select all

set the width of <object> to the formattedWidth of <object>
OR
set the height of <object> to the formattedHeight of <object>
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Scripting 'fit to content'

Post by Klaus »

Klaus wrote: Fri Mar 27, 2020 1:04 pm Not sure, but I suspect this is not scripted but something the engine does "on the spot".
Ooops, sorry, I mixed that with the "exactfit" FULLSCREENMODE. :oops:

Yep, what Mark said!
Post Reply