Page 1 of 1

Displaying a field scrollbar only when it's needed

Posted: Sun Mar 10, 2013 11:24 pm
by Mag
Hi guys,

I've a project where the content of a locktext field is programmatically populated and want to display the scrollbar only where there is more text than the one you can see. Is there a way to learn if a scrollbar is needed in a field? I can't find a way to do this... any advice? :oops:

Re: Displaying a field scrollbar only when it's needed

Posted: Sun Mar 10, 2013 11:39 pm
by sturgis
You can do something like:

Code: Select all

if the formattedheight of field "fieldname" > the height of field "fieldname" then
   set the vscrollbar of field "fieldname" to true
else
   set the vscrollbar of field "fieldname" to false
end if
Can do the same for hscrollbar and width of course if you have long unwrapping lines.

Re: Displaying a field scrollbar only when it's needed

Posted: Mon Mar 11, 2013 12:05 am
by Mag
Your code works great

Yesterday I spent a lot of time to accomplish this with no luck, so thank you so much sturgis!