[Gantt] Workaround for scrollbars [message #60081] |
Fri, 10 October 2008 15:47 |
Laurent Marchal Messages: 91 Registered: July 2009 |
Member |
|
|
This is a multi-part message in MIME format.
--------------070004050802020207070500
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Hi gantt users !
I have found a workaround to re-set the scroll bar location after a refresh.
It seems that during the gantt redraw, the scrollbar's selection value
is not used to draw, so programmatically changing the scrollbar
selection will be taken into account.
The workaround simply send a fake event saying the scrollbar changed
it's selection.
+1 for a GanttComposite.refresh(boolean restoreScrollBars).
Laurent Marchal.
--------------070004050802020207070500
Content-Type: text/x-java;
name="fix.java"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="fix.java"
ScrollBar vScrollBar = _ganttChart.getGanttComposite().getVerticalBar();
int vScroll = vScrollBar != null ? vScrollBar.getSelection() : 0;
// do what you need
// restore scroll status
if (vScrollBar != null) {
vScrollBar.setSelection(vScroll);
}
//refresh the chart
_ganttChart.getGanttComposite().refresh();
// send events to force refresh
Event event = new Event();
// needed !
event.detail = 1;
vScrollBar.notifyListeners(SWT.Selection, event);
--------------070004050802020207070500--
|
|
|
Powered by
FUDForum. Page generated in 0.02588 seconds