This issue is about the reuse of open documents in BB.
When clicking on a link to a help text that is already open within BlackBox,
a new help text window is opened. This is in contrast to the expected behavior of
reusing the open window (bring to front) as it is done when editing documents.
The reason is a very unsystematic treatment of reuse of open documents in BB 1.6.
Related anomalies arise with other document modes (except edit mode)
and need to be taken into account when changing this behavior.
There are also cases with tool dialogs (if I remember correctly) where there is a wrong reuse if
the same window title is used for different documents. That's why I classified this issue as a bug.
A proposal for a much more systematic treatment of reuse of open documents based on
file name, location, converter and document flags instead of window titles is available in CPC 1.7 rc5.
Refers to CPC 1.7 rc5 change list item 9 and Open Points 05.
The diffs can be found in http://redmine.blackboxframework.org/pr ... d7f3a5a888.
- Josef
issue-#34 fixing the reuse of open documents
- Josef Templ
- Posts: 2047
- Joined: Tue Sep 17, 2013 6:50 am
- DGDanforth
- Posts: 1061
- Joined: Tue Sep 17, 2013 1:16 am
- Location: Palo Alto, California, USA
- Contact:
Re: issue-#34 fixing the reuse of open documents
Josef,
Very nice. I agree with the needed change.
-Doug
Very nice. I agree with the needed change.
-Doug
Re: issue-#34 fixing the reuse of open documents
yes, I like the solution too.
--
Bernhard
--
Bernhard
-
- Posts: 1700
- Joined: Tue Sep 17, 2013 12:21 am
- Location: Russia
Re: issue-#34 fixing the reuse of open documents
I am suggesting to add one more line in OpenBrowser.
w.SetTitle(title$);
I think, that it is good to change the title, because if developer call
he is expecting that this window will have this title, not another.
He will be unable to close this window by title later, for example, if we do not add this line. So If we do not add this line we will break back compatibility.
w.SetTitle(title$);
Code: Select all
Windows.dir.Select(w, Windows.lazy);
w.SetTitle(title$);
v := w.doc.ThisView();
Code: Select all
StdCmds.OpenBrowser('Tour.odc', 'test')
He will be unable to close this window by title later, for example, if we do not add this line. So If we do not add this line we will break back compatibility.
- Josef Templ
- Posts: 2047
- Joined: Tue Sep 17, 2013 6:50 am
Re: issue-#34 fixing the reuse of open documents
> I am suggesting to add one more line in OpenBrowser.
> w.SetTitle(title$);
Hmmm...
Normally, the new and the old title will be the same,
so it does not make a difference how to handle the change.
If the title changes, it is the question if we should reuse at all.
If "close by title" (I don't know what this means) is important, the
missing old title may be a problem as well as the missing new title.
- Josef
> w.SetTitle(title$);
Hmmm...
Normally, the new and the old title will be the same,
so it does not make a difference how to handle the change.
If the title changes, it is the question if we should reuse at all.
If "close by title" (I don't know what this means) is important, the
missing old title may be a problem as well as the missing new title.
- Josef
-
- Posts: 1700
- Joined: Tue Sep 17, 2013 12:21 am
- Location: Russia
Re: issue-#34 fixing the reuse of open documents
I agree, that if the title is differ, better to run default behaviour. If them are the same you suggested behaviour is very good.
"Close by title" means to filter all windows and close if the names are matching.
I am using such code:
"Close by title" means to filter all windows and close if the names are matching.
I am using such code:
Code: Select all
PROCEDURE GetWindow (name: ARRAY OF CHAR): Windows.Window;
VAR win, winTmp: Windows.Window; title: Views.Title;
BEGIN
win := Windows.dir.First();
winTmp := NIL;
WHILE (win # NIL) & (winTmp = NIL) DO
win.GetTitle(title);
IF title$ = name$ THEN
winTmp := win
END;
win := Windows.dir.Next(win)
END;
RETURN winTmp
END GetWindow;
PROCEDURE Close* (name: ARRAY OF CHAR);
VAR win: Windows.Window;
BEGIN
ASSERT(name$ # "", 20);
win := GetWindow(name);
IF win # NIL THEN
Windows.dir.Select(win, FALSE);
Windows.dir.Close(win)
END
END Close;
- Josef Templ
- Posts: 2047
- Joined: Tue Sep 17, 2013 6:50 am
Re: issue-#34 fixing the reuse of open documents
I have now added a title check when reusing a (Browser) window.
Reuse happens only if the title is the same (in addition to the other rules as already checked).
For the cases where there is no title available, an empty title is used, which signals that
there should be no title check in Windows.GetBySpec.
I think the issue is in a good shape now and ready for voting.
- Josef
Reuse happens only if the title is the same (in addition to the other rules as already checked).
For the cases where there is no title available, an empty title is used, which signals that
there should be no title check in Windows.GetBySpec.
I think the issue is in a good shape now and ready for voting.
- Josef
- Josef Templ
- Posts: 2047
- Joined: Tue Sep 17, 2013 6:50 am
Re: issue-#34 fixing the reuse of open documents
The title check did not work as expected.
I had to revert this part of the changes of issue-#34.
Let me know if anybody has an idea how to solve it.
- Josef
I had to revert this part of the changes of issue-#34.
Let me know if anybody has an idea how to solve it.
- Josef