Page 2 of 2

Re: Graphic in scrolling list field disappears

Posted: Wed Aug 26, 2015 3:38 pm
by mrcoollion
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.

Re: Graphic in scrolling list field disappears

Posted: Wed Aug 26, 2015 7:05 pm
by mrcoollion
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

Re: Graphic in scrolling list field disappears

Posted: Sat Aug 29, 2015 7:06 pm
by sturgis
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.

Re: Graphic in scrolling list field disappears

Posted: Sat Aug 29, 2015 7:51 pm
by mrcoollion
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.

Re: Graphic in scrolling list field disappears

Posted: Sun Aug 30, 2015 2:09 pm
by mrcoollion
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?

Re: Graphic in scrolling list field disappears

Posted: Tue Sep 01, 2015 12:36 pm
by mrcoollion
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)

Re: Graphic in scrolling list field disappears

Posted: Tue Sep 01, 2015 12:49 pm
by Klaus
Hi Pauk,

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


Best

Klaus

Re: Graphic in scrolling list field disappears

Posted: Tue Sep 01, 2015 5:26 pm
by mrcoollion
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 ...