June 21, 2024, 02:09:46 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Dual Scrollbars in RichEdit

Started by RitchieF, November 16, 2013, 12:35:22 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

RitchieF

Since I don't want to hijack Brian's thread (http://www.ionicwind.com/forums/index.php?topic=4958.0) I started a new one.

Larry:
QuoteWith all the messages that are available to richedits I would have to say yes(for the most part)
It would really come down to the specifics of what you are trying to do(and I do mean SPECIFIC).

Well Larry,
I have two richedit controls with vertical scroll bars and I load the same nc-code file into both controls.

The user can start a conversion of the nc-code which works only in specific lines in the right control. After the conversion I set those lines to a different but same color in both controls to show the changed lines.

And if now the user scrolls down in one control (no matter which one) to show the whole code the other control should scroll simultaneous down or up 

Hope this is explained well and specific enough

Thanks for your help

Richard

LarryMc

Understand.
May take me a while to work up an example.  For part of it the richedits will need to be subclassed and part will be handled by @IDCONTROL messages, I think.

That's because richedits can be scrolled with the mouse left button, mouse scroll button, keyboard arrow keys(pageup/down keys) and by hitting enter on the last visible line in the edit window.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

The attached demo program contains a window with two richedit controls of the same physical size(important)
Also included in the attached is a text  file with cnc commands(not important)

When the demo is ran the text file will be loaded into both richedits.
If the user does anything to cause either richedit to scroll vertically the other richedit will track the vertical movement.

The richedit on the left is considered the master(for editing purposes) and the one on the right is the slave(or reference).
In the demo the right richedit really should be made readonly.

When any change to a line in the RE on the left the entire line color will change to red.  The corresponding line in left RE will also turn red.
The idea being that when the left RE is modified the changed line in both edits will be hilited with color to indicate there is a difference.
Ultimately the left RE would be saved with the desired changes(preferably with a different name)

If a line is changed( and the lines in both REs changed to red) and its then changed back so that the lines match in both REs then the color of both will change back to black.
This works unless the original change was a CR(inserting a blank line) and then it is removed.  The left RE won't correct.
I'll leave figuring that out to any potential users.

There are some limitations;
The scrolling functions work for a max of 65,535 lines( 0xFFFF)
The REs can not use wordwrap.
The max length of lines is 255( but that can be modified with a slight change in the program.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

RitchieF

Larry,

thanks for your help. Works like I want it.

But how to integrate it in my project ?

Why doesn't this work with Getscrollpos and Setscrollpos ?

Thanks again

Richard

LarryMc

Quote from: RitchieF on November 17, 2013, 09:13:09 PM
But how to integrate it in my project ?
If that is meant as a serious question then send me your complete project.

Quote from: RitchieF on November 17, 2013, 09:13:09 PM
Why doesn't this work with Getscrollpos and Setscrollpos ?
The Getscrollpos and Setscrollpos internal code is designed to work with scrollbars that are part of an IWBasic window or
controls that are standalone scroolbars by class name.

What you are needing is something that works  with the scrollbars that are part of the richedit control class; which is what my demo provides.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library