Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event handling doesn't support AnnouncementSet #499

Open
tinchodias opened this issue Apr 15, 2024 · 1 comment
Open

Event handling doesn't support AnnouncementSet #499

tinchodias opened this issue Apr 15, 2024 · 1 comment

Comments

@tinchodias
Copy link
Collaborator

Reproduce with:

BlElement new
	addEventHandlerOn: BlClickEvent, BlMouseDownEvent, BlMouseUpEvent
	do: [ ].

to get a "Instance of AnnouncementSet did not understand #enableIn:"

In Pharo12.

@tinchodias
Copy link
Collaborator Author

For the record, I did a first try and failed to fix it. I share the code below.

I created this test in BlEventTest:

testAnnouncementSet

	| element events |
	events := OrderedCollection new.

	element := BlElement new.
	element
		addEventHandlerOn: BlClickEvent, BlMouseMoveEvent
		do: [ :anEvent | events add: anEvent class ].
	
	BlSpace
		simulateMouseMoveInside: element;
		simulateClickOn: element button: BlMouseButton primary;
		simulateMouseDownOn: element; "should be ignored"
		simulateClickOn: element button: BlMouseButton secondary.

	self assert: events asArray equals: { BlMouseMoveEvent. BlClickEvent. BlClickEvent }

and created this extension in AnnouncementSet:

enableIn: aBlElementEventDispatcher

	^ self do: [ :each | each enableIn: aBlElementEventDispatcher ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant