Widget not working when using source code of the form