# addMouseWheelListener not recognized in MapThing example

**URL:** <https://discourse.processing.org/t/addmousewheellistener-not-recognized-in-mapthing-example/41662>\
**Category:** Libraries\
**Created:** [April 9, 2023, 10:58am UTC](https://discourse.processing.org/t/addmousewheellistener-not-recognized-in-mapthing-example/41662 "2023-04-09T10:58:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikLomba](https://avatars.discourse-cdn.com/v4/letter/m/ea666f/32.png) [@mikLomba](https://discourse.processing.org/u/mikLomba)\
**Post date:** [April 9, 2023, 10:58am UTC](https://discourse.processing.org/t/addmousewheellistener-not-recognized-in-mapthing-example/41662/1 "2023-04-09T10:58:31Z")

</div>

I installed the MapThing library. When i try to run the example i get the error “addMouseWheelListener dindn’t exist”. This occurs both using processing 3 or 4 and on different PC. What’s wrong ?

---

<div class="post-metadata">

**Author:** ![mnse](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mnse/32/16520_2.png) [@mnse](https://discourse.processing.org/u/mnse)\
**Post date:** [April 9, 2023, 2:19pm UTC](https://discourse.processing.org/t/addmousewheellistener-not-recognized-in-mapthing-example/41662/2 "2023-04-09T14:19:58Z")

</div>

Hi @mikLomba,

I think you can simply remove the lines for adding the listener as it should be already registered to use this…

> **[mouseWheel() / Reference](https://processing.org/reference/mouseWheel_.html)**
>
> The code within the mouseWheel() event function is run when the mouse wheel is moved. (Some mice don't have wheels and this function is only applicable with mice that have a wheel.) The getC…

Cheers  
— mnse

---

<div class="post-metadata">

**Author:** ![mikLomba](https://avatars.discourse-cdn.com/v4/letter/m/ea666f/32.png) [@mikLomba](https://discourse.processing.org/u/mikLomba)\
**Post date:** [April 9, 2023, 2:39pm UTC](https://discourse.processing.org/t/addmousewheellistener-not-recognized-in-mapthing-example/41662/3 "2023-04-09T14:39:20Z")

</div>

deleting the “addMouseWheelListener” i was able to run the example, but the zoom-unzoom functionality is not working…  
(also it was necessary to move out from “setup” the call to “size” function …putting it in the “settings”). I’m not new with processing having developed some graphic applications…and I’m surprised by the number of errors encountered in this library example

Any other suggestions ?  
thanks  
mikLomba

---

<div class="post-metadata">

**Author:** ![mnse](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mnse/32/16520_2.png) [@mnse](https://discourse.processing.org/u/mnse)\
**Post date:** [April 9, 2023, 3:08pm UTC](https://discourse.processing.org/t/addmousewheellistener-not-recognized-in-mapthing-example/41662/4 "2023-04-09T15:08:55Z")

</div>

Hi @mikLomba,

Can’t test it currently as I’m not at my box, but I had a quick look at the GitHub example

[Map thing example](https://github.com/jreades/MapThing/blob/master/distribution/MapThing-1.5/examples/MapThing/MapThing.pde)

The code is a bit outdated, so variabel size can nowadays only be set on settings as for size in setup w,h needs to be constants.

For zooming you need to change the code a bit at line

`void mouseWheel(int delta)`  
to the signature from the reference link in my earlier post. The delta is then most probably

```auto
event.getCount()

```

Cheers  
— mnse

---

<div class="post-metadata">

**Author:** ![mikLomba](https://avatars.discourse-cdn.com/v4/letter/m/ea666f/32.png) [@mikLomba](https://discourse.processing.org/u/mikLomba)\
**Post date:** [April 9, 2023, 3:09pm UTC](https://discourse.processing.org/t/addmousewheellistener-not-recognized-in-mapthing-example/41662/5 "2023-04-09T15:09:57Z")

</div>

The example in the library works fine with the Processing 2.x. So i guess it is not fully compatible with later processing release.

---

<div class="post-metadata">

**Author:** ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)\
**Post date:** [April 9, 2023, 4:32pm UTC](https://discourse.processing.org/t/addmousewheellistener-not-recognized-in-mapthing-example/41662/6 "2023-04-09T16:32:14Z")

</div>

Hi

Yes true and there is no update for this library

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [April 9, 2023, 8:51pm UTC](https://discourse.processing.org/t/addmousewheellistener-not-recognized-in-mapthing-example/41662/7 "2023-04-09T20:51:31Z")

</div>

Hello @mikLomba,

> [@mikLomba](#):
>
> The example in the library works fine with the Processing 2.x. So i guess it is not fully compatible with later processing release.

I got this working with Processing 3.5.4 !

There were other errors with Processing 4.2; they may be related to the higher versions of JAVA that come with Processing 4.2.

Go to the GitHub repository here:  
[https://github.com/jreades/MapThing](https://github.com/jreades/MapThing)

Take a look at the _ **Pull requests** _ (there are 2) and this will give some insight into changes necessary.

This will address the “addMouseWheelListener” issue:  
[https://github.com/kfrajer/MapThing/blob/patch-2/distribution/MapThing-1.5/examples/MapThing/MapThing.pde](https://github.com/kfrajer/MapThing/blob/patch-2/distribution/MapThing-1.5/examples/MapThing/MapThing.pde)

This will address the “size() in setup issue”  
[https://github.com/kfrajer/MapThing/tree/patch-1/distribution/MapThing-1.5](https://github.com/kfrajer/MapThing/tree/patch-1/distribution/MapThing-1.5)

You will have to combine the changes above into one sketch!  
I suggest you start with the first one and then just make the changes to the _size()_ in the next one. `:)`

Output:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/4/b/4b815c963b0cbba272ac6349d6f239facdff6a73.png)

Have fun navigating GitHub!

I used _MapThing version 1.4_ and installed it with the _Processing Contribution Manager_.

Note:  
The _MapThing_ version on GitHub is 1.4.1 and when I manually added this library it asked me to update to 1.4!  
This sometimes happens with older libraries that are not maintained to work with the _Processing Contribution Manager_.  
I did not explore further on the version numbers.

Reference to _Map Thing_ version number on GitHub:  
[https://github.com/jreades/MapThing/blob/master/distribution/MapThing-1.5/download/MapThing.txt#L49](https://github.com/jreades/MapThing/blob/master/distribution/MapThing-1.5/download/MapThing.txt#L49)

> [@mikLomba](#):
>
> I’m surprised by the number of errors encountered in this library example

_Map Thing_ is over 10 years old and Processing has made big leaps over time to new versions.  
This is to be expected with a library that has not been updated.  
Fortunately it is shared on GitHub and can be updated by those taking an interest.

`:)`
