Field

Ticket #94 (closed defect: fixed)

Opened 4 months ago

Last modified 4 months ago

cannot add KeyListener to canvas

Reported by: mikey Assigned to: marc
Priority: major Milestone:
Component: core Version:
Keywords: Cc:

Description (Last modified by marc)

The following code stopped working and I'm not sure why. I can add MouseListeners? this way, but I cannot add KeyListeners?.

from java.awt.event import KeyListener
from field.core.plugins.python import DynamicExtensionPoint

_self.onCanvas_ = DynamicExtensionPoint(KeyListener)

_self.enclosingFrame.getCanvas().addKeyListener(_self.onCanvas_.getProxy())

m = _self.onCanvas_.keyPressed

@m
def keypressed(event):
	print "this is a key event ",event

Change History

08/13/2008 07:33:51 AM changed by marc

  • status changed from new to assigned.
  • description changed.

try changeset:150 --- I might have broken this while flailing around on #90

08/13/2008 07:36:22 AM changed by marc

  • status changed from assigned to closed.
  • resolution set to fixed.

08/13/2008 07:38:13 AM changed by marc

By the way, you no longer need to do the m = something @m workaround.

from java.awt.event import KeyListener
from field.core.plugins.python import DynamicExtensionPoint

_self.onCanvas_ = DynamicExtensionPoint(KeyListener)

_self.enclosingFrame.getCanvas().addKeyListener(_self.onCanvas_.getProxy())


@_self.onCanvas_.keyPressed
def keypressed(event):
	print "this is a key event ",event

also works