Bug 511257 - Slider SWT.VERTICAL with setOrientation(SWT.RIGHT_TO_LEFT) fails
Summary: Slider SWT.VERTICAL with setOrientation(SWT.RIGHT_TO_LEFT) fails
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.6   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2017-01-28 09:36 EST by Philip Wenig CLA
Modified: 2020-03-31 07:49 EDT (History)
5 users (show)

See Also:


Attachments
Slider vertical (133.83 KB, image/png)
2020-03-30 11:00 EDT, Philip Wenig CLA
no flags Details
Slider horizontal (212.77 KB, image/png)
2020-03-30 11:02 EDT, Philip Wenig CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Philip Wenig CLA 2017-01-28 09:36:38 EST
The vertical style fails when orientation RIGHT_TO_LEFT is set. I'm using the latest Eclipse Neon version under Ubuntu.

Linux openchrom 4.4.0-59-generic #80-Ubuntu SMP Fri Jan 6 17:47:47 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

// Works fine
Slider slider = new Slider(composite, SWT.HORIZONTAL);
sliderHorizontal.setOrientation(SWT.LEFT_TO_RIGHT);

// Works fine
Slider slider = new Slider(composite, SWT.HORIZONTAL);
sliderHorizontal.setOrientation(SWT.RIGHT_TO_LEFT);

// Works fine
Slider slider = new Slider(composite, SWT.VERTICAL);
sliderHorizontal.setOrientation(SWT.LEFT_TO_RIGHT);

// Fails
Slider slider = new Slider(composite, SWT.VERTICAL);
sliderHorizontal.setOrientation(SWT.RIGHT_TO_LEFT);

Who has an idea why it fails?
Comment 1 Alexander Kurtakov CLA 2017-02-08 11:15:23 EST
What does fails exactly means?
Comment 2 Philip Wenig CLA 2017-02-08 16:19:52 EST
When working in horizontal modus, SWT.RIGHT_TO_LEFT works as expected. On the left side is the highest value and on the right side the lowest value. Values are incremented when sliding from RIGHT to LEFT and decremented when sliding from LEFT to RIGHT.

So far, so good.

When using the slider in SWT.VERTICAL + SWT.RIGHT_TO_LEFT modus, I would assume that the top side represents the highest value and the the bottom side represents the lowest value. Values shall be incremented when sliding from BOTTOM to TOP and decremented when sliding from TOP to BOTTOM then.

Instead, setting the orientation in SWT.VERTICAL seems to have no effect at all. I also had a look if there is such constant like SWT.BOTTOM_TO_TOP in SWT, but I didn't find it.

Maybe, two new constants could be added to make the functionality better comprehensible:

Slider slider = new Slider(composite, SWT.VERTICAL);

sliderVertical.setOrientation(SWT.TOP_TO_BOTTOM); // SWT.LEFT_TO_RIGHT
and
sliderVertical.setOrientation(SWT.BOTTOM_TO_TOP); // SWT.RIGHT_TO_LEFT
Comment 3 Himanshu Balasamanta CLA 2020-03-21 22:43:27 EDT
Hello,
I studied the SWT widgets Slider,Control and Widget over how a slider is constructed and how the orientation is set. 
More often than not SWT has a difference between HORIZONTAL and VERTICAL style of Slider.

For instance, only for Slider set HORIZONTAL, the 

GTK.gtk_range_set_inverted (handle,boolean) is called.


The Control class too sets for both HORIZONTAL and VERTICAL, the 

GTK.gtk_widget_set_direction( handle, int)

with GTK.GTK_TEXT_DIR_RTL or GTK.GTK_TEXT_DIR_LTR as int parameter.

I think a good start point could be to investigate
GTK.gtk_scrollbar_new (GTK.GTK_ORIENTATION_HORIZONTAL, hAdjustment);


I am willing to take this up, but I need

1) Proper GTK documentation, or guide...
   https://wiki.eclipse.org/SWT/Devel/Gtk/Dev_guide#About_GTK 

2) If someone could, then please email himanshubb.eee18@itbhu.ac.in an example each of Slider( both HORIZONTAL and VERTICAL) and a Scrollbar example... The SWT examples are not particularly clear....
Comment 4 Philip Wenig CLA 2020-03-30 11:00:49 EDT
Created attachment 282271 [details]
Slider vertical
Comment 5 Philip Wenig CLA 2020-03-30 11:01:06 EDT
An example of the case can be inspected when using Eclipse SWTChart:
https://github.com/eclipse/swtchart

Activate the vertical scrollbar, e.g. in LineSeries4:
org.eclipse.swtchart.extensions.examples.parts.LineSeries_4_Part

IChartSettings chartSettings = getChartSettings();
chartSettings.setVerticalSliderVisible(true);
applySettings(chartSettings);

Activate to set the scrollbar in ChartSettings:
org.eclipse.swtchart.extensions.core.ChartSettings

@Override
public void setVerticalSliderVisible(boolean verticalSliderVisible) {

	this.verticalSliderVisible = verticalSliderVisible;
}

The horizontal slider works fine. The vertical slider moves the chart in the opposite direction.

If this slider functionality is intended by the platform, then we would try to handle this inside of Eclipse SWTChart.
Comment 6 Philip Wenig CLA 2020-03-30 11:02:02 EDT
Created attachment 282272 [details]
Slider horizontal
Comment 7 Himanshu Balasamanta CLA 2020-03-31 07:49:18 EDT
Could someone tell me if this issue is there on the other two platforms as well? And if it is, weather Just solving it on linux will be sufficient to get the pull request merged into SWT? I shall try for the other two platforms as well otherwise.