Creating the dialog before connecting it to the display