issue-#106 View restored twice on Open

Re: issue-#106 View restored twice on Open

Postby Josef Templ » Thu Aug 04, 2016 4:39 am

I call it an optimization.
The docu states clearly that there must not be any assumptions on the number of Restore operations.

Anyway, such a change is too late for 1.7 because there is no time for testing the change.
Testing the change extensively is important because such a change has a lot of
potential for unwanted side effects.
1.7 is not the end of the world.
If you or anybody else finds a fix it can of course be considered,
but not as a last minute change 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 Ivan Denisov » Thu Aug 04, 2016 5:20 am

I added 1.8 to tracker.
So now we can change issue target version to 1.8.
http://redmine.blackboxframework.org/issues/106
Ivan Denisov
 
Posts: 1698
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#106 View restored twice on Open

Postby DGDanforth » Fri Aug 05, 2016 1:13 am

OK, that is fine with me to move it to 1.8.
-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 luowy » Sun Sep 25, 2016 9:24 am

Josef Templ wrote: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

@Josef,
can you give a detail(demo) about "the scrollbars are not set up correctly."?
I cant find it after "commenting w.Update in HostWindows.CreateDoc".
luowy
 
Posts: 226
Joined: Mon Oct 20, 2014 12:52 pm

Re: issue-#106 View restored twice on Open

Postby Josef Templ » Sun Oct 02, 2016 6:10 pm

For example, open System/Mod/Kernel.odc.
With "w.Update" commented in HostWindows.CreateDoc you get a horizontal scroll bar,
which you didn't get before.

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

Re: issue-#106 View restored twice on Open

Postby luowy » Sun Oct 02, 2016 10:49 pm

Josef Templ wrote:For example, open System/Mod/Kernel.odc.
With "w.Update" commented in HostWindows.CreateDoc you get a horizontal scroll bar,
which you didn't get before.

- Josef
comment out this line together
Code: Select all
IF ~w.fix THEN w.SetSize(cw, ch) END;
luowy
 
Posts: 226
Joined: Mon Oct 20, 2014 12:52 pm

Re: issue-#106 View restored twice on Open

Postby Josef Templ » Mon Oct 03, 2016 7:42 am

Interesting observation but there are still some open questions.

Why didn't you also comment out the line in between ("w.UpdateScrollbars(FALSE);")?
Why is some of the commented code in bold face?
Is this the last unwanted side effect?
Is there any explanation of the underlying behavior?

- 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 Oct 11, 2017 5:22 am

Josef Templ wrote:The docu states clearly that there must not be any assumptions on the number of Restore operations.
- Josef


In my opinion that is a poor design.
The framework needs to be redesigned so that an "Open" calls "Restore" only once.
-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 Robert » Wed Oct 11, 2017 11:26 am

I am leaving this Issue with the status Dormant because, as far as I am aware, the following four conditions apply:

→ The proposed change to the behaviour has not been rejected as undesirable
→ It has been open for a long time
→ There is no practical proposed implementation available
→ No one is actively working to find such an implementation.

Doug, maybe a way to move this forward is to write privately to Oms and see if they have any insight into why the current design, with two restores, was chosen?
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 Robert » Wed Oct 11, 2017 12:49 pm

Doug
Maybe you could try this workaround, and report if it helps you, or causes any problems?

Add the following three (harmless ?) lines to HostWindows:
→ In the global VAR section "src-: INTEGER;"
→ In the procedure CreateDoc (the first line in this clip is new)
Code: Select all
src := 1;
      w.Update;
      w.UpdateScrollbars(FALSE);
      IF ~w.fix THEN w.SetSize(cw, ch) END;
      res := WinApi.GetWindowRect(wnd, rect);
      w.mw := rect.right - rect.left; w.mh := rect.bottom - rect.top;
      HostMechanisms.InstallDropTarget(wnd, w);
      w.setup := TRUE
   END CreateDoc;

→ In the procedure PaintWin
Code: Select all
   PROCEDURE PaintWin (wnd: WinApi.HANDLE; a, b: INTEGER);
      VAR w: Window;
   BEGIN
      w := ThisWindow(wnd);
src := 2;
      w.Update
   END PaintWin;


Now, in your View's Restore procedure, add the test:
Code: Select all
    IF  HostWindows.src = 2  THEN
      f.Draw...
    END;
User avatar
Robert
 
Posts: 1023
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

PreviousNext

Return to Resolved (Bugs)

Who is online

Users browsing this forum: No registered users and 1 guest

cron