Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CFormView and ScrollBars
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CFormView and ScrollBars

 Post Reply Post Reply
Author
Message
AliRafiee View Drop Down
Groupie
Groupie


Joined: 06 May 2004
Status: Offline
Points: 32
Post Options Post Options   Thanks (0) Thanks(0)   Quote AliRafiee Quote  Post ReplyReply Direct Link To This Post Topic: CFormView and ScrollBars
    Posted: 06 May 2004 at 4:10pm

Hi,

I have an MDI application, trying to use Office2003 theme.  The application's View is a CXTTabView, and in the OnInitialUpdate I add a couple of views (CFormView) to the CXTTabView.  If I resize the view so that the scrollbars show up, they flicker between gray and blue scrollbars, once I stop it displays the gray ones until I click on each part of the scroll bars, and at that point it redraws them in blue.

What am I doing wrong here?

Thanks

Ali

Back to Top
LarryWaugh View Drop Down
Newbie
Newbie


Joined: 25 May 2004
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote LarryWaugh Quote  Post ReplyReply Direct Link To This Post Posted: 18 November 2004 at 3:52pm
This is a very ANNOYING problem. Does CodeJock have any input on this situation??
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 18 November 2004 at 11:32pm

it is OS xp bug. Remove scrollbars:

void CSimpleForm::OnInitialUpdate()
{
 CFormView::OnInitialUpdate();
 
 SetScaleToFitSize(CSize(0));
 
}

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
LarryWaugh View Drop Down
Newbie
Newbie


Joined: 25 May 2004
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote LarryWaugh Quote  Post ReplyReply Direct Link To This Post Posted: 19 November 2004 at 8:26am

Adding SetScaleToFitSize(CSize(0)); causes a Debug Assertion Failed in wingdi.cpp at line 454.

This is a CXTResizeFormView derived class in a CXTSplitterWnd.

Back to Top
AliRafiee View Drop Down
Groupie
Groupie


Joined: 06 May 2004
Status: Offline
Points: 32
Post Options Post Options   Thanks (0) Thanks(0)   Quote AliRafiee Quote  Post ReplyReply Direct Link To This Post Posted: 19 November 2004 at 10:05am

Larry

Change the line to

SetScaleToFitSize(CSize(1,1));

to get rid of the asserts, but doesn't solve the problem, it looks like a microsoft bug!

 

Oleg,

For me that doesn't solve the problem, it just simply hids the scrollbar.

 

Back to Top
robin_l View Drop Down
Senior Member
Senior Member


Joined: 15 October 2006
Status: Offline
Points: 117
Post Options Post Options   Thanks (1) Thanks(1)   Quote robin_l Quote  Post ReplyReply Direct Link To This Post Posted: 05 May 2007 at 9:44am
I've struggled with this for a long time and have come up with a solution that others might find useful. It seems that if you set the WS_VSCROLL and WS_HSCROLL styles then this ensures the themed scrollbars are used. However, you need to then ensure that these flags are restored to the original values (or resizing doesn't work properly).  In your OnInitialUpdate code add the following before you do anything else:
 
BOOL bisV = (GetStyle() & WS_VSCROLL)!= 0;
BOOL bisH = (GetStyle() & WS_HSCROLL)!= 0;
// add scroll bars to ensure that themed ones are used later
// overcomes windows bug (XP)
ModifyStyle( 0, WS_HSCROLL | WS_VSCROLL );

// remove / put them back correctly
ModifyStyle( WS_HSCROLL | WS_VSCROLL, (bisH ? WS_HSCROLL : 0) | (bisV ? WS_VSCROLL : 0) );
 
ModifyStyle(0, WS_CLIPCHILDREN|WS_CLIPSIBLINGS);
Back to Top
countersa08 View Drop Down
Newbie
Newbie


Joined: 23 June 2007
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote countersa08 Quote  Post ReplyReply Direct Link To This Post Posted: 23 June 2007 at 11:12pm
Thank you for this solution.  It fixed my problem too!
Back to Top
tomay3000 View Drop Down
Groupie
Groupie
Avatar

Joined: 08 December 2010
Location: Algeria
Status: Offline
Points: 56
Post Options Post Options   Thanks (0) Thanks(0)   Quote tomay3000 Quote  Post ReplyReply Direct Link To This Post Posted: 31 October 2013 at 9:58pm
nice trick ;)

this also could work:

DWORD dwStyle = ::GetWindowLong(m_hWnd, GWL_STYLE);
::SetWindowLong(m_hWnd, GWL_STYLE, WS_HSCROLL | WS_VSCROLL);
::SetWindowLong(m_hWnd, GWL_STYLE, dwStyle);
Product: Codejock ToolkitPro MFC v16.2.0
Platform: Microsoft Windows 8 Pro (64-bit)

Language: Microsoft Visual C++ v6.0 (MFC)
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.047 seconds.