What is the best way to pass data back and forth between views and dialogs?

Lets say I have a custom dialog (not a lookup) that I want to use to get information from the user. Maybe there are more than one items of data that need to be returned, like an X and a Y coordinate.

How do I make it so that multiple views in my program can query this dialog and get the information back from it? Or make it so that it sends the data back to the view that called it?

How would you make it so that it could be used as a Prompt object for a form, without having to do any extra coding each time it is used?

As an example, lets say I want to create an object that can be used as a prompt object for filename fields. I just want to set "prompt_object to oFilenamePopup" and have it put the filename returned into the form whose prompt object called it. Maybe it is just an "Input_box" type object, where the user clicks the prompt button and a dialog with a single form and an Ok button comes up. When they click OK, whatever they typed gets transferred magically to the form they were on when they hit the grid button.

In other words, how do I make my own custom dialog that works just like a lookup but can put a string value in the form that called it?