Posted 16 years ago by Jake Pearson - Software Developer, Alion Science and Technology
Avatar
Hi,
Support, feel free to ignore this message, but if anyone has an idea please let me know.

I am working on having a set of SyntaxEditor's share the same scroll bar. Basically we are stacking a few syntax editors in the same parent panel, when one editor gets taller it pushes down the editors below. This link points at a screen shot of my editors. The problem is typing in one of the syntax editors does not scroll the parent panel. I found an article on scrollbars on code project. I put some code into my editor like this:

private int lastLineCount = 1;
private void cSharpEditorCode_DocumentTextChanged(object sender, ActiproSoftware.SyntaxEditor.DocumentModificationEventArgs e)
{
    UpdateHeights();
    this.enableChangeEvents = false;
    CodeProperty.SetValue(PropertyParent, cSharpEditorCode.Text, null);
    this.enableChangeEvents = true;
    if(lastLineCount != e.Document.Lines.Count)
    {
        int lineDelta = e.Document.Lines.Count - lastLineCount;
        ExpandableEditorList list = Parent as ExpandableEditorList;
        if(list == null)
        {
            return;
        }
        list.AutoScrollVerticalPosition += lineDelta*Editor.LineHeight;
        lastLineCount = e.Document.Lines.Count;
    }
}
The "AutoScrollVerticalPosition" property calls some Win32 methods like this:

public int AutoScrollVerticalPosition
{
    get { return GetScrollPos(this.Handle, (int)SB_VERT); }
    set 
    { 
        SetScrollPos(this.Handle, (int)SB_VERT, value, true);
        SetDisplayRectLocation(DisplayRectangle.X, -value);
    }
}

[DllImport("user32.dll")]
private static extern int SetScrollPos(System.IntPtr hWnd, int nBar, int nPos, bool bRedraw);
It works ok for the first few returns, but eventually it quits scrolling down. Does anyone have an idea what I am doing wrong?

thanks,
Jake

Comments (2)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Jake,

I'm a little confused... are you trying to scroll to a different first display line within the SyntaxEditor view for all the editor instances or do you mean that you're scrolling the whole group of SyntaxEditor controls as a Panel up and down?


Actipro Software Support

Posted 16 years ago by Jake Pearson - Software Developer, Alion Science and Technology
Avatar
Hi,
I am trying to accomplish the second. I will send you my test app, but as I said feel free to ignore this. There is certainly nothing wrong with the syntax editor.

If anyone else would like to look at my program, please post your email and I will send it over to you.

thanks,
Jake
The latest build of this product (v21.1.0) was released 19 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.