To begin this is an example of opening and control a delphi form from the web page:
Now we can try to open a dialog box responding to user events: