I have a list control and disable the scroll bar using the following code.
InitializeFlatSB(this->m_hWnd);
FlatSB_EnableScrollBar(this->m_hWnd, SB_BOTH, ESB_DISABLE_BOTH);
The scroll bars don't disappear, they just become white, which is what I need because I want to redraw my own scroll bars on their original rectangle region. In that way, my own scroll bars won't cover the list content and I can add functionality so that the mouse wheel function will be enabled.
But now how can I get the rectangle region of the scroll bars?
As suggested in the comments, can you try to deduce the rectangle from GetWindowRect and GetClientRect? It seems to be a easy calculation to do subtractions and get a Non Client rectangle for the Vertical scroll bar and another for the Horizontal.
Related
I have a rectangle popup near the NavigationList sidebar (black area on the left)
How can I trigger the Side bar resizing when I drag this rectangle? I want to be able to resize not only from the edge of the side bar, but also from this rectangle (since the sidebar may disappear) SwiftUI.
I want to resize the side bar with the rectangle drag in the same way we resize it via dragging its edge.
Let's say you have a resizable window with child scrollbar controls, and the scrollbars come and go depending on whether the window contents are large enough to require scrolling.
When both scrollbars are present, a small rectangle is effectively created in the bottom right corner of the window, at their intersection. Is there a clean strategy for clipping that rectangle when drawing on the window, so that you don't paint on it?
I guess my current approach is to obtain the rectangles for each scrollbar, and if those rectangles are not null, then use the rectangles' locations to determine the rectangle that we want to clip. And then call ExcludeClipRect for that rectangle. I guess a similar approach could be used, except with GetSystemMetrics(SM_CXVSCROLL) and GetSystemMetrics(SM_CYVSCROLL) to get the rectangle dimensions.
But is there a more accepted way of doing this, perhaps using some helpful clipping API functions? Thank you for any input.
I am using wxfreechart to generate a chart from my input dataset. The bottom axis is a DateAxis and the left axis is a NumberAxis. I was able to set scroll bar for my bottom axis. I need to set scroll bar for left axis too.. Adding it using setscrolledaxis() creates the scroll bar, but the chart becomes very unclear with no labels and all. Can anybody help me :(
Also the scrolling doesn't happen unless scroll bar is dragged using mouse.Clicking on the scroll arrows moves the scroll bar very slowly, but the chart window does not move accordingly. Any solution?
I have a window inherited from CScrollView that handles WM_PAINT and displays a graph. This graph has elements of different types and type of element is marked by the shape of element.
I want to display some legend so that user knows what each shape means. Since user will not look at this legend often the idea is that in the upper right corner of the view control there will be a small icon. When user moves the mouse over this icon it will expand into small rectangle displaying the legend of shapes used in graph. When mouse is moved outside this rectangle it will collapse back to small icon.
This is what I have tried so far:
Draw the hotspot icon and legend rectangle using GDI in handler of WM_PAINT of view class.
Implement hotspot as a separate window that is created as a child of a scroll view.
Implement hotspot as a separate window but create it as a popup window with no parent.
Version 1 and 2 behave strangely if user scrolls the graph view.
In version 1 I can see artifacts (button is smeared across the view) while performing scroll I guess that during the scroll existing image is not invalidated but only moved.
In version 2 there is no smearing but I need to move the child window whenever I get VM_HSCROLL and WM_VSCROLL messages and these messages are not precise enough to be used this way. During scroll I can see my button moving couple of pixels and then jumping to correct position.
Version 3 is the most disturbing and because legend is not child of a graph view I get some strange behaviour where legend button is displayed even when graph view is not shown and I think that there are too many problems with this one to be viable development path to invest time in.
I think that the version 2 is the most promising but I need to find a way to make a child window stay at one place during scroll.
Did anyone have success in implementing something like this? Is there some other implementation I can investigate?
CScrollView has OnScrollBy virtual method that scrolls the entire client area of view control. You can override this method and implement your own scroll functionality.
::ScrollWindowEx has a parameter prcScroll that can specify only a portion of client area that will be scrolled.
New OnScrollBy splits client area into 4 stripes and calls ::ScrollWindowEx for each one of them.
These stripes are:
client area above icon (rectangle width across entire client area)
client area on the left of icon (rectangle height same as icon)
client area on the right of icon (rectangle height same as icon)
client area underneath icon (rectangle width across entire client area)
1 1 1 1 1
2 2 2 * 3
4 4 4 4 4
4 4 4 4 4
After scrolling all individual client rectangles, just invalidate client area where icon is located.
You may just simply use
CPoint GetScrollPosition( ) const;
method to obtain current scroll position of scroll view and recalculate your 'static' label offset accordingly.
BTW: Instead of WM_PAINT use CScrollView's method
virtual void OnDraw( CDC* pDC );
it's important
In Qt, I have a QScrollArea that has some content in it that can scroll vertically but should never, ever be allowed to scroll horizontally. Even if I disable the H scrollbars from showing, a mouse that has a scroll wheel (or touch pad) that supports horizontal motion will make it move a little bit side to side.
Now, this may partly be a layout issue... but nothing is actually off the screen.
It's probably a cop-out, but is there a way to just "lock" the scroll area from behind able to move horizontally at all?
scrollArea->verticalScrollBar()->setEnabled(false);
scrollArea->horizontalScrollBar()->setEnabled(false);
For your QScrollArea you need filter QEvent::Wheel in eventFilter method or overload wheelEvent(QWheelEvent* event) method.
Other way is create widget inherited from QWidget with overloaded eventFilter only and apply its filter to your scroll area:
scrollArea->viewport()->installEventFilter(someFilterWidget);
Did you try to set the scroll bar policy ?
myScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
http://qt-project.org/doc/qt-4.8/qabstractscrollarea.html#horizontalScrollBarPolicy-prop