Hi, a C++ and JUCE newbie is here.
I need to display a OkCancel message box from within a component.
The NativeMessageBox::showOkCancelBox demands a ModalComponentManager::Callback* parameter. As I understand I could use ModalCallbackFunction::create function to get the pointer, however the function I specify to create function must be a static function. However if it’s a static function it can’t access class instance that shows the message dialog.
I don’t understand how to resolve this… An example would be very helpful. I thought of something like this:
ModalComponentManager::Callback* callback =
ModalCallbackFunction::create(&this->modalStateFinished);
NativeMessageBox::showOkCancelBox(
AlertWindow::AlertIconType::QuestionIcon,
"Clear current list?",
"Do you want to clear currently displayed track",
this->getParentComponent(),
callback
);
But making modalStateFinished static kills the idea of accessing the object instance… Please advise.