How to hide scroll if field does not require it

Devin Asay devin_asay at
Wed May 26 12:40:53 EDT 2010

On May 26, 2010, at 10:37 AM, Sivakatirswami wrote:

> Anyone else wish that fields has a property by which you could turn off 
> the appears of the vertical scroll bar, if the field actually did not 
> have enough text to require it?
> In the absence of that feature, what is the best way to program this?
> I have a field that is dynamically filled with a listing from folders on 
> the server on the LAN. Sometimes there may only be 1-2 files i the list, 
> other times there are many. I would like the field not to have a 
> vertical scroll bar if there it only has 1-7 lines of text and then if 
> it fills with 8, suddenly the scroll bar appears.
> I can think of ways to do this, but How are others doing this?

This handler is in my standard library stack used by most of my projects:

command enableScrollbarIfNeeded pFldName
  if the formattedHeight of fld pFldName > the height of fld pFldName then
    set the vScrollbar of fld pFldName to true
    set the vScrollbar of fld pFldName to false
  end if
end enableScrollbarIfNeeded

It's worked well for me.


Devin Asay
Humanities Technology and Research Support Center
Brigham Young University

More information about the Use-livecode mailing list