Open a popup window as modal

  • Thread starter Thread starter glenhong
  • Start date Start date
G

glenhong

Im trying to display a popup window (similar to a context menu) and
return a result from the selection. I want to do this as a modal popup
ie. The code runs and displays the popup but pauses until the window
is closed and then returns the result very similar as to ShowDialog()
on the form class.

The popup window is a 3rd party control which I hope to wrap up in
another class. I have tried using threads but have been unsuccesful,
the main problem being I block the UI thread which is no good.

Any help aprreciated.
 
Hi,

I do not clear uderstand what is your problem, does ShowDialog doesn't
solve your problem?

cheers,
 
The control that I am using does not implement a ShowDialog method. It
is a PopupControlContainer (behaves like a panel and pops up like a
Right-Click context menu would).

However I would like to display this popup modally i.e. Display the
popup and wait for it to close and continue code execution

eg.

void DisplayPopup(Control controlToPop)
{
PopupControlContainer pcc = new
PopupControlContainer(controlToPop);

pcc.ShowPopup();
//I would like the code to wait here until the popup has been
closed. Possibly with a thread or something similar???
MessageBox.Show(pcc.SomeValue);

}

This is a simplified version of what I am trying to acheive.

Really, any help appreciated.

Thanks
 
Hi,


What if you include this control inside a form ( which is the control that
implement ShowDialog ) , this form will have only one control; yours


cheers,
 
Back
Top