Solve "None Resource" bug #2251

I am not sure whether it's necessary to check for the existance of children.
refactoring – merge the two ifs

Before, there was one if clause for creating the button variable and another one for capturing the mouse click and assigning a "name". These two ifs have been merged, as the "if" and "else" match identical cases.
capture Container instead of ImageButton

For this it was necessary to add:  event_name="mouseClicked"
Merge pull request #2252 from myrdd/patch-1

Fixes #2251