6 Is A Mystery Number

BNig niggemann at uni-wh.de
Sun Feb 19 17:44:53 EST 2012


Hi Scott,

as of version 4.6 and later this does seem to give the same of the max
scroll whether your force it by setting the scroll to a very large number or
use this script:

-------------------------------------------
on mouseUp
   put the formattedHeight of field 1 into tFormat
   put the height of field 1 into tHeight
   put the borderwidth of field 1  into tBorder
   
   put 0 into tBorderKorr
   
   if tBorder > 0 then
      put 5  into tBorderKorr
      if tBorder <> 2 then 
         add 1 to tBorderKorr
      end if
      if not the showBorder of field 1 then 
         if the hScrollbar of field 1 then
            add 2 to tBorderKorr
         else
            add 4 to tBorderKorr
         end if
      end if
   else  -- borderwidth = 0
      put 5  into tBorderKorr
   end if
   
   if the hScrollbar of field 1 then
      add 1 to tBorderKorr
   end if
   
   
   put tFormat - tHeight - tBorderKorr  into tSum
   
   set the scroll of field 1 to tSum
   
   --- end of calculation of the max scroll
   
   ------------------------------------
 
   set the scroll of field 1 to 100000 
   -- let it update, not necessary but who knows
   unlock screen
   wait 5 milliseconds with messages
   
   put the scroll of field 1 into tScroll
   
   put "calculated max scroll " & tSum & cr & "actual max scroll " & tScroll
& cr & "difference " & tSum - tScroll into field 2
   -- if the difference is <> 0 then you found a flaw in this
   
end mouseUp
-----------------------
I don't know the reason why this is the way it is.

This works for me for many different combinations of
borderwidths/visibility/scrollbars. I might have forgotten some combination
though.

If you scroll manually to the max there at times is a 1 pixel difference and
at other times not.
 
Prior to 4.6 you had to account for the height of the hScrollBar if it was
shown.
Prior to 4.5 on a Mac only you also had to take into account the
focusedBorder if set to true and active.

Kind regards

Bernd

--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/6-Is-A-Mystery-Number-tp4399193p4402679.html
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the use-livecode mailing list