Graphic in scrolling list field disappears

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

mrcoollion
Posts: 720
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

Re: Graphic in scrolling list field disappears

Post by mrcoollion » Wed Aug 26, 2015 3:38 pm

Klaus wrote:Hi Paul

what exactly did you try?
This is a nifty trick and surely works, if applied correctly :D


Best

Klaus
Will place the stack tonight.. Help is appreciated.

mrcoollion
Posts: 720
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

Re: Graphic in scrolling list field disappears

Post by mrcoollion » Wed Aug 26, 2015 7:05 pm

Klaus wrote:Hi Paul

what exactly did you try?
This is a nifty trick and surely works, if applied correctly :D


Best

Klaus
Hi Klaus I tried to follow the lesson How to scrol a card that is taller or wider than the window.
http://lessons.runrev.com/m/4071/l/1178 ... the-window

See the attached Stack..

Regards,

Paul
Attachments
TestImageInList2 - group.zip
(10.58 KiB) Downloaded 189 times

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Graphic in scrolling list field disappears

Post by sturgis » Sat Aug 29, 2015 7:06 pm

The reason the img dissapears is because the character that it is linked to leaves the viewport, so the engine stops rendering it.

The same happens with groups, for the same reason.

If you want to get around this problem, you can us a cheater method.

Use a separate scroll bar, mask off your viewing area with other controls. (already done in the case of your stack)

set the height of your field to the formattedheight of your field so that all contents are rendered and visible.

set the endvalue of scrollbar "myscrollbar" to the height of field "showchat" - (however tall the viewport is)

then, since you have the field positioned at the top of the card, its easy, just set the top of the field to -(the thumbposition of scrollbar "myscrollbar")

You want a negative value because you're actually moving the top of the field off screen.

I just did a very quick proof of concept. There are still issues to be worked around. I have 1 button set (the one that inserts the graphic) so that it will resize the field. Haven't done that with the other.

You'll want to always size the field when changing the contents.

If the formattedheight of the field is less than or = to the height of your viewport you'll want to leave the field sized at viewport height and disable the scrollbar (otherwise weird things happen)

You'll want to make sure you update the scrollbarend every time the contents change also.

Here is a link to your stack, adjusted, but with the other minor issues ignored. If you need help getting it to function better let me know.
https://dl.dropboxusercontent.com/u/119 ... 1.livecode

The code isn't clean, but it works. It'll still show the "quirks" I mentioned above, and if you don't fill the field enough and move the scrollbar, you can lose the thumb. As long as you keep it updated based on field updates, and only show it when theres enough text in the field, it works dandy.

The next concern i'd worry about (if it were me) would be limiting the length of the field. You'll probably want a way to drop the oldest messages off the end with a "load more messages.." option of some type.

mrcoollion
Posts: 720
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

Re: Graphic in scrolling list field disappears

Post by mrcoollion » Sat Aug 29, 2015 7:51 pm

sturgis wrote:The reason the img dissapears is because the character that it is linked to leaves the viewport, so the engine stops rendering it.

The same happens with groups, for the same reason.

If you want to get around this problem, you can us a cheater method.

Use a separate scroll bar, mask off your viewing area with other controls. (already done in the case of your stack)

set the height of your field to the formattedheight of your field so that all contents are rendered and visible.

set the endvalue of scrollbar "myscrollbar" to the height of field "showchat" - (however tall the viewport is)

then, since you have the field positioned at the top of the card, its easy, just set the top of the field to -(the thumbposition of scrollbar "myscrollbar")

You want a negative value because you're actually moving the top of the field off screen.

I just did a very quick proof of concept. There are still issues to be worked around. I have 1 button set (the one that inserts the graphic) so that it will resize the field. Haven't done that with the other.

You'll want to always size the field when changing the contents.

If the formattedheight of the field is less than or = to the height of your viewport you'll want to leave the field sized at viewport height and disable the scrollbar (otherwise weird things happen)

You'll want to make sure you update the scrollbarend every time the contents change also.

Here is a link to your stack, adjusted, but with the other minor issues ignored. If you need help getting it to function better let me know.
https://dl.dropboxusercontent.com/u/119 ... 1.livecode

The code isn't clean, but it works. It'll still show the "quirks" I mentioned above, and if you don't fill the field enough and move the scrollbar, you can lose the thumb. As long as you keep it updated based on field updates, and only show it when theres enough text in the field, it works dandy.

The next concern i'd worry about (if it were me) would be limiting the length of the field. You'll probably want a way to drop the oldest messages off the end with a "load more messages.." option of some type.
Thank you Sturgis. I will experiment with this.

mrcoollion
Posts: 720
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

Re: Graphic in scrolling list field disappears

Post by mrcoollion » Sun Aug 30, 2015 2:09 pm

mrcoollion wrote:
sturgis wrote:The reason the img dissapears is because the character that it is linked to leaves the viewport, so the engine stops rendering it.

The same happens with groups, for the same reason.

If you want to get around this problem, you can us a cheater method.

Use a separate scroll bar, mask off your viewing area with other controls. (already done in the case of your stack)

set the height of your field to the formattedheight of your field so that all contents are rendered and visible.

set the endvalue of scrollbar "myscrollbar" to the height of field "showchat" - (however tall the viewport is)

then, since you have the field positioned at the top of the card, its easy, just set the top of the field to -(the thumbposition of scrollbar "myscrollbar")

You want a negative value because you're actually moving the top of the field off screen.

I just did a very quick proof of concept. There are still issues to be worked around. I have 1 button set (the one that inserts the graphic) so that it will resize the field. Haven't done that with the other.

You'll want to always size the field when changing the contents.

If the formattedheight of the field is less than or = to the height of your viewport you'll want to leave the field sized at viewport height and disable the scrollbar (otherwise weird things happen)

You'll want to make sure you update the scrollbarend every time the contents change also.

Here is a link to your stack, adjusted, but with the other minor issues ignored. If you need help getting it to function better let me know.
https://dl.dropboxusercontent.com/u/119 ... 1.livecode

The code isn't clean, but it works. It'll still show the "quirks" I mentioned above, and if you don't fill the field enough and move the scrollbar, you can lose the thumb. As long as you keep it updated based on field updates, and only show it when theres enough text in the field, it works dandy.

The next concern i'd worry about (if it were me) would be limiting the length of the field. You'll probably want a way to drop the oldest messages off the end with a "load more messages.." option of some type.
Thank you Sturgis. I will experiment with this.
For redrawing the correct image while scrolling I need to know the first visible line number in the scrolling List field. I have been searching for an answer but no luck yet. Any suggestions?

mrcoollion
Posts: 720
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

Re: Graphic in scrolling list field disappears

Post by mrcoollion » Tue Sep 01, 2015 12:36 pm

I could not find a reliable way to find out the top and bottom line number in view while scrolling for redrawing the images to save memory. I now create a new image for each chat and that works fine with scrolling.

It would have been nice if it were possible to have a field property in which I can set , if a character with an imageSource is out of view it takes in account the images size and starts showing the image parts that are in view. This would also be nice if the imagesource is a picture/photo. Maybe a possible feature request?

I want to thank Klaus and Sturgis and for their support and time spend as well as all other who took the time to think about this.

Kind regards,

Paul (MrCoolLion)

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

Re: Graphic in scrolling list field disappears

Post by Klaus » Tue Sep 01, 2015 12:49 pm

Hi Pauk,

please do not quote the complete thread in your next postings, thanks! :D


Best

Klaus

mrcoollion
Posts: 720
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

Re: Graphic in scrolling list field disappears

Post by mrcoollion » Tue Sep 01, 2015 5:26 pm

Klaus wrote:Hi Pauk,

please do not quote the complete thread in your next postings, thanks! :D


Best

Klaus
Ok .. sorry did not mean to ...

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”