Problem scrolling a group of objects that may be moved

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Simon Knight
Posts: 845
Joined: Wed Nov 04, 2009 11:41 am
Location: Gunthorpe, North Lincs, UK

Problem scrolling a group of objects that may be moved

Post by Simon Knight » Thu Jun 14, 2018 9:27 am

The lesson : http://lessons.livecode.com/m/4071/l/11 ... the-window describes how a group may be made to scroll to display contents that are located outside the location of the group. I have used the principles described in the lesson to create a stack to display a number of thumbnail images.

My stack will process a folder of images and display a thumbnail of each image inside a group on the card. The group of images is resized when the card is resized and images may be dragged and dropped within the group. When the card is enlarged to fill the height of the screen it is possible to drag an image to the bottom of the group and even partly off the group. If the card is reduced in size I expected that the vertical scroll bar would appear as soon as an image is partially obscured but it does not appear at that point. It does get shown at some point as the size of the group is reduce which is not related to the locations of the images.

It is difficult to confirm what triggers the display of the scroll bar but it could be the size of the group when the stack was last saved and loaded ( a save in the IDE does not modify the reveal point).

Is the above expected or is it a bug?

I have attached my stack if you care to have a look. To use first put five jpegs in a folder then run the stack and press the button "action". The images will be displayed all over the card and not just within the group. Next resize the card making it larger and drag the images so that all are in view. Drag at least one down to the bottom of the card and then reduce the size of the card. On my computer the scroll bar does not appear as the image is hidden.
Attachments
CustomControlBasedImageSorterv01.livecode.zip
(5.84 KiB) Downloaded 156 times
best wishes
Skids

Simon Knight
Posts: 845
Joined: Wed Nov 04, 2009 11:41 am
Location: Gunthorpe, North Lincs, UK

Re: Problem scrolling a group of objects that may be moved

Post by Simon Knight » Thu Jun 14, 2018 9:33 am

On further review it seems that the scroll bar appears at the lowest bottom point of the images when they were added and this value is not being updated when an image is dragged and dropped.
best wishes
Skids

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9249
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Problem scrolling a group of objects that may be moved

Post by richmond62 » Thu Jun 14, 2018 12:20 pm

At the risk of being accused over oversimplifying things . . .

It is fairly straightforward to trigger visibility of scrollbars:

Code: Select all

on mouseUp
   set the hScrollbar of group "APES" to true
end mouseUp
-
line.png
-
LINE.livecode.zip
Here's the stack.
(74.74 KiB) Downloaded 165 times

Klaus
Posts: 13793
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Problem scrolling a group of objects that may be moved

Post by Klaus » Thu Jun 14, 2018 12:43 pm

Hi Simon,

looks like there is something wrong with group scrollbars in general! :-/
I modified your RESIZESTACK handler, but when resizing the window the scrollbars appear correctly but the SCROLL does not change correctly.

Code: Select all

on resizeStack pNewWidth, pNewHeight, pOldWidth, pOldHeight
   
   ## Use the RECT to reduce typing :-)
   put the rect of this cd into tRect
   subtract 50 from item 4 of tRect
   set the rect of grp "PhotoViewer" to tRect
      
   set the right of button "Action" of me to (the right of me -20)
   set the bottom of button "Action" of me to (the bottom of me -20)
   
   ## Trick to show scrollbars only when neccessary!
   set the vScrollbar of grp "PhotoViewer" to (the height of grp "PhotoViewer" <= the formattedheight of grp "PhotoViewer" )
   set the hScrollbar of grp "PhotoViewer" to (the width of grp "PhotoViewer" <= the formattedwidth of grp "PhotoViewer" )
end resizeStack
Looks like the "threshold for scrolling" (?) is somewhere in the MIDDLE of the groups inside of the "PhotoViewer" "mother"group!? Know what I mean?


Best

Klaus

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9249
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Problem scrolling a group of objects that may be moved

Post by richmond62 » Thu Jun 14, 2018 12:58 pm

I would "update" my scrollbars by turning them off and then on again.

Simon Knight
Posts: 845
Joined: Wed Nov 04, 2009 11:41 am
Location: Gunthorpe, North Lincs, UK

Re: Problem scrolling a group of objects that may be moved

Post by Simon Knight » Fri Jun 15, 2018 6:51 am

Hi,

Thanks for your replies and the graphic. Its a bug - see https://quality.livecode.com/show_bug.cgi?id=21359
and also 13806 and 13807. Simply - moving an object within a group does not update the trigger point for displaying the scroll bars (scoll bars auto hide on a mac and perhaps other platforms). The work around is to use the line

Code: Select all

set the clipsToRect of group "Photoviewer" to true
to update the groups knowledge of where its children are. It seems its been a bug since version 6 so is probably a feature and should be documented.
best wishes
Skids

Post Reply

Return to “Talking LiveCode”