In my wxWidget app, I have a custom dialog derived from wxDialog. The custom dialog basically works. When I run the app on MacOS, the custom dialog has a close button and can be moved around on the screen with the mouse. But on Windows 10 (with wxWidgets 3.2.2.1), the custom dialog does not have a close button and cannot be moved around with the mouse. I have google'd and tried other samples, but have not found a fix. How can I fix this problem?
This is my header file
class DlgDisplayLogs : public wxDialog
{
public:
DlgDisplayLogs(wxWindow* parent, const wxString& title);
int insertPage(wxString caption, wxString hostname, wxArrayString strArray);
void OnClose(wxCloseEvent& event);
void onCopyClipboardClicked(wxCommandEvent& event);
private:
wxWindow* parent;
wxNotebook* notebook;
DlgDisplayLogs* aham;
};
This is the .cpp file
DlgDisplayLogs::DlgDisplayLogs(wxWindow* parent, const wxString & title)
: wxDialog(parent, -1, title, wxDefaultPosition, wxSize(800, 600),
wxRESIZE_BORDER | wxCLOSE_BOX | wxMINIMIZE_BOX | wxMAXIMIZE_BOX)
{
this->parent = parent;
Bind(wxEVT_CLOSE_WINDOW, &DlgDisplayLogs::OnClose, this);
notebook = new wxNotebook();
notebook->Create(this, wxID_ANY, wxDefaultPosition, wxDefaultSize);
}
And this is how I create and launch the custom dialog
dlgDisplayLogs = new DlgDisplayLogs(this, "System log");
dlgDisplayLogs->Show();
You need to use wxCAPTION
style to show the title bar under MSW.
Arguably, wxMSW shouldn't require it if any of wxXXX_BOX
styles are specified, and I've created a PR to change this, but in the meanwhile just adding wxCAPTION
is a simple enough workaround.