Detect that a Scrollgroup scroll bar has changed
-
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
-
On 30/05/2013 at 07:58, xxxxxxxx wrote:
gedialog.message() and BFM_SCROLLGROUP_SCROLLED. there is an example in the cpp docs.
-
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
-
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
-
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
-
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? -
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.
-
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.
-
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. -
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 -
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.