issue-#106 View restored twice on Open

issue-#106 View restored twice on Open

Postby DGDanforth » Sat May 23, 2015 5:11 am

The Restore procedure of a view is called twice when a view is first opened.
I consider that a bug.
It should be called only once.
I have not tracked through the code to see where that is happening.
It is probably in Views.RestoreFrame.
Comments?
-Doug
User avatar
DGDanforth
 
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA

Re: View restored twice on Open

Postby Ivan Denisov » Tue May 26, 2015 3:34 am

I think, that it can be considered as a bug if we will study the reasons a bit. Maybe this is needed for some reason, for calculation if view sizes or something like that.

With text views the same problem about scrolling, TextView updating four!!! times for each scroll event of mouse. If I am making any text wrapper, updates multiplying.

I found the accurate consideration of such cases very important. So we can start with your issue.
Ivan Denisov
 
Posts: 1698
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: View restored twice on Open

Postby Josef Templ » Tue May 26, 2015 10:21 am

From the docu of module Views:

No assumptions are allowed of when Restore is called, how often, in which order, etc. Restore should simply draw everything within the given rectangle, it must not assume that something is still on screen from the last time it was called.


So, be careful with speculations and also look at the given clipping rectangle l, t, r, b.

- Josef
User avatar
Josef Templ
 
Posts: 2038
Joined: Tue Sep 17, 2013 6:50 am

Re: View restored twice on Open

Postby DGDanforth » Tue May 26, 2015 7:35 pm

So, be careful with speculations and also look at the given clipping rectangle l, t, r, b.

- Josef


"Speculation" is perhaps not the right word.
o I always ignore the l, t, r, b values.
o It is very annoying when trying to debug code that the restore procedure is called twice on open.

I really feel that is a bad implementation which should be removed from the framework.

-Doug
User avatar
DGDanforth
 
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA

Re: View restored twice on Open

Postby Robert » Sun Jun 07, 2015 8:03 am

I recently attached a Sequencers.Notifier to a Window, so my code could cleanup when the Window was closed.

Its Notify method was also called twice when the Window was closed.

Another, similar, inconvenience.
User avatar
Robert
 
Posts: 1023
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: issue-#106 View restored twice on Open

Postby Josef Templ » Wed Apr 06, 2016 8:30 am

Restore twice on Open results from:

HostWindows.OpenDoc
(1) creates a child window, which is restored, and
(2) the child window is updated, which also means that it is restored.

By commenting w.Update in HostWindows.CreateDoc (the restore in the first step)
you can avoid restoring twice on open.
HOWEVER, there are strange things then in some views, in particular
the scrollbars are not set up correctly.
So the first Update has side effects that are important.

Making any changes in the opening of documents goes very deep into
the framework and is probably wrong in some unexpected sense.
I would strongly recommend not to touch this code until we have a much
better understanding of how it works.

- Josef
User avatar
Josef Templ
 
Posts: 2038
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#106 View restored twice on Open

Postby DGDanforth » Fri Apr 08, 2016 8:18 am

Josef,
I agree.
But the issue still stands.
-Doug
User avatar
DGDanforth
 
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA

Re: issue-#106 View restored twice on Open

Postby Josef Templ » Wed Aug 03, 2016 1:58 pm

I don't see any chance to fix this behavior.
The behavior may be a surprise and/or an inconvenience but, strictly speaking, it is not a bug.

I would close/suspend this issue.
For me it is annoying to keep unsolvable issues open for a long time.
It is also strange to have an open issue for target version 1.7 when we
are approaching the release of 1.7.

- Josef
User avatar
Josef Templ
 
Posts: 2038
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#106 View restored twice on Open

Postby DGDanforth » Wed Aug 03, 2016 11:58 pm

Josef Templ wrote:I don't see any chance to fix this behavior.
The behavior may be a surprise and/or an inconvenience but, strictly speaking, it is not a bug.

I would close/suspend this issue.
For me it is annoying to keep unsolvable issues open for a long time.
It is also strange to have an open issue for target version 1.7 when we
are approaching the release of 1.7.

- Josef

Josef,
I am actively working on this issue so please don't close/suspend it.
Its tough to debug.
I can put in two traps and record the trap output.
What I see is the first call of Restore happens on OpenDoc.
The second call happens when "someone" asks for a "Paint".
I have yet to determine what modules is doing that.

PROCEDURE HostWindows.PaintWin
HostWindows.DocWinHandler

-Doug
User avatar
DGDanforth
 
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA

Re: issue-#106 View restored twice on Open

Postby DGDanforth » Thu Aug 04, 2016 12:01 am

This "call twice" is extremely annoying to me. I do lots of view programming.
When the Restore is called it may need extensive code execution to draw the image and hence
execution is twice as long as it should be.

I definitely call that a bug.

-Doug
User avatar
DGDanforth
 
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA

Next

Return to Resolved (Bugs)

Who is online

Users browsing this forum: No registered users and 1 guest

cron