Collection of Editors or Documents

SyntaxEditor for Windows Forms Forum

Posted 18 years ago by Michael Trier
Avatar
I have an MDI tabbed interface and it's currently implemented by using a single Editor object and multiple document objects that are stored in a hash. Each time a tab is selected the document is connected to the Editor object and displayed. I'm also using a single Language object for similar languages. This approach reduces memory usage pretty well, but I'm running into one problem. Each time a document is bound to an Editor the caret position, split views, etc... are lost, since these are properties of teh Editor. I would think storing this information with the the document hash might be a good approach except that I imagine it's going to be a lot of information to save and load back in each time. Perhaps the better approach is to store multiple editors, along with their documents, in the hash instead. Although I know this is possible, will my memory use increase significantly if I take this approach?

Looking forward to v 4.0. Thanks for all of your hard work.

Michael

Comments (2)

Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
There will be a memory increase over what you are currently doing because the SyntaxEditor has to store things like display line information, etc. In v4.0 we have done a lot of memory optimization, basically have gone through the whole product and only instantiate things when needed. Also we've tried to cut down on overall memory when objects are created.

But still, swapping in Documents will be the way to reduce memory usage the most. And sharing languages as you are doing.

What you could do is persist values like the selected view's FirstVisibleDisplayLineIndex and FirstVisibleX. Then the selection range. You might also want to save the horizontal and vertical split positions if you are in a multiple view situation. By saving and restoring that information, you should be able to make the SyntaxEditor seem very close to what it was previously.


Actipro Software Support

Posted 18 years ago by Michael Trier
Avatar
Thanks for the pointers. For now I just switched to swapping the editor in and out. It took all of 5 minutes to make the code change and it is working wonderfully. When I get some spare cycles I think I'll go the other route and this information helps me figure out what I need to persist.

Michael
The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.