You need to read up on the popupmanager and titlewindow component. You use titlewindow to create your custom dialogbox and you use the popupmanager to display it when required. The popupmanager allows you to do such things as set modal to true an place the dialogbox relative to different display objects or the screen.
Really Helpful... Thanks