MintyAnt
MintyAnt

Reputation: 3058

Modal window, but only for some windows

I have a form. This form can open an editor, which extends from Form. The editor has links you click, which opens a modal form to define that link.

// Main form
private void OnMainForm_MouseClick(object sender, MouseEventArgs e)
{
    Editor editor = new Editor();
    editor.Show();
}



// editor
private void OnEditorLink_MouseClick(object sender, MouseEventArgs e)
{
    LinkConfigDialog linkDialog = new LinkConfigDialog();
    linkDialog.ShowModal();
}

This ensures that the user cannot click, and attempt to modify, other links (or the same link) which editing one already. This is by design.

However, now I wish to let people open multiple Editors. I still want the modal forms to work, but ONLY for those editors, not for the entire application.

How can I accomplish this?

Upvotes: 0

Views: 110

Answers (1)

hattenn
hattenn

Reputation: 4399

I think you should write a method in your Editor class that "freezes" your Editor dialog. For example, by disabling the controls and so. Then you can call that method when a LinkDialog is opened. This way you can have multiple Editor instances that are only disabled by their own LinkDialogs. You can have another method that re-enables the controls that will be called when the LinkDialog is being closed.

Upvotes: 1

Related Questions