Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Syntax Edit
  New Posts New Posts RSS Feed - RecalcScrollBars - Doesn't.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

RecalcScrollBars - Doesn't.

 Post Reply Post Reply
Author
Message
Algae View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 January 2007
Location: United States
Status: Offline
Points: 217
Post Options Post Options   Thanks (1) Thanks(1)   Quote Algae Quote  Post ReplyReply Direct Link To This Post Topic: RecalcScrollBars - Doesn't.
    Posted: 27 December 2015 at 2:52pm
This problem has been around for awhile.

RecalculateScrollBars fails to adjust Horizontally after loading more than one file. The thumb size is wrong and the horizontal scroll area does not change.

The Culprit!

void CXTPSyntaxEditCtrl::_RecalcHScrollMaxWidth()
{
    CRect rcText = m_pDrawTextProcessor->GetTextRect();
    int nPageX = rcText.Width();

    int nMaxX = m_pDrawTextProcessor->GetRowsMaxWidth();
    nMaxX += max(nPageX/4, m_pDrawTextProcessor->GetTextMetrics().tmAveCharWidth * 20);
    nMaxX = max(nMaxX, rcText.Width() * 2);

// Replace this line
//    m_nHScrollMaxWidth = max(nMaxX, m_nHScrollMaxWidth);
// with this and things start to work.
    m_nHScrollMaxWidth = nMaxX;
}

The value of GetRowsMaxWidth() seems to be the right "max" if the text is > client rect width. I have tested a few scenarios with the change and the scrolling appears to function normally.

To Reproduce:

1. Use a Static Unicode build.
2. Use a dialog containing a SyntaxEditCtrl. I used this method to add the control to the dialog:
VERIFY(m_ctrlSynEdit.SubclassDlgItem(IDC_SYNTAX_EDIT, this));
3. Load a file that has a really long text line (not wrapped).
Result: Both scrollbars are calculated properly.
Load another file with shorter lines than the first file. Do not perform any scrolling.
Result: The Vertical scrollbar calculates properly but the Horizontal scrollbar does not change. It is still way beyond the text extent of the newly loaded file.
Load another file with only one short line.
Result: The Horizontal scrollbar still does not change.

I compared 16.26 against v17.0.0.081715 Beta and it looks pretty much the same so I would say - Not Fixed yet.

Some other issues with control in dialog.

1. Doesn't appear to support mouse wheel, you have to add your own handler.
2. Context menu handling is clunky and you have to put a lot of effort into making one work. Most would expect context menu handling to be more like an Edit Box.
3. The schema handling is not well explained anywhere that I know of.
4. Syntax colors do not always display correctly. It's hit or miss.

I would suggest adding some finishing touches to the editor and provide a dialog based example to the toolkit to bring it to the level of quality expected for CJ controls.


Back to Top
olebed View Drop Down
Admin Group
Admin Group
Avatar

Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 660
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 10 June 2016 at 12:54pm
Hello Algae,

Thank you for bringing this to our attention. The fix of _RecalcHScrollMaxWidth() will be available in the next beta or final release.

I will look at other issues later.

Regards,
 Oleksandr Lebed
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.078 seconds.