On 13/02/2013 at 10:14, xxxxxxxx wrote:
I'm trying to obtain the input channel of the mouse when GeDialog.Command() is called. I was
trying to obtain the data via GeDialog.GetInputState() and c4d.gui.GetInputState(). Although
the call always succeeds, the channels stored in the returned container is always the channel
passed to the function, not the channel actually triggering the event.
GeDialog.GetInputEvent() and c4d.gui.GetInputEvent() doesn't work at all. Please try the
following snippet in the Script Manager:
import c4d
class Dialog(c4d.gui.GeDialog) :
def CreateLayout(self) :
bc = c4d.BaseContainer()
bc.SetBool(c4d.QUICKTAB_SHOWSINGLE, True)
bc.SetBool(c4d.QUICKTAB_NOMULTISELECT, True)
self.quicktabs = self.AddCustomGui(1000, c4d.CUSTOMGUI_QUICKTAB, "",
c4d.BFH_SCALEFIT, 0, 0, bc)
self.quicktabs.AppendString(0, "Item 1", False)
self.quicktabs.AppendString(1, "Item 2", False)
self.quicktabs.AppendString(2, "Item 3", False)
self.quicktabs.DoLayoutChange()
self.quicktabs.Select(0, True)
self.AddComboBox(1001, c4d.BFH_SCALEFIT)
self.AddChild(1001, 0, "GeDialog.GetInputState()")
self.AddChild(1001, 1, "c4d.gui.GetInputState()")
self.AddChild(1001, 2, "GeDialog.GetInputEvent()")
self.AddChild(1001, 3, "c4d.gui.GetInputEvent()")
return True
def Command(self, id, msg) :
if id == 1000:
device = c4d.BFM_INPUT_MOUSE
channel = c4d.BFM_INPUT_MOUSERIGHT
method = self.GetLong(1001)
state = c4d.BaseContainer()
if method == 0:
ok = self.GetInputState(device, channel, state)
elif method == 1:
ok = c4d.gui.GetInputState(device, channel, state)
elif method == 2:
ok = self.GetInputEvent(device, state)
elif method == 3:
ok = c4d.gui.GetInputEvent(device, state)
else:
return True
if ok:
print "Asked Channel:", channel
print "Active Channel", state[c4d.BFM_INPUT_CHANNEL]
else:
print "No state retrieved."
print "~" * 50
return True
dlg = Dialog()
dlg.Open(c4d.DLG_TYPE_MODAL)
Try pressing with left and right-click on any of the Quick Tabs. You can change the method in the
GUI. You will notice that GetInputEvent() doesn't work at all. GetInputState() always succeeds,
but that should not be correct. It should either return False for the left-mouse click or fills in
the correct value into the BFM_INPUT_CHANNEL item of the container!
Is this a bug or am I doing something wrong?
Next, I printed out the contents of the msg container passed to Command().
# RIGHT CLICK
1835362660 : 1000
1835361394 : 0
1835365985 : 0
**1869443943** Container:
1768976737 : 0
1768975727 : 0
1768973430 : 1836021107
** 1768973153 : 2**
1768978017 : 1
1768977985 : 1.0
1768978040 : 21.0
1768978041 : 20.0
1768978042 : 0.0
1769107316 : 0.0
1769237620 : 0.0
1768320615 : 0.0
1886547828 : 0.0
1768973410 : 0
# LEFT CLICK
1835362660 : 1000
1835361394 : 0
1835365985 : 0
**1869443943** Container:
1768976737 : 0
1768975727 : 0
1768973430 : 1836021107
** 1768973153 : 1**
1768978017 : 1
1768977985 : 1.0
1768978040 : 24.0
1768978041 : 13.0
1768978042 : 0.0
1769107316 : 0.0
1769237620 : 0.0
1768320615 : 0.0
1886547828 : 0.0
1768973410 : 0
The container contains the information I want (the mouse channel that was used), but the id
1869443943 does not have a Symbol and it is also not documented in the C++ documentation,
nor in the Python documentation.
Thanks in Advance,
-Niklas
I'm using Cinema 4D R14.025.