Modal widget handling allows passing of any function to act on widget