# Multiple canvases

**URL:** <https://discourse.processing.org/t/multiple-canvases/20237>\
**Category:** Development\
**Created:** [April 28, 2020, 1:11pm UTC](https://discourse.processing.org/t/multiple-canvases/20237 "2020-04-28T13:11:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Post date:** [April 28, 2020, 1:11pm UTC](https://discourse.processing.org/t/multiple-canvases/20237/1 "2020-04-28T13:11:47Z")

</div>

How do I get passed the following problem.

I want to use PGraphics to create multiple canvases so that I can have proper overflow control on my menus however the following happens

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/c/cf13f63971cabc15660084fc092fd6360347ea2f.png)

note the rectangle square in the background of the two tabs. Although I am creating a new canvas for both they all share the same canvas.

Would using a mask fix the issue?

Also is there a reson creatCanvas doesnt work with FX2D? If i use it i get an null exception error when calling canvas.beginDraw().

---

<div class="post-metadata">

**Author:** ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Post date:** [April 29, 2020, 11:16pm UTC](https://discourse.processing.org/t/multiple-canvases/20237/2 "2020-04-29T23:16:25Z")

</div>

Problem found in code, canvases aren’t shared, it because I was calling

`canvas.rect(mouse.x,mouse.y,w,h);`

where mouse was a PVector recalculating mouse based on the x and y of the canvas, therefore all instance of canvas will draw a rect and it will appear that it is on all canvases.
