Resize window and object in class

You have to somehow take into account the change. It can be an if test or you use system variables width & height to always position element correctly