On 02/04/2013 at 16:11, xxxxxxxx wrote:
Hello everybody,
i want my userarea to redraw while mousedragging, but I dont get it. Ive already managed to get into a dragging loop with updating mouse position. Ive found this ... >If one is designing a real element, for example a slider, one might also want to send regular messages to the parent dialog. These are sent with SendParentMessage() and appear as calls to Command() in the dialog, just as with any regular element:
// Create an action message, // with the user area's id: var action = new(BaseContainer, BFM_ACTION); action->SetData(BFM_ACTION_ID, GetId()); while(TRUE) { // Poll the mouse as above and draw the slider. // Send a message to the parent dialog, so that // it knows that the user is dragging the slider: action->SetData(BFM_ACTION_INDRAG, TRUE); SendParentMessage(action); } // Notify the dialog that the dragging is finished: action->SetData(BFM_ACTION_INDRAG, FALSE); SendParentMessage(action);
... but Im not able to translate to python.
Can anyone help?
My attempt:
state = c4d.BaseContainer()
while self.GetInputState(c4d.BFM_INPUT_MOUSE, c4d.BFM_INPUT_MOUSELEFT, state) :
if state.GetLong(c4d.BFM_INPUT_VALUE)==0: break
mouse_x=state.GetLong(c4d.BFM_INPUT_X)
mouse_y=state.GetLong(c4d.BFM_INPUT_Y)
# Do Stuff
action = c4d.BaseContainer(c4d.BFM_ACTION)
action.SetLong(c4d.BFM_ACTION_ID, self.GetId())
action.SetLong(c4d.BFM_ACTION_INDRAG, True)
self.SendParentMessage(action)
self.Redraw()
action.SetLong(c4d.BFM_ACTION_INDRAG, False)
self.SendParentMessage(action)
Greetings
rown