[comp.sys.mac.hypercard] How to make a field's scroll bars look right

dave@lsuc.on.ca (David Sherman) (01/09/90)

Someone mentioned recently that Hypercard fields are annoying
because the scroll bar shows gray even when there's no scrolling
possible.  There's a neat workaround to fix this.

Create a button and call it "cover scroll bar".  Button type:
rectangle.  Size it so that it exactly covers the field's scroll bar.

Now, all you have to do is hide and show the button where
appropriate.  If your field lines never wrap (i.e., you're
controlling what goes in there and it's always short lines),
then
	if the number of lines of card field "x" > 24
	then
		hide button "cover scroll bar"
	else
		show button "cover scroll bar"
	end if
will work, where you replace 24 with the appropriate number,
or even calculate it on the fly with textheight.

If your field contains wrapped lines, this trick works:
	lock screen
	select last char of card field "x"
	if the scroll of card field "x" > 0
	then
		hide button "cover scroll bar"
		set the scroll of card field "x" to 0 -- back to the top
	else
		show button "cover scroll bar"
	end if
	unlock screen

You can then put this fragment into opencard, idle, or
any other handler which is appropriate for your application.
Presto, nice-looking fields.

Hope this helps someone out there.

David Sherman
Toronto
-- 
Moderator, mail.yiddish
{ uunet!attcan  att  utzoo }!lsuc!dave          dave@lsuc.on.ca