Page 1 of 1

How to trap a Group Scroll

Posted: Tue Jun 04, 2013 9:05 am
by Traxgeek
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.

Re: How to trap a Group Scroll

Posted: Tue Jun 04, 2013 9:35 am
by jmburnod
I'm sure this must have been covered someplace but... d'oh !
Yes. I answered in a post of ... Traxgeek in the commerciel developer

Re: How to trap a Group Scroll

Posted: Tue Jun 04, 2013 10:32 am
by Traxgeek
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.

Re: How to trap a Group Scroll

Posted: Tue Jun 04, 2013 10:45 am
by Traxgeek
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.

Re: How to trap a Group Scroll

Posted: Tue Jun 04, 2013 11:05 am
by Klaus
Hi Traxgeek,

well, Pro or not, you should be able to test by yourself if SCROLLBARDRAG is sent in GROUPS! 8-)
It IS of course!
put graphic "MyNewGraphic" into group "MyExistingGroup" ## Which doesn't work for me
And doesn't for the rest of us :-)

Do:
..
copy grc XYZ to grp "the group"
...
OR
...
CREATE grc XYZ in grop "the group"
...

P.S.
I deleted that post within a few minutes of putting it up
No, you didn't :-D


Best

Klaus

Re: How to trap a Group Scroll

Posted: Tue Jun 04, 2013 11:57 am
by Traxgeek
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.

Re: How to trap a Group Scroll

Posted: Tue Jun 04, 2013 12:23 pm
by Klaus
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

Re: How to trap a Group Scroll

Posted: Tue Jun 04, 2013 12:29 pm
by bn
Hi,

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
put this into your group or whatever control that has both scrollbars active.

Kind regards
Bernd

Re: How to trap a Group Scroll

Posted: Wed Jun 05, 2013 6:38 am
by Traxgeek
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.