In my Matlab script, which I'm using with Octave, I have a uicontrol
element in my figure, of Style
Slider
, which is essentially a regular scroll bar slider.
controls.slider.audio_1 = uicontrol( 'Style', 'Slider', ...
'Position', [ 100 150 10 300 ], ...
'Max', 100, 'Min', 1, ...
'SliderStep', [ 0.01 0.01 ], ...
'Units', 'normalized', ...
'Value', 1 )
The orientation of the slider is determined by its geometry: it's 10px wide and 300px tall, making it into a vertical slider. I have not yet found a way to force the orientation.
But here comes the main point of my question: When I define the slider like this, the minimum value (defined by Min
) is at the top! The slider works with it's minimum position at the top, and then the user has to pull it downwards to increase the value. I'd like to switch that around, such that the minimum is at the bottom, and the slider increases its value, when dragged upwards.
How do I do that?
UTSL! In libgui/graphics/SliderControl.cc#l65 you'll find
bool vertical_slider = ( bb(2) < bb(3) );
slider->setOrientation (vertical_slider ? Qt::Vertical : Qt::Horizontal);
if (vertical_slider)
slider->setInvertedAppearance (true); // Matlab compatibility
Which is exactly what you are looking for. Then fire up hg blame
to see who added the line when and have a look at the commit message:
$ hg log -r 23412
changeset: 23412:7b95435e96a4
user: Rik <rik@octave.org>
date: Tue Apr 18 16:35:38 2017 -0700
summary: Reverse orientation of vertical uicontrol "sliders" for Matlab compatibility (bug #50818).
Aha!. So this was changed for compatibility on the development tree (aka default) in 2017. So the 4.2.x release doesn't see this yet but the next 4.4 release will have the change.
But you haven't mentioned your used GNU Octave version yet.