The width of the SpinCtrl is much to big. There is enough space for
round about 6 digits or more in the text-field. But I only want to
display 2 digits.
How can I tell SpinCtrl to be smaller?
I don't want to give it fixed values in pixel. This would be quite
dirty because the application can run on a lot of different machines.
So the best would be if the control would calculate its width by its
'max' value. But it doesn't.
So I tried to just half the widht but this code cause in disapearing of
the control.
Have you looked at the value returned from GetMaxSize? (Hint, -1 means that it is undefined.)
If you're using this in a sizer then you really want to use SetMinSize instead as that tells the sizer what the smallest best size of the widget should be, and unless something in the sizer item flags causes it to be larger then the minsize is the largest the sizer will make it too. And the minsize overrides the widget's built in best size.
You can get an approximate pixel value for how wide to make the widget by using sc.GetTextExtent('00').width + N where N is some value you pick to add extra space for the internal margins, the size of the spin button, etc.
···
c.buhtz@posteo.jp wrote:
This depends especially on SpinCtrl.
The width of the SpinCtrl is much to big. There is enough space for
round about 6 digits or more in the text-field. But I only want to
display 2 digits.
How can I tell SpinCtrl to be smaller?
I don't want to give it fixed values in pixel. This would be quite
dirty because the application can run on a lot of different machines.
So the best would be if the control would calculate its width by its
'max' value. But it doesn't.
So I tried to just half the widht but this code cause in disapearing of
the control.
Have you looked at the value returned from GetMaxSize? (Hint, -1
means that it is undefined.)
SpinCtrl.GetMaxSize() is undocumented
I don't want to check the return value of each function just because it
is undocumented. But we had this topic in the past...
You can get an approximate pixel value for how wide to make the
widget by using sc.GetTextExtent('00').width
Ah nice. I remeber this from my C++ times. Very helpfull.
the size of the spin button, etc.
How can I get the size of the spin buttons? I checked the C++ headers
and find now methode to recieve the "child controls" (text-field and
spin-button).
···
On 2015-04-13 13:05 Robin Dunn <robin@alldunn.com> wrote:
You see the string before the '.'. I mean "SpinCtrl.GetMaxSize" not
"Window.GetMaxSize". And by-the-way: the -1-return-value isn't
documented in "Window.GetMaxSize".
···
On 2015-04-25 17:26 Werner <wernerfbd@gmx.ch> wrote:
On 4/25/2015 15:55, c.buhtz@posteo.jp wrote:
> SpinCtrl.GetMaxSize() is undocumented
On 2015-04-25 17:26 Werner <wernerfbd@gmx.ch> wrote:
On 4/25/2015 15:55, c.buhtz@posteo.jp wrote:
SpinCtrl.GetMaxSize() is undocumented
see the inheritance diagram from class SpinCtrl.
You see the string before the '.'. I mean "SpinCtrl.GetMaxSize" not
"Window.GetMaxSize". And by-the-way: the -1-return-value isn't
documented in "Window.GetMaxSize".
I hope someone will test this one-pixel-missing-behaviour with C++. I
will open a bug-report for that.
···
On 2015-04-11 02:35 <c.buhtz@posteo.jp> wrote:
This depends especially on SpinCtrl.
The width of the SpinCtrl is much to big. There is enough space for
round about 6 digits or more in the text-field. But I only want to
display 2 digits.