Modern windows 10 style for widgets Topic is solved

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
Rheel
In need of some credit
In need of some credit
Posts: 3
Joined: Sun Nov 24, 2019 11:52 am

Modern windows 10 style for widgets

Post by Rheel » Sun Nov 24, 2019 12:08 pm

Hello,

I have recently started using wxWidgets as my main library for UIs when using C++. It appears as if most widgets use an old style for on Windows 10:

Image

However, when for instance using a wxFileDialog, the new, more modern style is used:

Image

Is it possible to also use the modern style for buttons, dropdown boxes, etc. in custom dialogs and windows?

User avatar
doublemax
Moderator
Moderator
Posts: 14772
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Modern windows 10 style for widgets

Post by doublemax » Sun Nov 24, 2019 1:16 pm

This means that there is no manifest file in the executable. How (compiler/IDE?) did you build the project?

It's usually best to start with the "minimal" sample that comes with wxWidgets.
Use the source, Luke!

Rheel
In need of some credit
In need of some credit
Posts: 3
Joined: Sun Nov 24, 2019 11:52 am

Re: Modern windows 10 style for widgets

Post by Rheel » Sun Nov 24, 2019 4:15 pm

Thanks for your response. I am using MinGW64 as a compiler, and using Eclipse CDT as an IDE.

I took a look at the 'minimal' sample, was able to compile it, and see that it indeed has the modern buttons. Am I correct in assuming that it has something to do with a .rc file?

User avatar
doublemax
Moderator
Moderator
Posts: 14772
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Modern windows 10 style for widgets

Post by doublemax » Sun Nov 24, 2019 4:21 pm

Rheel wrote:
Sun Nov 24, 2019 4:15 pm
Am I correct in assuming that it has something to do with a .rc file?
Yes. Unfortunately i don't use MinGW, so i can't tell you how to enable embedding of the manifest file. Try checking the command line that's used when building the "minimal" sample.
Use the source, Luke!

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2361
Joined: Sun Jan 03, 2010 5:45 pm

Re: Modern windows 10 style for widgets

Post by PB » Sun Nov 24, 2019 6:01 pm

.rc file should include the application manifest. You can use the one supplied with wxWidgets, or better yet, use one that claims modern Windows compatibility as well as DPI awareness your application supports.

FWIW, this is how the simplest resource file generated by Code::Blocks may look like

Code: Select all

aaaa ICON <wx/msw/std.ico>

#include <wx/msw/wx.rc>
The first line includes the application icon used by Explorer etc. (in this case the default wxWidgets one), the second line includes the application manifest.

Code::Blocks output for compiling the resource file with mingw-64 32-bit looks like this (CBTEST~1 is the project folder)
windres.exe -ID:\Dev\Desktop\!Lib\wxWidgets-GIT\include -ID:\Dev\Desktop\!Lib\wxWidgets-GIT\lib\gcc_dll\mswud -J rc -O coff -i D:\Dev\Desktop\CBTEST~1\resource.rc -o obj\Debug\resource.res
and then the .res file is passed to the linker
i686-w64-mingw32-g++.exe -LD:\Dev\Desktop\!Lib\wxWidgets-GIT\lib\gcc_dll -o bin\Debug\CBTest123.exe obj\Debug\CBTest123App.o obj\Debug\CBTest123Main.o obj\Debug\GUIFrame.o obj\Debug\resource.res -mthreads -lwxmsw31ud_richtext -lwxmsw31ud_xrc -lwxmsw31ud_aui -lwxmsw31ud_media -lwxbase31ud_net -lwxmsw31ud_gl -lwxbase31ud_xml -lwxmsw31ud_adv -lwxmsw31ud_html -lwxmsw31ud_core -lwxbase31ud -lwxpngd -lwxjpegd -lwxtiffd -lwxzlibd -lwxregexud -lwxexpatd -mwindows

Rheel
In need of some credit
In need of some credit
Posts: 3
Joined: Sun Nov 24, 2019 11:52 am

Re: Modern windows 10 style for widgets

Post by Rheel » Sun Nov 24, 2019 11:04 pm

Thank you both very much, this has been of great help; it works!

Post Reply