Scrollbars don't work with many large columns |
Post Reply |
Author | |
Sergio
Senior Member Joined: 18 September 2006 Status: Offline Points: 216 |
Post Options
Thanks(0)
Posted: 29 April 2009 at 6:30am |
Hello, The report control scrollbars don't work correctly if the total width of columns exceed approximately 30000 pixels. We are still using Codejock Version 12.0.1 (we will upgrade to the next version within one or two months). Could you please check it and give us any feedback ? Regards, |
|
Sergio
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Just to give you potential idea - in some places bitmap used and function to allocate bitmap:
CBitmap bmpCache; VERIFY(bmpCache.CreateCompatibleBitmap(pDC, W, H)); this function works only with W and H < 64K
So do your math with your so practical model with billions of columns
Also scrollbars have own restrictions
|
|
Sergio
Senior Member Joined: 18 September 2006 Status: Offline Points: 216 |
Post Options
Thanks(0)
|
Thank you for your answer.
Yes, I agree with you for bitmaps, but I was speaking about scrollbars. When you have large views, you must use scrollbars differently : * Add member variables to your window : - int m_nViewOffsetX; - int m_nViewOffsetY; - int m_nTotalViewWidth; - int m_nTotalViewHeight; * When the total width/height is larger than 30000 pixels, use the scrollbar as a percentage of the m_nTotalViewWidth/Height * The scrollbar events : SB_LINEUP, ... modify the internal m_nViewOffsetX/Y variable and readjust the scrollbar position upon the percentage if the total width/height is larger than 30000 pixels Doing so, you will be able to manage small and very large views using standard scrollbars. Hope you will understand what I mean. Regards, |
|
Sergio
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Right - sure - recent code only considered practical values - like few total witdh. Need to adjust for such extrema cases
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Don't be too cocky. 30000 px is indeed a realistic value! I've been working with software that occupies up to FOUR mega-sized displays, for pathology etc.
Of course, support for this is an overkill, but I would still keep this in mind.
|
|
PokerMemento - http://www.pokermemento.com/
|
|
Sergio
Senior Member Joined: 18 September 2006 Status: Offline Points: 216 |
Post Options
Thanks(0)
|
Yes, I know that's an extreme case, but we have it.
We have two big lists with many columns inserted in one big report control for a kind of comparator. In order to help you to enhance your report control more quickly, here is the kind of code needed : // Return the maximum range of windows scroll bars int GetScrollbarsRangeMax() { return 30000; } // Set scroll bar data information, do not substract iPageSize from iPosMax // pWnd = Window owning the scrollbars BOOL SetScrollbarDataInfo(CWnd* pWnd, BOOL bHorizontalScrollbar, BOOL bForceShowDisabled, int iPos, int iPosMax, int iPageSize) { HWND hwnd = pWnd->GetSafeHwnd(); if ( !::IsWindow( hwnd ) ) return FALSE; // Update scroll bars SCROLLINFO info; int iScrollbarsRangeMax = gGUI.GetScrollbarsRangeMax(); if ( bForceShowDisabled ) { ::memset( &info, 0, sizeof( info ) ); info.cbSize = sizeof( info ); info.fMask = SIF_RANGE | SIF_PAGE | SIF_POS; info.nMin = 0; info.nMax = 2; info.nPage = 5; info.nPos = 0; if ( bHorizontalScrollbar ) { ::ShowScrollBar( hwnd, SB_HORZ, TRUE ); ::SetScrollInfo( hwnd, SB_HORZ, &info, TRUE ); ::EnableScrollBar( hwnd, SB_HORZ, ESB_DISABLE_BOTH ); } else { ::ShowScrollBar( hwnd, SB_VERT, TRUE ); ::SetScrollInfo( hwnd, SB_VERT, &info, TRUE ); ::EnableScrollBar( hwnd, SB_VERT, ESB_DISABLE_BOTH ); } } else { if ( iPosMax <= iPageSize ) { // Hide the scroll bar if ( bHorizontalScrollbar ) ::ShowScrollBar( hwnd, SB_HORZ, FALSE ); else ::ShowScrollBar( hwnd, SB_VERT, FALSE ); } else { // Show the scroll bar if ( bHorizontalScrollbar ) ::ShowScrollBar( hwnd, SB_HORZ, TRUE ); else ::ShowScrollBar( hwnd, SB_VERT, TRUE ); if ( iPosMax >= iScrollbarsRangeMax ) { // Process the scroll bar differently if the total display height is too big if ( bHorizontalScrollbar ) ::EnableScrollBar( hwnd, SB_HORZ, ESB_ENABLE_BOTH ); else ::EnableScrollBar( hwnd, SB_VERT, ESB_ENABLE_BOTH ); ::memset( &info, 0, sizeof( info ) ); info.cbSize = sizeof( info ); info.fMask = SIF_RANGE | SIF_PAGE | SIF_POS; info.nMin = 0; info.nMax = iScrollbarsRangeMax; info.nPage = 1; info.nPos = iScrollbarsRangeMax * iPos / ( iPosMax - iPageSize ); if ( bHorizontalScrollbar ) ::SetScrollInfo( hwnd, SB_HORZ, &info, TRUE ); else ::SetScrollInfo( hwnd, SB_VERT, &info, TRUE ); } else { // Process the scroll bar normally ::memset( &info, 0, sizeof( info ) ); info.cbSize = sizeof( info ); info.fMask = SIF_RANGE | SIF_PAGE | SIF_POS; info.nMin = 0; info.nMax = iPosMax; info.nPage = iPageSize; info.nPos = iPos; if ( bHorizontalScrollbar ) ::EnableScrollBar( hwnd, SB_HORZ, ESB_ENABLE_BOTH ); else ::EnableScrollBar( hwnd, SB_VERT, ESB_ENABLE_BOTH ); if ( bHorizontalScrollbar ) ::SetScrollInfo( hwnd, SB_HORZ, &info, TRUE ); else ::SetScrollInfo( hwnd, SB_VERT, &info, TRUE ); } } } return TRUE; } // Process OnHScroll(...) & OnVScroll(...) and return the new scroll bar position // // Example : // //void CWndName::OnHScroll(UINT nSBCode, UINT nPos, //CScrollBar* pScrollBar) //{ // CRect r; // GetClientRect( &r ); // // SetViewOffsetXY( // ProcessOnVHScroll( nSBCode, nPos, m_iDisplayPosX, m_iMinimumDisplaySizeX, r.Width(), m_iScrollbarsStepSize ), // m_iDisplayPosY ); // // CWnd::OnHScroll(nSBCode, nPos, pScrollBar); //} // //void CWndName::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) //{ // CRect r; // GetClientRect( &r ); // // SetViewOffsetXY( // m_iDisplayPosX, // ProcessOnVHScroll( nSBCode, nPos, m_iDisplayPosY, m_iMinimumDisplaySizeY, r.Height(), m_iScrollbarsStepSize ) ); // // CWnd::OnHScroll(nSBCode, nPos, pScrollBar); //} // int ProcessOnVHScroll(UINT nSBCode, UINT nPos, int iPos, int iPosMax, int iPageSize, int iStepsSize) { int iMaxPos = iPosMax - iPageSize; int iCurPos = iPos; int iScrollbarsRangeMax = gGUI.GetScrollbarsRangeMax(); if ( iPosMax > iScrollbarsRangeMax ) { iMaxPos = iScrollbarsRangeMax; } // Determine the new position of scroll box switch( nSBCode ) { case SB_TOP: // Scroll to far top iCurPos = 0; break; case SB_BOTTOM: // Scroll to far bottom iCurPos = iMaxPos; break; case SB_ENDSCROLL: // End scroll break; case SB_LINEUP: // Scroll up iCurPos -= iStepsSize; break; case SB_LINEDOWN: // Scroll down iCurPos += iStepsSize; break; case SB_PAGEUP: // Scroll one page up iCurPos -= iPageSize; break; case SB_PAGEDOWN: // Scroll one page down iCurPos += iPageSize; break; case SB_THUMBPOSITION: // Scroll to absolute position. nPos is the position of the scroll box at the end of the drag operation if ( iPosMax > iScrollbarsRangeMax ) iCurPos = nPos * ( iPosMax - iPageSize ) / iScrollbarsRangeMax; else iCurPos = nPos; break; case SB_THUMBTRACK: // Drag scroll box to specified position. nPos is the position that the scroll box has been dragged to if ( iPosMax > iScrollbarsRangeMax ) iCurPos = nPos * ( iPosMax - iPageSize ) / iScrollbarsRangeMax; else iCurPos = nPos; break; } iCurPos = min( iCurPos, iPosMax - iPageSize ); return iCurPos; } Regards, |
|
Sergio
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
OK - what prevent you to use your own scroll support in the View your Report belong to? You don't need to use built-in Horizontal Scrollbar.
You can use your own steps - e.g. on case SB_LINEUP and case SB_LINEDOWN can be treat as 1 or 10 or 100 columns jump
|
|
Sergio
Senior Member Joined: 18 September 2006 Status: Offline Points: 216 |
Post Options
Thanks(0)
|
I took a look at your code and you should not use value "nPos" of the OnHScroll(...)/OnVScroll(...). This value is limited to 16 bits due to the Windows message.
In the OnHScroll(...) & OnVScroll(...) methods, I think you just have to retrieve this value using the GetScrollInfo(...) which will give you a 32 bits value. We don't make this change because we don't want to have any conflicts with your future changes. Regards, |
|
Sergio
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Right - I think our scroolbar based on 16 bit restriction. I don't propose you to modify Core but make desired implementation on App level.
|
|
Sergio
Senior Member Joined: 18 September 2006 Status: Offline Points: 216 |
Post Options
Thanks(0)
|
Ok, we will do your job and fix your OnHScroll(...) & OnVScroll(...).
Regards, |
|
Sergio
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Very good - if you make a simple test case I can try it and if it properly supported any scroll size - we can use it in the Core - I should be sure that it will also works in ActiveX (e.g. for old VB6)
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
In some moment you was interested in Expand-Collapse action with all deep levels covered - I propose you to test current app but you did not try?
|
|
Sergio
Senior Member Joined: 18 September 2006 Status: Offline Points: 216 |
Post Options
Thanks(0)
|
Could you please give me the reference of that post (the link) ?
------ Take a look in the Microsoft MSDN Library - Visual Studio 2008 - CWnd::OnHScroll(...), their example uses 32 bits values with correct implementation (look at the curpos variable). The new code will work as the previous one, but will just use a 32 bits value as input instead of 16 bits. Just do this kind of change to your code (do the same for OnVScroll(...)) : Your code : void CXTPReportControl::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { if (pScrollBar != NULL) { CWnd::OnHScroll(nSBCode, nPos, pScrollBar); return; } int nCurPos = m_nLeftOffset; ... 32 bits fix : void CXTPReportControl::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { if (pScrollBar != NULL) { CWnd::OnHScroll(nSBCode, nPos, pScrollBar); return; } // Use 32 bits scrollbar position instead of 16 bits - End nPos = GetScrollPos(SB_HORZ); int nCurPos = m_nLeftOffset; ... Hope you will agree now and see that you will have no further impacts. Regards, |
|
Sergio
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
it was 2 different threads - http://forum.codejock.com/forum_posts.asp?TID=13387 (about multi-selection)
and it was another thread about the problem with expand all function which not covered full deep of hierarchy but I can't find it now?
|
|
Sergio
Senior Member Joined: 18 September 2006 Status: Offline Points: 216 |
Post Options
Thanks(0)
|
For the first thread, I thought it was ended and closed. I will look and give you an answer soon.
For the second one, we solved it like that (I can't retrieve it too.) : BOOL COverridenXTPReportControl::FFullExpandAll() { //ExpandAll(); <-------- 22.03.2007 - Doesn't work properly (only one level is expanded) CXTPReportRows* pRows = GetRows(); if (pRows) { CXTPReportRow* pRow; for (int i=0; i<pRows->GetCount(); i++) { pRow = pRows->GetAt(i); if (pRow && pRow->HasChildren() && !pRow->IsExpanded()) { pRow->SetExpanded(TRUE); } } return TRUE; } return FALSE; } Regards, |
|
Sergio
|
|
Sergio
Senior Member Joined: 18 September 2006 Status: Offline Points: 216 |
Post Options
Thanks(0)
|
I never posted the ExpandAll() query.
It was someone else : https://forum.codejock.com/forum_posts.asp?TID=13445&KW=expandall I found the clue by myself. |
|
Sergio
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Thanks, Sergio.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |