Skip to main content
WLewe
Associate III
Nov 5, 2019 3:37 PM UTC
Solved

I was attempting to put a keyboard inside a modal window. When I run the simulator and try to open up my modal window I get "Assertion failed!... Cannot add Drawable multiple times"

void MainScreenView::setVacuumPositionPercentBoxClickHandler(const BoxWithBorder& b, const ClickEvent& evt)
{
	// When target vacuum position box is clicked, display modal keypad with numericals
	targetPercentModalWindow.setVisible(true);
	targetPercentModalWindow.invalidate();
 
	keyboard.setPosition(410, 100, 320, 240);
	add(keyboard);
 
}

This is the code where I make the modal window visible and draw the keyboard.

This topic has been closed for replies.
Martin KJELDSEN
Martin KJELDSENBest answer
Principal III
Nov 5, 2019 9:39 PM UTC

You've answered your own question :) You're adding the keyboard every time you click that box.

You only need to add a Drawable to the root container of a view ONCE.

/Martin

6 replies

Martin KJELDSEN
Martin KJELDSENBest answer
Principal III
Nov 5, 2019 9:39 PM UTC

You've answered your own question :) You're adding the keyboard every time you click that box.

You only need to add a Drawable to the root container of a view ONCE.

/Martin

WLewe
WLeweAuthor
Associate III
Nov 5, 2019 10:09 PM UTC

Where would I find the root container for my modal window?