wxSpinCtrl larger buttons

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
p_lu
Knows some wx things
Knows some wx things
Posts: 29
Joined: Thu Oct 25, 2018 2:04 pm

wxSpinCtrl larger buttons

Post by p_lu »

I need to use something like wxSpinCtrl, but need to have the up and down (arrow) buttons much larger, so that it's easy to manipulate using a finger on a touch screen. Also, if the text box in spinctrl is enlarged, I'd like the text label to be centered, rather than at the top.

Right now I get something like (dots are spaces):

+------------+---+
|.....88....| ^ |
|............|...|
|............| v |
+------------+---+

and I really want something like this:

+------------+----------+
|............|....^.....|
|.....88....|...........|
|............|.....v.....|
+------------+----------+

Is there any way to "resize" wxSpinCtrl, or is there any widget that would do what I need?

Thanks in advance for all help.
Manolo
Can't get richer than this
Can't get richer than this
Posts: 828
Joined: Mon Apr 30, 2012 11:07 pm

Re: wxSpinCtrl larger buttons

Post by Manolo »

I have not tested it, but, what about adding the wxSpinCtrl to a sizer, and setting some minimum value for its size?

Be aware that in some platforms this control is native, so I dude about such a size-feature.

In the worst case you can create your own composite control (as wxSpinCtrl is, see /src/generic/spinctlg.cpp) and resize the spinbutton and texctrl on your own.
p_lu
Knows some wx things
Knows some wx things
Posts: 29
Joined: Thu Oct 25, 2018 2:04 pm

Re: wxSpinCtrl larger buttons

Post by p_lu »

After playing around with the available widgets, I think I'm resigned to just putting together basic components and wiring up thing myself. It's just not that simple to get buttons/controls/displays with the proportions I need. For the wxSpinCtrl functionality, I just have to piece together two wxButton's and one wxStaticText.

I need/want to do a list box or combo box thing also, with bigger buttons, but have decided it's just easier to use the same buttons+text method.

As you point out, people who do a lot of these GUIs probably build personal libraries of favorite composite controls that do exactly what they want, with the looks they prefer. I just need something quick, simple, and easy.

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

Re: wxSpinCtrl larger buttons

Post by ONEEYEMAN »

Hi,
Is this for the HighDPI display?
Keep in mind that wxWidgets is known to use a native controls whenever possible. So if the native control doesn't have this functionality - you definitely need to create a custom one.

Thank you.
p_lu
Knows some wx things
Knows some wx things
Posts: 29
Joined: Thu Oct 25, 2018 2:04 pm

Re: wxSpinCtrl larger buttons

Post by p_lu »

I'm using a 3.5" touchscreen on a Raspberry Pi. The goal is to have buttons big enough for a finger to activate.

Yes. native controls are meant to use the screen as a "computer display," with buttons that are controllable via a cursor (mouse, touchpad, stylus, etc.), so the relative dimensions of controls verses status areas are pretty fixed at a very low ratio. The native controls also account for overall screen resolution settings, keeping the controls verses status areas proportions the same, but increasing/decreasing both sizes with the overall resolution.

It's custom set-ups for me.

Thanks.
Post Reply