Hi Terry,
I'm not sure how much of the code you're looking for, so I hope this covers it. The CORE Tool sample project has a good example of how to build a dialog. In this case, you just declare it as a FloatingDialog rather than ModalDialog, and in postStartup() add callbacks for focus, blur, and close events.
Code:
this->latDlg = hdi::core::FloatingDialog("Latitude Settings", hdi::core::Size(modalWidth, modalHeight));
this-> latDlg.setBlurCallback(HDI_CORE_CALLBACK(mapProj::Plugin, this, blurDlgCB));
this-> latDlg.setCloseCallback(HDI_CORE_CALLBACK(mapProj::Plugin, this, closeDlgCB));
this-> latDlg.setFocusCallback(HDI_CORE_CALLBACK(mapProj::Plugin, this, focusDlgCB));
For the OK button, I define it this way so it's automatically a default button and closes the window:
Code:
OKbtn.setStyle(hdi::core::Button::DefaultStyle);
I set the Cancel button's behavior similarly:
Code:
cancelBtn.setStyle(hdi::core::Button::CancelStyle);
In the callbacks for these events and the OK and cancel buttons, I added compiler directives to account for differences in Mac and Windows.
Code:
void mapProj::Plugin::OKbtnCB(){
#ifdef WIN_ENV
this->blurDlgCB();
#endif
// your code here
}
void mapProj::Plugin::CancelBtnCB(){
// Mac automatically calls blurDlg first
#ifdef WIN_ENV
this->blurDlgCB();
#endif
// your code here
}
void mapProj::Plugin::focusDlgCB(){
// called when the dialog has been re-selected by the user
// your code here
}
void mapProj::Plugin::blurDlgCB(){
// called when the dialog is deactivated, e.g., user fiddles with art in the document
// your code here
}
void mapProj::Plugin::closeDlgCB(){
// Mac automatically calls blurDlg first
#ifdef WIN_ENV
this->blurDlgCB();
#endif
// your code here
}
Then, wherever in your code you show this dialog, just add a compiler directive for Windows to handle the focus event:
Code:
this->latDlg.show();
#ifdef WIN_ENV
this->focusDlgCB();
#endif
From here you shouldn't have to be concerned anymore about platform differences. :-)