How to trap a Group Scroll
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
How to trap a Group Scroll
Hi,
I'm sure this must have been covered someplace but... d'oh !
any pointer please as to how to 'trap' a user when he/she scrolls a group ?
So, I have an image that is larger than the group that contains it (This is why the image is in a group - so that I can scroll around it). I can scroll around the image using the group's integral 'thumbs'. What I'd like to do though is move a graphic 'on top of' the group or 'outwith' the group if the underlying image is scrolled by dragging the group's horizontal / vertical thumbs.
Alternatively / additionally is there a way to simply add run-time created graphic objects to a group - then, I guess, scrolling the group would also scroll the graphics that have been added at run-time ?
Hope that makes sense and someone can kick me in the right direction.
Many thanks.
Regards.
I'm sure this must have been covered someplace but... d'oh !
any pointer please as to how to 'trap' a user when he/she scrolls a group ?
So, I have an image that is larger than the group that contains it (This is why the image is in a group - so that I can scroll around it). I can scroll around the image using the group's integral 'thumbs'. What I'd like to do though is move a graphic 'on top of' the group or 'outwith' the group if the underlying image is scrolled by dragging the group's horizontal / vertical thumbs.
Alternatively / additionally is there a way to simply add run-time created graphic objects to a group - then, I guess, scrolling the group would also scroll the graphics that have been added at run-time ?
Hope that makes sense and someone can kick me in the right direction.
Many thanks.
Regards.
I'm 'getting there'... just far too slowly !
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1
Re: How to trap a Group Scroll
Yes. I answered in a post of ... Traxgeek in the commerciel developerI'm sure this must have been covered someplace but... d'oh !
https://alternatic.ch
Re: How to trap a Group Scroll
Oops ! Thanks JM
I deleted that post within a few minutes of putting it up (I thought it was the wrong section - can't really call myself a Commercial Developer - yet - although that is my aim at some point in the near future !!) and then re-posted it here... Sorry.
I'll go try see if it's still there ? Thanks.
Regards.
I deleted that post within a few minutes of putting it up (I thought it was the wrong section - can't really call myself a Commercial Developer - yet - although that is my aim at some point in the near future !!) and then re-posted it here... Sorry.
I'll go try see if it's still there ? Thanks.
Regards.
I'm 'getting there'... just far too slowly !
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1
Re: How to trap a Group Scroll
Well.... erm...
Thanks for the help... I'd forgotten BUT I've already tried this and gotten nowhere... how would ScrollBarDrag differentiate between the horrizontal and vertical scrollbars that are integral to a group (these are the scrollbars I can enable when setting up the group control) ? Am I missing something even more basic perhaps ?
I can see how ScrollBarDrag would work with a dedicated / individual scrollbar control but not with the integrated group scrollbars.
Maybe I can't trap the integral ones ?
Either way, is there a way to add a newly created (run-time) graphic to an existing group ? This might get me round my issue and (to be frank) be neater : As in :
put graphic "MyNewGraphic" into group "MyExistingGroup" ## Which doesn't work for me
Regards.
Thanks for the help... I'd forgotten BUT I've already tried this and gotten nowhere... how would ScrollBarDrag differentiate between the horrizontal and vertical scrollbars that are integral to a group (these are the scrollbars I can enable when setting up the group control) ? Am I missing something even more basic perhaps ?
I can see how ScrollBarDrag would work with a dedicated / individual scrollbar control but not with the integrated group scrollbars.
Maybe I can't trap the integral ones ?
Either way, is there a way to add a newly created (run-time) graphic to an existing group ? This might get me round my issue and (to be frank) be neater : As in :
put graphic "MyNewGraphic" into group "MyExistingGroup" ## Which doesn't work for me
Regards.
I'm 'getting there'... just far too slowly !
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1
Re: How to trap a Group Scroll
Hi Traxgeek,
well, Pro or not, you should be able to test by yourself if SCROLLBARDRAG is sent in GROUPS!
It IS of course!

Do:
..
copy grc XYZ to grp "the group"
...
OR
...
CREATE grc XYZ in grop "the group"
...
P.S.
Best
Klaus
well, Pro or not, you should be able to test by yourself if SCROLLBARDRAG is sent in GROUPS!

It IS of course!
And doesn't for the rest of usput graphic "MyNewGraphic" into group "MyExistingGroup" ## Which doesn't work for me

Do:
..
copy grc XYZ to grp "the group"
...
OR
...
CREATE grc XYZ in grop "the group"
...
P.S.
No, you didn'tI deleted that post within a few minutes of putting it up

Best
Klaus
Re: How to trap a Group Scroll
OK - Thanks Klaus.
As for deleting my first post - it's obvious I didn't - BUT I THOUGHT I had - I did go back in to edit the post and hit the 'X'... thpought that would work. Should have checked. Will go back now and try again !!
As to groups and scrollbars... I fully understand I'm none too clever
BUT let me please try again...
I DO understand how the ScrollBarDrag works for a dedicated ScrollBar control - even in those scrollbars I create WITHIN groups
As I've said before, what I (still) don't understand (even a teensie, weensie, insie, winsie bit) is how to trap the scrolls I make using the groups inherent / integral horizontal and/or vertical scrollbars. Try as I might I get nothing, NADA, from the trying to trap the ScrollBarDrag message for the integral scrollbars of (those created automatically by) a group.
Like I said, I can trap a scrollbar controls drag messages - no worries. Then, because I know the name of the scrollbar I can do whatever I need to do with it BUT... blah, blah, blah (apologies to 'rant on' a bit here) I cannot trap the horizontal or vertical drags of a the scrollbars of a group control...
EXAMPLE, the on ScrollBarDrag message returns a new value. So from that return how would I know if the new value pertains to the horizontal or the vertical scrollbar please ?
So... either I'm asking the same question (multiple times) - if so, I'm REALLy REALLY sorry OR I'm not phrasing my question properly / clearly enough! Either way could you provide me with a little extra help as I remain 'lost'.... ?
Thanks a million chaps.
Regards.
As for deleting my first post - it's obvious I didn't - BUT I THOUGHT I had - I did go back in to edit the post and hit the 'X'... thpought that would work. Should have checked. Will go back now and try again !!
As to groups and scrollbars... I fully understand I'm none too clever

I DO understand how the ScrollBarDrag works for a dedicated ScrollBar control - even in those scrollbars I create WITHIN groups

As I've said before, what I (still) don't understand (even a teensie, weensie, insie, winsie bit) is how to trap the scrolls I make using the groups inherent / integral horizontal and/or vertical scrollbars. Try as I might I get nothing, NADA, from the trying to trap the ScrollBarDrag message for the integral scrollbars of (those created automatically by) a group.
Like I said, I can trap a scrollbar controls drag messages - no worries. Then, because I know the name of the scrollbar I can do whatever I need to do with it BUT... blah, blah, blah (apologies to 'rant on' a bit here) I cannot trap the horizontal or vertical drags of a the scrollbars of a group control...
EXAMPLE, the on ScrollBarDrag message returns a new value. So from that return how would I know if the new value pertains to the horizontal or the vertical scrollbar please ?
So... either I'm asking the same question (multiple times) - if so, I'm REALLy REALLY sorry OR I'm not phrasing my question properly / clearly enough! Either way could you provide me with a little extra help as I remain 'lost'.... ?
Thanks a million chaps.
Regards.
I'm 'getting there'... just far too slowly !
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1
Re: How to trap a Group Scroll
Hi Traxgeek,
I will delete that post for you
OK, NOW I get it.
Well unfortunateyl there is not built-in means to differ a H or V scrollbardrag.
Quick idea:
Maybe you could use some local vars in the groups script and put the H and VScroll of your group into these local var on "mousedown".
Then you could later check for the difference to these values compared to the CURRENT V and H scroll and can see if the group has been V or H scrolled.
Know what I mean?
Best
Klaus
I will delete that post for you

OK, NOW I get it.
Well unfortunateyl there is not built-in means to differ a H or V scrollbardrag.
Quick idea:
Maybe you could use some local vars in the groups script and put the H and VScroll of your group into these local var on "mousedown".
Then you could later check for the difference to these values compared to the CURRENT V and H scroll and can see if the group has been V or H scrolled.
Know what I mean?
Best
Klaus
Re: How to trap a Group Scroll
Hi,
here is a script that does what Klaus suggests
put this into your group or whatever control that has both scrollbars active.
Kind regards
Bernd
here is a script that does what Klaus suggests
Code: Select all
local sVScroll, sHScroll
on mouseDown
put the vScroll of me into sVScroll
put the hScroll of me into sHScroll
end mouseDown
on scrollbarDrag theValue
if theValue <> sVScroll then
-- you got a vertical scroll
put "vertical scroll" && the milliseconds
end if
if theValue <> sHScroll then
-- you got a horizontal scroll
put "horizontal scroll" && the milliseconds
end if
end scrollbarDrag
Kind regards
Bernd
Re: How to trap a Group Scroll
Brilliant idea chaps.
Thanks to the three of you ! I continue to be impressed... and to learn !
Additional thanks to Klaus for deleting my original incorrectly located post... (although having looked again, I still can't see how to do that myself - maybe only mods can do that ? I'll make a note to go look at that again - for the future...)
Thanks a million.
Regards.
Thanks to the three of you ! I continue to be impressed... and to learn !
Additional thanks to Klaus for deleting my original incorrectly located post... (although having looked again, I still can't see how to do that myself - maybe only mods can do that ? I'll make a note to go look at that again - for the future...)
Thanks a million.
Regards.
I'm 'getting there'... just far too slowly !
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1