Minimum wxSlider width Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
jgoodchild
Knows some wx things
Knows some wx things
Posts: 37
Joined: Thu Jul 28, 2016 9:09 am

Minimum wxSlider width

Post by jgoodchild »

I have been having problems with Sliders not being displayed (as mentioned elsewhere) and I have finally worked out why.

To recap, I have an application, developed on wxWidgets version 3.0.2, running on a Debian 8 platform. The application involves multiple "pages" based on wxPanels, with the inactive pages being hidden and only the active page being shown. One of the pages has some wxSliders on a sub-panel, which can be shown or hidden, depending on the context. Each slider is surrounded by a wxStaticBox. All of this seems to work fine,

We want to run the application on Debian 10 and Ubuntu, so in addition to updating other libraries, we have also updated to wxWidgets version 3.0.5.

When I was running the application on Debian 10, however, none of the sliders were displayed, giving the impression that they were hidden. The associated wxStaticBox did appear, however.

The problem was the width of the sliders (which are vertical). It turns out that the width we were using successfully in our Debian 8 environment was too small for them to be displayed in the Debian 10 environment. On increasing the width by 5 pixels, the Sliders are now displayed as expected.

(Curiously, if I increase the size by a further 3 pixels, the Sliders change their appearance so that, instead of being monochrome, they are blue on one side and white the other.)

My question is: what is the cause of the change to the minimum Slider width: is it related to the upgrade from wxWidgets version 3.0.2 to 3.0.5, or is it a feature of the underlying GTK?

Also, is it possible to discover the minimum slider width at run-time?
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Minimum wxSlider width

Post by doublemax »

Even if i'm repeating myself: That's one of the things that sizers do for you :)

What happens if you use -1 as width? (Which should give you the default size).

If general, if you use absolute positioning and sizes instead of sizers, it's your responsibility to deal with platform differences.
Use the source, Luke!
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7479
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Minimum wxSlider width

Post by ONEEYEMAN »

Hi,
Just use sizers - all problems should be solved with them.

That is unless you really, really, really really want absolute positioning and ready to re-invent the wheel and spend some time (read: waste the time) to deal with platform differences yourself, as doublemax pointed out.

Thank you.
jgoodchild
Knows some wx things
Knows some wx things
Posts: 37
Joined: Thu Jul 28, 2016 9:09 am

Re: Minimum wxSlider width

Post by jgoodchild »

ONEEYEMAN wrote: Tue Nov 30, 2021 6:24 pm Just use sizers - all problems should be solved with them.

That is unless you really, really, really really want absolute positioning and ready to re-invent the wheel and spend some time (read: waste the time) to deal with platform differences yourself, as doublemax pointed out.
Clearly anyone developing an application from scratch would be crazy not to use Sizers. In my case, however, the time has already been wasted, and I am not inclined to waste even more time by rewriting several hundred GUI items. In any case, we are using a number of non-standard widgets of our own design, and I don't propose to find out if there are any negative interactions between these and Sizers.
doublemax wrote: Tue Nov 30, 2021 5:14 pm If general, if you use absolute positioning and sizes instead of sizers, it's your responsibility to deal with platform differences.
Yes, this is what caught me out. Fortunately, it was only the Sliders that were affected, due presumably to the redesign in the GTK. Presumably, using Sizers with default sizes would result in the new Slider appearance, and frankly I prefer the old appearance, which I can get by supplying the size of the Silder myself.

Anyway, hopefully, this will be the last time we change the platform for our application.
(We have plans to redevelop it for a new platform, basing it on a different framework, to get a common look/feel with our other applications.)

Thanks once more for all the useful comments.
Post Reply