Looking for more info on hScroll

Trevor DeVore lists at mangomultimedia.com
Sat Jul 31 15:18:04 EDT 2004


On Jul 31, 2004, at 9:37 AM, Wouter wrote:
>> Hello there list,
>>
>>  I need to determine the percentage of the scroll of a group based on 
>> the current hScroll. I am scaling graphics in a group (thus changing 
>> the formattedWidth) and need to set the hScroll to the value that 
>> will keep the same objects centered in the viewable area of the group 
>> after the scaling is done. I've done some tests but can't figure out 
>> how to make all of my numbers match up to get a correct percentage. 
>> Here is an example -
>>
>> * I have a group with a formattedWidth of 1033 pixels.
>>  * During testing the highest hScroll value when scrolling this group 
>> to the right is 630.
>>  * The width of the group is 397 pixels so the formattedWidth of the 
>> group - the actual width of the group is 636 pixels.
>>  * The borderWidth = 2, scrollbarWidth = 0 and margins = 0
>>
>> I don't know where the 6 pixel difference comes from. In tests with 
>> the groups formattedWidth set to other values the difference has 
>> ranged anywhere between 4 and 8 pixels.
>
> Are the margins of the group still set to another value than 0?
> They are by default set to 4 (and the showborder true also adds to the 
> width of a group).

I did some more tests and I think the design of my slider is what is 
causing the problem.  I  added a call which prints out the value of 
formattedWidth - width - margins - borderWidth and as my custom group 
slider got to the end of the group the value increased.  My custom 
slider which is part of the group itself was extending past the 
previous extreme right side of the group and adding a couple of more 
pixels to the group.  Though the formattedHeight increases the highest 
value of hScroll for the group doesn't seem to be updated.  I will keep 
fiddling around and see if I can pinpoint exactly what is going on 
though.

Thanks,

-- 
Trevor DeVore
Blue Mango Multimedia
trevor at mangomultimedia.com



More information about the use-livecode mailing list