Closing A Modal Dialog Window?

I’m showing a modal dialog window with

This shows a dialog window with a close button on the menu bar, I want to place another button in mycomp, where when the user clicks it closes the window. Whats the function call to close this modaldialog window? (I need to call this from mycomp) I have already tried

[code]void buttonClicked (Button* buttonThatWasClicked)
     if (buttonThatWasClicked == closeButton) exitModalState(0);

But it doesn’t seem to do anything…

Just a couple of ideas…

  1. You are receiving the buttonClick event (ButtonListener)
  2. Shouldn’t exitModalState be sent to the DialogWindow component?

Julian put this in the header…

[quote]To close the dialog programatically, you should call exitModalState (returnValue) on
the DialogWindow that is created. To find a pointer to this window from your
contentComponent, you can do something like this:
Dialogwindow* dw = contentComponent->findParentComponentOfClass ((DialogWindow*) 0);[/quote]

if (buttonThatWasClicked == closeButton)
contentComponent->findParentComponentOfClass ((DialogWindow*) 0)->exitModalState(0); 

The close button I want to add is in the DialogWindow that opens up, and since this is modal (showModalDialog) the parent does not have focus until this window is closed. The question is what function can I call for the Dialog to close it self? Sorry if this was not clear before…

Surely Justin’s answer is pretty much exactly what you were asking for??