kyma•tweaky . How . ModifyMouseToEventTool

Question (or Task)

I have been trying to edit the MouseToEvent.pci tool and wanted to make the following changes:

  1. Limit Event Generation from the tool to when the cursor is within the ActiveArea window.
  2. I would like to alter the ActiveState, so that it is only active (only generating events) when the Mouse is down - i.e. clicked on the 'ActiveArea' - on Mouse up, the events should cease to be created.

Are there any SmallTalk messages regarding mouse events? How can I test for them? and what is the syntax for them?

Best regards, Andrew

-- AndrewPurdy - 12 Nov 2003

Solution(s)

The way the tool is set up, the UpdateXY code block is used as a subroutine with a side effect of setting the X and Y global variables. Because of this, you cannot use it to change states. The best way to do what you are trying to do is to change the last trigger in the ActiveState from true to:

| bnds pt |

bnds := ActiveArea bounds.
pt := ActiveArea controller sensor cursorPoint.

"Update values only when mouse in active area."
bnds containsPoint: pt

this limits the update of the graphic and the sending of the values to the Capybara to occur only when the mouse is within the ActiveArea.

If you use the following code instead, then the updates are limited to when the mouse button is down and the mouse is within the ActiveArea:

| bnds pt |

bnds := ActiveArea bounds.
pt := ActiveArea controller sensor cursorPoint.

"Update values only when mouse in active area."
(ActiveArea controller sensor anyButtonPressed) and: [bnds containsPoint: pt]

-- KurtHebel - 12 Nov 2003

WebForm
Question: How do I modify the mouse to event tool to pay attention to the mouse button and the mouse location?
Keywords: tool, MouseToEvent.pci, Smalltalk

----- Revision r1.1 - 12 Nov 2003 - 21:53 GMT - KurtHebel
Copyright © 1999-2014 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding kyma•tweaky? Send feedback.