Detect scroll action [SOLVED]

On 12/04/2017 at 17:57, xxxxxxxx wrote:

Is there a way for detected scroll without doing a timer?

Basicly I have two scroll group and I want to synchronize one with the other one. Wich can be easily done with GetVisibleArea and SetVisibleArea.
The only part I miss is to know whene to do it.
I can register a timer and check value each X time but I fel dirty about it and would prefer have an ID to check. I tested in command if id == MyScrollGroupID:

but that didn't work.

Thanks in advance ! 🙂

On 13/04/2017 at 08:17, xxxxxxxx wrote:

Hi gr4ph0s, thanks for writing us.

With reference to your question, looking into the code and making some tests I've the feeling that on Python the only mean to achieve the functionality is to go for a mechanism involving timers since the message fired when a scrollgroup is scrolled is not handled in the Python API.
On C++ API instead the BFM_SCROLLGROUP_SCROLLED id being supported can be effectively used to make things working the way you're looking for.
Being not the expert on the Python API, and considering that Yannick, has already started its Easter vacation, I will get back to this topic next week in case some clever mechanisms can be put right in place to sync scrolling between scrollgroup widgets.

Best, Riccardo

On 13/04/2017 at 09:25, xxxxxxxx wrote:

Then I gonna do it throught timer and will change when someone more pythonic confirm this or not.
Anyway thanks for taking time to answerd me.

Take your time and happy vacation to yannick 🙂

On 16/04/2017 at 06:30, xxxxxxxx wrote:

Looks like is working pretty well. Then only problem is I don't understand how to identify which scroll is being scrolled.
I either don't understand it in C++ so maybe you could make a c++ exemple since the one in the sdk is not consistent.

elif msg.GetId() == c4d.BFM_SCROLLGROUP_SCROLLED:
    print msg.GetInt32(3)
    for index, value in msg:
        print "Index: %i, Value: %s" % (index, str(value))

In the sdk we got

GroupBegin(0, BFH_SCALEFIT | BFV_SCALEFIT, 1, 0, String(),0);
  GroupSpace(0, 0);
AttachUserArea(m_wndHeaderArea, m_pHeaderArea);
Int32 MyDialog::Message(const BaseContainer& msg, BaseContainer& result)
  switch (msg.GetId())
    if (m_bHasHeader)
      Int32 chgh = msg.GetInt32(0);
      Int32 chgv = msg.GetInt32(1);
      Int32 xoff = msg.GetInt32(2);
      Int32 yoff = msg.GetInt32(3);
      if (chgh)
  return SUPER::Message(msg, result);

But what is m_bHasHeader ?

Thanks in advance

Ok I found a workaround since I redisegned my UI now I only have two scroll group. So I don't really need to recognize which one have too link with which one.
Here is my code

        elif msg.GetId() == c4d.BFM_SCROLLGROUP_SCROLLED:
            new_value = -msg.GetInt32(3)
            first_scroll = self.GetVisibleArea(1001)
            second_scroll = self.GetVisibleArea(1002)
            initial_first_y2 = first_scroll["y2"] - first_scroll["y1"]
            initial_second_y2 = second_scroll ["y2"] - second_scroll ["y1"]
                                first_scroll["x1"], new_value,
                                first_scroll["x2"], initial_first_y2 + new_value
                                second_scroll["x1"], new_value,
                                second_scroll["x2"], initial_name_y2 + new_value

But I'm still curious to have a way for identify wich scroll is currently used.

On 21/04/2017 at 09:35, xxxxxxxx wrote:

Hi gr4ph0s,

I apologize for getting back lately on this, but I've investigated a little bit more the point risen up and I confirm that it's currently a limitation and there are no reliable means to identify the scrollgroup widget being scrolled.

Best, Riccardo