issue-#45 main window does not refresh during resizing

Post Reply
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

issue-#45 main window does not refresh during resizing

Post by Ivan Denisov »

Main window does not update content when you resize it. This is important for flexible views, also for toolbars and tabs.
http://redmine.blackboxframework.org/issues/45

Diff:
http://redmine.blackboxframework.org/pr ... e7ffdcfd6d
issue45.png
issue45.png (29.33 KiB) Viewed 8238 times
This fix applied in CPC rc6, however duplicating code is used.

Code: Select all

class.style := class.style + WinApi.CS_HREDRAW + WinApi.CS_VREDRAW;
this expression is superfluous in case of called earlier:

Code: Select all

class.style := {0, 1, 3, 5};	(* vredraw, hredraw, doubleclicks, privat dc *) 
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#45 main window does not refresh during resizing

Post by Ivan Denisov »

Josef, there are no comments, because this fix is obvious and already applied in CPC edition.
Let's make voting on this.
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#45 main window does not refresh during resizing

Post by Josef Templ »

On my Windows Vista I cannot see any difference in the behavior of the main window
between CPC 1.7 rc5 and BB 1.6.
Can anybody describe a test case where there is a difference
and what that difference is?

- Josef
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#45 main window does not refresh during resizing

Post by Ivan Denisov »

If you run Tut -> New View 4/5/6
expand subwindow and move corner of mainwindow you will see that it does not update while button is down.
45_fix.png
45_fix.png (26.55 KiB) Viewed 8214 times
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#45 main window does not refresh during resizing

Post by Josef Templ »

In my experiments BB1.6 redraws only on extending the window but not on reducing the window.
Anyway, the fix seems reasonable and there is no reason to only redraw on extending the window size.

Shouldn't we use symbolic constants instead of numbers for the style flags?

- Josef
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#45 main window does not refresh during resizing

Post by Ivan Denisov »

Josef Templ wrote:Shouldn't we use symbolic constants instead of numbers for the style flags?
The original line was:

Code: Select all

class.style := {3, 5};   (* doubleclicks, privat dc *) 
during the discussion of this fix OberonCore suggested to keep this style and just extend:

Code: Select all

class.style := {0, 1, 3, 5};   (* vredraw, hredraw, doubleclicks, privat dc *) 
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#45 main window does not refresh during resizing

Post by Josef Templ »

It in this case it is clearly better to use symbolic names for all of the flags.

Code: Select all

class.style := CS_VREDRAW + CS_HREDRAW + CS_DBLCLKS + CS_OWNDC;
Why?
Because on many other places within HostWindows also symbolic names are used
instead of hard coded constants. So this is not about introducing a mixture of styles.
It is obvious that the symbolic names simply did not exist in WinApi or its predecessors when
this module has been written. Now it exists and it should be used. Then the comment can be removed.
This is an advantage. Why? Because a comment can easily be inconsistent with the code.
The CPC version does it in the right way, at least in the line that has been added.

- Josef
Ivan Denisov
Posts: 1700
Joined: Tue Sep 17, 2013 12:21 am
Location: Russia

Re: issue-#45 main window does not refresh during resizing

Post by Ivan Denisov »

Ok, I updated the repository.

This is the current testing version:
http://blackboxframework.org/unstable/i ... a1.148.zip
Post Reply