• Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Hot Door CORE Forum All forums General discussion v
1 2 3 Next »
FloatingDialog issues between Mac and Windows?

 
  • 0 Vote(s) - 0 Average
FloatingDialog issues between Mac and Windows?
Rick Johnson
Offline

Senior Member

Posts: 259
Threads: 130
Joined: Jan 2014
Reputation: 0
#3
03-02-2019, 10:58 AM
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. :-)
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Messages In This Thread
FloatingDialog issues between Mac and Windows? - by Rick Johnson - 10-09-2018, 05:16 PM
RE: FloatingDialog issues between Mac and Windows? - by TerryMulhern - 02-28-2019, 12:42 AM
RE: FloatingDialog issues between Mac and Windows? - by Rick Johnson - 03-02-2019, 10:58 AM

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

Linear Mode
Threaded Mode