This forum is temporaily read-only. All existing discussions remain available for reference. For new questions, bug reports or support requests, please contact us at mail@lmdsupport.com.

Slow loading of form.

edited April 2013 in LMD IDE-Tools
Hi Eugene,

As you probably remember I implemented an undo/redo system in response to module change events.  This works fine except for one thing.  When I do an Undo and reload the form from my stream (by calling module.LoadFromStream) the call to FRoot.DestroyComponents is taking an incredibly long time,  I've tried to trace it to see what is happening,  but get a bit lost in all the notifications.  Can you think of a workaround for this?

Regards
 Keith

Comments

  • Hi,

    Sorry, but as has been already noted, we will not spend more time to optimize repformance. This is how VCL works. So, think yourself what can be done...
  • no problem - I just wondered if you (or anyone else) had any ideas on how I could avoid the overhead of the notifications from the DestroyComponents call.  I think if I clear the selection and all components collections before I reload, that might help,  but I wasn't sure if this would have other side effects.

    Regards
    Keith.
  • Hi Eugene,

    I did this and it's now very fast - the only problem is it flickers quite badly now - I'm guessing because of active being changed?

      fContainer.Designer.Active := false;
      fContainer.Designer.AllComponents := nil;
      fContainer.Designer.Selection := nil;
      fContainer.Selection.Clear;
      fContainer.AllComps.Clear;
      fContainer.Module.LoadFromStream(memento.ContainerState);
      fContainer.Designer.AllComponents := fContainer.AllComps;
      fContainer.Designer.Selection := fContainer.Selection;
      fContainer.Designer.Active := true;

    (fContainer is the frame - the rest is obvious I think).  I can live with the flicker,  but if you happen to know a simple way to avoid it, I'd appreciate it.

    Regards
    Keith.
  • I told you at the very begining - its not possible to implement Undo/Redo correctly. You'll always get such problems.
  • Sure and I understood that and as I said, I can live with the flicker as the function as it stands is very useful.  Just wondered if you could see anything obviously wrong with my implementation that would make it better than it is now.  Incidentally undo/redo functions very well like this - I'm pretty sure it would be almost impossible to create an undo that rolled back editing steps,  but restoring the whole form like this is a reasonable solution..

     
Sign In or Register to comment.