wxDialog and wxMAXIMIZE_BOX under Linux

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
Dee
Experienced Solver
Experienced Solver
Posts: 94
Joined: Sun Mar 27, 2005 7:56 pm

wxDialog and wxMAXIMIZE_BOX under Linux

Post by Dee »

I'm using wxWidgets 2.6.1 with Code::Blocks under Ubuntu 6.06. My problem is similar to this one. The problem is I have found the comment
Equivalent to a combination of wxCAPTION, wxCLOSE_BOX and wxSYSTEM_MENU (the last one is not used under Unix)
in the help. In combination with a quote from the other thread
Adding wxSYSTEM_MENU give rest of item available !!
I assume I could not have a maximize box in a dialog under Linux... But why?

Is there another way to get a similar modal dialog that can be maximized?

Greetings, Dee
Ubuntu 6.06 with wxWindows 2.8.6
DavidHart
Site Admin
Site Admin
Posts: 4252
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Post by DavidHart »

Hi,
I assume I could not have a maximize box in a dialog under Linux...
Playing around in XRCed, it seems that to get a maximise box you need to use the style flags:
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMAXIMIZE_BOX
For some reason, it doesn't appear if the wxRESIZE_BORDER is omitted :? .

Regards,

David
Dee
Experienced Solver
Experienced Solver
Posts: 94
Joined: Sun Mar 27, 2005 7:56 pm

Post by Dee »

I've have already tested it with all options and almost all combinations I can think of.

wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMAXIMIZE_BOX gives me a resizable dialog but without the maximize box.

Greetings, Dee
Ubuntu 6.06 with wxWindows 2.8.6
DavidHart
Site Admin
Site Admin
Posts: 4252
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Post by DavidHart »

Hmm. It works for me.

Try hacking the 'Dialogs' sample:

Code: Select all

//Change line 1316 in wxGTK-2.6.3 from

MyModalDialog::MyModalDialog(wxWindow *parent)
             : wxDialog(parent, wxID_ANY, wxString(_T("Modal dialog")))

//to

MyModalDialog::MyModalDialog(wxWindow *parent)
             : wxDialog(parent, wxID_ANY, wxString(_T("Modal dialog")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE  | wxRESIZE_BORDER | wxMAXIMIZE_BOX)
Then the dialog you get by typing Ctrl-W should have a maximise box.

If that doesn't work for you, it must be a wx version thing: 2.6.3 has been out for a while now ;)
If it does work, perhaps it's a C::B bug.
Dee
Experienced Solver
Experienced Solver
Posts: 94
Joined: Sun Mar 27, 2005 7:56 pm

Post by Dee »

Hello,

I've changed the code and Strg-W gives me a modal dialog - unfortunately only with a close box but without a maximize box.

So this means I have to live with until a new version is out in the Ubuntu repo? As I just read in the 2.7.2 docu the sentence "(the last one is not used under Unix)" is still there. So I do not have much hope...

Thanks anyway,
Dee
Ubuntu 6.06 with wxWindows 2.8.6
DavidHart
Site Admin
Site Admin
Posts: 4252
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Post by DavidHart »

Very strange. I just tested it with my (built from tarball) wxGTK-2.6.1, and it works there too. Maybe there's something strange about the ubuntu version.
So this means I have to live with until a new version is out in the Ubuntu repo?
Um, this might seem like heresy to a ubuntu user, but it is still possible to build your own wxGTK; you don't have to use apt-get ;)

Also see http://www.wxwidgets.org/downloads/ under Binaries: "Experimental Ubuntu Dapper packages for 2.7.2 are available...."
Dee
Experienced Solver
Experienced Solver
Posts: 94
Joined: Sun Mar 27, 2005 7:56 pm

Post by Dee »

Ah new wx-Version outside of Ubuntu repos is not a good idea. I am distributing the program (mainly for beginners) and so it's better that I can build a deb with all dependencies fullfillable with a standard release.

But I will try out the 2.7.2 repo on my second installation. :) I will report later...

Greetings,
Dee
Ubuntu 6.06 with wxWindows 2.8.6
Dee
Experienced Solver
Experienced Solver
Posts: 94
Joined: Sun Mar 27, 2005 7:56 pm

Post by Dee »

So, finally I have installed wx2.7.2 and there is no change at all. So I guess wxDialog and Unix does not match. :(

Greetings, Dee
Ubuntu 6.06 with wxWindows 2.8.6
DavidHart
Site Admin
Site Admin
Posts: 4252
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Post by DavidHart »

Hi again,

Just for the record, it seems to depend on the window manager. Using the same version/code/executable, KDE produces a Maximise box, while Gnome, WindowMaker and FVWM don't.

Looks like you need to switch to Kubuntu ;)

Regards,

David
Dee
Experienced Solver
Experienced Solver
Posts: 94
Joined: Sun Mar 27, 2005 7:56 pm

Post by Dee »

Hm, I won't switch but it'd good to know that "my" users see the maximize box sometimes.

I hope it's okay if I do not set this topic as solved, because it is not solved. Maybe you will fix the error whereever it is. :)

Greetings, Dee
Ubuntu 6.06 with wxWindows 2.8.6
trivia21
Knows some wx things
Knows some wx things
Posts: 33
Joined: Sun Apr 08, 2012 5:08 pm

Re: wxDialog and wxMAXIMIZE_BOX under Linux

Post by trivia21 »

Seems like your version of GTK+ (just like mine) doesn't allow any other decoration on dialogs than a close button. The only way around I have found is to use a normal (non-dialog) window.
If you want to solve it on the GTK+ (2.0) level:

Code: Select all

#include <wx/setup.h>
#if defined(__WXGTK20__)
#include <gtk/gtk.h>
#endif

// ...

wxDialog * dlg = new wxDialog(NULL, wxID_ANY, L"wxTry", wxDefaultPosition, wxDefaultSize,
                              wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMAXIMIZE_BOX);
#if defined(__WXGTK20__)
gtk_window_set_type_hint(GTK_WINDOW(dlg->GetHandle()), GDK_WINDOW_TYPE_HINT_NORMAL);
#endif
dlg->ShowModal();

(You'll have to have the GTK+ developement files, and add `pkg-config --cflags gtk+-2.0` to the compiler options and `pkg-config --libs gtk+-2.0` to the linker options.)
Post Reply