How to Change the potion of controls near by scrollbar

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
shalu
Posts: 72
Joined: Fri Mar 20, 2015 1:05 pm

How to Change the potion of controls near by scrollbar

Post by shalu » Fri Nov 13, 2015 11:34 am

Hi All,

I have Several scrollbars and two buttons(Re-size and original) ) in my stack. When I press re-size button the size of the scrollbar is increased and when I press the original button the size of the scrollbar is back to the original position, my problem is when I press Re-size button not only changes the position of the scrollbar but also changes the potion of controls near by scrollbar(both position of the scrollbar and the potion of controls near by scrollbar should change). How can I solve this problem. Please see the below attached zip

Thanks
Shalu
Attachments
RESIZE.zip
(1.53 KiB) Downloaded 216 times
--
Thanks
Shalu S

Entdecker
Posts: 11
Joined: Tue Oct 27, 2015 4:35 pm

Re: How to Change the potion of controls near by scrollbar

Post by Entdecker » Fri Nov 13, 2015 12:39 pm

Hello Shalu
I tried the following with only one scrollbar on your example:

Code: Select all

on mouseUp
   -- set start and end values
   put "SA3" into tScrollbarName
   put 65535 into tEnd -- MaxValue of Scrollbars
   -- get the old information
   put the width of control tScrollbarName into tWidthOld
   put the thumbPosition of control tScrollbarName into tPositionOld
   put the thumbsize of control tScrollbarName into tSizeOld
   put tPositionOld / tEnd into tProcentOld
   put tSizeOld / tWidthOld into tThumbPercent
   -- new Width
   put 500 into tWidthNew
   -- resize
   set the width of control tScrollbarName to tWidthNew
   set the thumbsize of control tScrollbarName to (tThumbPercent * tWidthNew)
   -- new position of thumb
   put the thumbPosition of control tScrollbarName into tPositionNew
   put tPositionNew / tEnd into tProcentNew
end mouseUp
I got a longer scrollbar, the positon of the thumb are still the same, as you can see on the variables tProcentOld and tProcentNew.
The size if the thumb is also growing.
Is you problem solved but this?

Best regards Jens

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to Change the potion of controls near by scrollbar

Post by Klaus » Fri Nov 13, 2015 3:14 pm

Hi shalu,
shalu wrote:... my problem is when I press Re-size button not only changes the position of the scrollbar but also changes the potion of controls near by scrollbar
the positions of all the fields do NOT change! You did not script this 8)
Sorry, really not sure what your problem is?

Hint:
Setting the thumbsize to any ridiculous (= invalid!) value (2030?) has no effect really, as you can see!
Please look up "thumbsize" in the dictionary!

Hint 2: Here a slimmed down "RESIZE" script:

Code: Select all

on mouseUp
   LOCK SCREEN
   repeat with i = 1 to the num of sbs
      set the height of Scrollbar i to 16 
      set the width of Scrollbar i to 500
      set the thumbsize of scrollbar i to 2030
   end repeat
   UNLOCK SCREEN
end mouseUp
sb = short for scrollbar
sbs = short for scrollbars

Best

Klaus

Post Reply