Widgets look flat in wxFormbuilder, but not when compiled in IDE 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
Twincity9
Earned a small fee
Earned a small fee
Posts: 11
Joined: Thu Jan 24, 2019 9:24 pm

Widgets look flat in wxFormbuilder, but not when compiled in IDE

Post by Twincity9 » Wed Jan 30, 2019 2:32 pm

Hello,

I've just switched from using wxSmith to wxFormbuilder and I am having one issue that I haven't been able to solve.

I've created a Frame window in wxFormbuilder with different panels, notebooks, text controls and other widgets and all the controls in the wxFormbuilder app look flat (strangely except for one wxNoteBook which has the tabs on the right side instead of the top). That they look flat is good because that is my intention. But when I compile the generated code in my IDE (I use CodeBlocks), then everything works like a charm except that all the controls now have a 3D look with raised borders. wxBORDER_RAISED or wxBORDER_SUNKEN is nowhere enabled. I tried to set the wxBORDER_NONE setting of every widget in wxFormbuilder, but that has no effect. I haven't found any other setting that influences the 3D look.

Today I compiled the same code in Linux, also with the same IDE (the linker settings are different there, don't know if that explains it), in Linux all the controls look like they should, flat as in wxFormbuilder.

Any idea where I should look for the cause?

I am using Windows10 (and Ubuntu) and wxWidgets 3.04 and gcc compiler

rando
Knows some wx things
Knows some wx things
Posts: 30
Joined: Fri Nov 09, 2018 9:11 pm

Re: Widgets look flat in wxFormbuilder, but not when compiled in IDE

Post by rando » Wed Jan 30, 2019 3:17 pm

Do the buttons in your compiled application appear the same as buttons in other Windows applications? wxWidgets uses the windows theme by default. I am not aware of any workaround except to use wxUniversal which draws its own controls.

If you are willing to make bitmaps for all of your buttons and their various states (that you are interested in) that would also be an option.

Twincity9
Earned a small fee
Earned a small fee
Posts: 11
Joined: Thu Jan 24, 2019 9:24 pm

Re: Widgets look flat in wxFormbuilder, but not when compiled in IDE

Post by Twincity9 » Wed Jan 30, 2019 4:40 pm

Windows can not be the cause. I am also running wxFormbuilder under windows and the widgets look correct there. And before this I was using wxSmith instead of wxFormbuilder and there too the widgets were flat without sunken or raised borders within the same OS.

I am not talking about the buttons, what I mean are the borders of a wxTreeCtrl, the tabs of a wxNotebook and its border, and other panels.

Kvaz1r
Earned some good credits
Earned some good credits
Posts: 119
Joined: Tue Jun 07, 2016 1:07 pm

Re: Widgets look flat in wxFormbuilder, but not when compiled in IDE

Post by Kvaz1r » Wed Jan 30, 2019 5:13 pm

Can you provide MCVE for reproducing behaviour?

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3352
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Widgets look flat in wxFormbuilder, but not when compiled in IDE

Post by ONEEYEMAN » Wed Jan 30, 2019 5:49 pm

Hi,
Also, some screenshots would have been great as well as a screenshot of the Windows Explorer (to see how it looks on your machine).

Thank you.

Twincity9
Earned a small fee
Earned a small fee
Posts: 11
Joined: Thu Jan 24, 2019 9:24 pm

Re: Widgets look flat in wxFormbuilder, but not when compiled in IDE

Post by Twincity9 » Wed Jan 30, 2019 8:24 pm

Here are three screenshots, all of them are made in Windows10
Screenshots.png
Screenshots.png (18.36 KiB) Viewed 559 times

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3352
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Widgets look flat in wxFormbuilder, but not when compiled in IDE

Post by ONEEYEMAN » Wed Jan 30, 2019 9:33 pm

Hi,
So do you want the theme to look as if it is in the RAD tool?
Or you are just curious - why there is a difference?

Thank you.

Twincity9
Earned a small fee
Earned a small fee
Posts: 11
Joined: Thu Jan 24, 2019 9:24 pm

Re: Widgets look flat in wxFormbuilder, but not when compiled in IDE

Post by Twincity9 » Wed Jan 30, 2019 10:48 pm

It is supposed to look like either the left screenshot or the right screenshot, not like the middle screenshot.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3352
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Widgets look flat in wxFormbuilder, but not when compiled in IDE

Post by ONEEYEMAN » Wed Jan 30, 2019 11:00 pm

Hi,
What version of wxFB do you use?

Thank you.

New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 305
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: Widgets look flat in wxFormbuilder, but not when compiled in IDE

Post by New Pagodi » Wed Jan 30, 2019 11:55 pm

I think this is a theme/manifest issue. This topic has come up a few times, but I my search skills are failing me and I can't find any forum links right now.

The easy way to solve this is to:

1) create an rc file containing at least the line

Code: Select all

#include "wx/msw/wx.rc"
See <WXROOT>\samples\sample.rc for a sample of what other items you might want to include in your rc file
2) use windres to compile the rc file
3) include the object file generated by windres in the linking stage of your program.

If you're using and IDE, it should automate steps 2 and 3 for you.

Twincity9
Earned a small fee
Earned a small fee
Posts: 11
Joined: Thu Jan 24, 2019 9:24 pm

Re: Widgets look flat in wxFormbuilder, but not when compiled in IDE

Post by Twincity9 » Thu Jan 31, 2019 12:12 am

ONEEYEMAN wrote:Hi,
What version of wxFB do you use?

Thank you.
I am using wxFormbuilder version 3.9.0

Twincity9
Earned a small fee
Earned a small fee
Posts: 11
Joined: Thu Jan 24, 2019 9:24 pm

Re: Widgets look flat in wxFormbuilder, but not when compiled in IDE

Post by Twincity9 » Thu Jan 31, 2019 1:56 am

New Pagodi, your suggestion worked. I did not knew what a resource file was or how to include that line in my IDE but I found the instructions on the web.

I copied the sample.ico file from <WXROOT>\samples\sample.rc to my project directory where my main source files are

In my IDE (CodeBlocks in my case) I went to File -> New -> Empty File and named it icon.rc

I then added these lines of code to icon.rc:

MAINICON ICON "sample.ico"
#define wxUSE_NO_MANIFEST 0
#include "wx/msw/wx.rc"


Then I saved the files and compiled. The widgets look flat as they should, although the icon is not visible. I also tried the code from the sample.rc file but that did not work either. But my question, the reason for this topic was the non-flat widgets. And you helped me solve that.

Post Reply