I have a tall but narrow image displayed, which requires a vertical scroll bar. All works OK, except that the scroll bar frequently 'flashes' between grey and grey with black dots. This is very distracting.
What causes this 'flashing' and how to stop it please? Using BDS C++ under Win XP.
Regards, David
Scroll Bar Flashing
Re: Scroll Bar Flashing
Hi,
Solution: Force your application to use the XP theme. Unfortunately, I don't know how to do that using BSD C++ but I think this information can easily be found using google or BSD newsgroups.
Best regards,
Loïc
Cause: A bug within the environment of development used to build GdViewer...What causes this 'flashing' and how to stop it please
Solution: Force your application to use the XP theme. Unfortunately, I don't know how to do that using BSD C++ but I think this information can easily be found using google or BSD newsgroups.
Best regards,
Loïc
Re: Scroll Bar Flashing
The issue is that the library is setting focus to the scroll bars which according to Microsoft is a no-no.
My solution is to stop focus from being given to the scrollbars when the control gets focus.
You can subclass the control with MFC and override the OnSetFocus() handler and add the following code.
Not sure why the engineers here could not come up with a simple work around but this is how I handled it and it seems to work 99.9% of the time.
Hope this helps.
My solution is to stop focus from being given to the scrollbars when the control gets focus.
You can subclass the control with MFC and override the OnSetFocus() handler and add the following code.
Code: Select all
void CGdViewerWnd::OnSetFocus(CWnd* pOldWnd)
{
// fix scrollbar flashing by not allowing focus to be given to the scrollbar
// in the first place (hide them, give view focus, reshow them)
// see if the scrollbars are present on the viewer
CWnd* pVScroll = FindWindowEx(GetSafeHwnd(), NULL, "ThunderRT6VScrollBar", NULL);
CWnd* pHScroll = FindWindowEx(GetSafeHwnd(), NULL, "ThunderRT6HScrollBar", NULL);
// see if the scrollbar is currently visible on the viewer
BOOL bVScrollVisible = (pVScroll) ? pVScroll->IsWindowVisible() : FALSE;
BOOL bHScrollVisible = (pHScroll) ? pHScroll->IsWindowVisible() : FALSE;
// if the scrollbar is visible, hide it while we change focus
if(bVScrollVisible) pVScroll->ShowWindow(SW_HIDE);
if(bHScrollVisible) pHScroll->ShowWindow(SW_HIDE);
// let the activeX control get the focus
// focus cannot be given to scrollbars if they are hidden
__super::OnSetFocus(pOldWnd);
// if the scrollbar was hidden by us, show them again
if(bVScrollVisible) pVScroll->ShowWindow(SW_SHOW);
if(bHScrollVisible) pHScroll->ShowWindow(SW_SHOW);
}
Hope this helps.
Who is online
Users browsing this forum: No registered users and 1 guest