Page 1 of 1

applying scrollbars and losing card position

Posted: Fri Jun 19, 2015 9:20 pm
by jalz
Hi Guys,

I have the following code below which applies a scrollbar to my card. I call this script from buttons/anytime there is a change of position for an object (I have a lot of objects down the page that are hidden and appear when certain criteria is met). The problem with it is, when I've scrolled a little down, and this script is triggered, the position of contents within my scrollbar get shifted to the top. I know why this is happening, its when I set the top left of group scrollbar to 0,0. I thought I could be clever and get the position of the topleft before i moved it, but that just messes the position of the scrollbar.

Does anyone have any suggestions on how I can prevent the window from losing position, yet retain the scrollbars on my card appropriately?

Many thanks as always

Code: Select all

command applyScrollBars
   --put the topleft of group "grp_scrollbar" into tCurrentPosition
   put the rectangle of this card into tRect
   set the rectangle of group "grp_scrollbar" to tRect
   set the topleft of group "grp_scrollbar" to 0,0
   set the vScrollbar of group "grp_scrollbar" to (the formattedHeight of group "grp_scrollbar" > the height of group "grp_scrollbar")  
   set the hScrollbar of group "grp_scrollbar" to (the formattedWidth of group "grp_scrollbar" > the width of group "grp_scrollbar")
   --set the topleft of group "grp_scrollbar" to tCurrentPosition
end applyScrollBars

Re: applying scrollbars and losing card position

Posted: Sat Jun 20, 2015 12:49 am
by jalz
Figured it out using put the scroll of group "grp_scrollbar" into tScrollPosition and then setting the scroll back to this position after the scrollbars have been added.