cancel
Showing results for 
Search instead for 
Did you mean: 

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"

WLewe
Associate III
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.

1 ACCEPTED SOLUTION

Accepted Solutions
Martin KJELDSEN
Chief III

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

View solution in original post

6 REPLIES 6
Martin KJELDSEN
Chief III

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

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

Also, I want to resuse my modal keyboard many times throughout the project. Would I use a custom container to get the job done?

Thank you.

Yes, you could use a custom container for that. And in that case you can add() drawables to that container.

/Martin

Okay! I will give this a try tomorrow and see if I have success. It's already past 5 in New Jersey. Thanks for your help Martin.

No problem! let me know how you do!