You can start with the tutorials located here (More than just dialogs listed) or here

To simplify the answer to your question about maintaining the checked state, you would have to save the state of the checkbox before closing the dialog, then restore the state in the ON DIALOG event for the initialization of the dialog.