Print Page | Close Window

RecalcScrollBars - Doesn't.

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Syntax Edit
Forum Description: Topics Related to Codejock Syntax Edit
URL: http://forum.codejock.com/forum_posts.asp?TID=22827
Printed Date: 03 December 2024 at 12:46pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: RecalcScrollBars - Doesn't.
Posted By: Algae
Subject: RecalcScrollBars - Doesn't.
Date 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.





Replies:
Posted By: olebed
Date 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net