Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Detect that a Scrollgroup scroll bar has changed

    Scheduled Pinned Locked Moved PYTHON Development
    11 Posts 0 Posters 913 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      On 30/05/2013 at 07:39, xxxxxxxx wrote:

      I have an UserArea inside a ScrollGroup that has a vertical scroll bar. However, when I drag the scroll bar up and down or if I click the arrows of the scroll bar, the UserArea that appears is not refreshed.
      How can I detect that the scroll bar of a ScrollGroup has changed in order to evoke a LayoutChanged for the UserArea?

      Rui Batista

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 30/05/2013 at 07:58, xxxxxxxx wrote:

        gedialog.message() and BFM_SCROLLGROUP_SCROLLED. there is an example in the cpp docs.

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 30/05/2013 at 08:32, xxxxxxxx wrote:

          The problem with this is that if I try to use the example from the SDK, I get a crash at startup 😞
          The example is this one:

          def Message(self, msg, result) :
              return GeDialog.Message(self, msg, result)

          Of course I would need to perform the check for msg[c4d.BFM_SCROLLGROUP_SCROLLED] before returning. But even the barebones code copied from the SDK produces a crash.

          Rui Batista

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            On 30/05/2013 at 09:01, xxxxxxxx wrote:

            Problably a bug that the parent call crashes. Just don't call the parent method, I'm confident that
            the native implementation takes care that the parent-method is called in this case. If it's not,
            you'll notice once you work with the dialog.. 😉

            -Nik

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              On 30/05/2013 at 09:16, xxxxxxxx wrote:

              However, it expects me to return an Integer and that integer depends on the message. From the SDK:

              Returns: The return value depends on the message.

              It performs the check, but then returns an error (at the return) and the plugin doesn't even creates the layout in the window 😞

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                On 30/05/2013 at 09:36, xxxxxxxx wrote:

                Ok, found out. I have to return:

                return gui.GeDialog.Message(self, msg, result)

                Anyway, print msg[c4d.BFM_SCROLLGROUP_SCROLLED] always returns None.
                I assume that the Message method must be placed inside the GeDialog class that creates the layout that contains the scrollgroup, right?

                1 Reply Last reply Reply Quote 0
                • H Offline
                  Helper
                  last edited by

                  On 30/05/2013 at 09:38, xxxxxxxx wrote:

                  Originally posted by xxxxxxxx

                  The problem with this is that if I try to use the example from the SDK, I get a crash at startup 😞
                  The example is this one:

                  def Message(self, msg, result) :
                    return GeDialog.Message(self, msg, result)

                  Of course I would need to perform the check for msg[c4d.BFM_SCROLLGROUP_SCROLLED] before returning. But even the barebones code copied from the SDK produces a crash.

                  Rui Batista

                  it crashes most likely because you have not imported GeDialog in a global context. Try
                  return c4d.gui.GeDialog.Message(msg, result)instead (you have still to import
                  gui of course. this is working just fine for me. the gedialog message especially and message
                  methods generally are quite bug infested since r14 in python. they tend to be super crashy
                  or destroy your layout if you do not return a proper return value.

                  edit : yeah of course in the dialogs class.

                  1 Reply Last reply Reply Quote 0
                  • H Offline
                    Helper
                    last edited by

                    On 30/05/2013 at 09:50, xxxxxxxx wrote:

                    It doesn't crashes anymore, but msg[c4d.BFM_SCROLLGROUP_SCROLLED] always returns None, even when I'm dragging the scroll bar or clicking the arrows.

                    1 Reply Last reply Reply Quote 0
                    • H Offline
                      Helper
                      last edited by

                      On 30/05/2013 at 09:57, xxxxxxxx wrote:

                      BFM_SCROLLGROUP_SCROLLED is the msg ID not a value in the container. just read the cpp
                      example.

                      1 Reply Last reply Reply Quote 0
                      • H Offline
                        Helper
                        last edited by

                        On 30/05/2013 at 10:24, xxxxxxxx wrote:

                        I read the sample cpp's (they are for c++, right?) but none of them has any reference to BFM_SCROLLGROUP_SCROLLED.
                        I tried getting a value from:

                        value=msg[c4d.BFM_ACTION_ID]

                        or

                        value=msg[c4d.BFM_ACTION_VALUE]

                        or

                        value=msg[c4d.BFM_INPUT_VALUE]

                        but all of them return None.
                        I really don't know how to check for a change in the scroll bar 😞

                        1 Reply Last reply Reply Quote 0
                        • H Offline
                          Helper
                          last edited by

                          On 30/05/2013 at 10:31, xxxxxxxx wrote:

                          Sure the cpp docs are for cpp as the name implies, but the general approach is often quite
                          the same. Message containers can obviously be not always the same, as this would result
                          in huge containers containing all possible data. So c4d sendes different containers depending 
                          on the occasion. You have to check the container ID. GetId() is a BaseContainer method to get 
                          the container Id.

                          if msg.GetId() == c4d.BFM_SCROLLGROUP_SCROLLED :
                          	# do something with the msg container, just look up the values in the cpp docs.
                          
                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post