[NEWBIE] MVC question

Dan Ingalls Dan.Ingalls at disney.com
Wed Feb 2 17:05:22 UTC 2000


Francisco -

I don't think you are doing anything wrong.  Without getting into the code, it seems that the expand-after-collapse code for MVC views does not deal properly with blank areas.  I suggest you put a blank view to the left of the one you care about (3 added lines), since the following code seems to work properly...

 | aTopView aSubView |
aTopView := StandardSystemView new.
aTopView window: ( 0 @ 0 extent: 100 @ 100 );
  insideColor: Color blue;
   borderWidth: 2;
   label: ' TopView '.

aTopView addSubView: View new
   window: (0 @ 0 extent: 100 @ 100 )
   viewport: ( 0 @ 0 extent: 50 @ 100).

aSubView := View new.
aSubView insideColor: Color lightYellow;
  borderWidth: 1.
aTopView addSubView: aSubView
   window: (0 @ 0 extent: 100 @ 100 )
   viewport: ( 50 @ 0 extent: 50 @ 100).
aTopView controller open

Hope this helps.

	- Dan

PS: If you are interested in actually solving the problem, it is caused by the fact that, when the view gets re-expanded, it calls getViewport which calls getWindow which calls defaultWindow which merges all the view rectangles.  In your case this made the window simply be the area of your subview instead of the whole window.  It's possible that the code could instead use the reframed (exapanded) rectangle of the StandardSystemView.
---------------------------

>When I try to execute this code in a Workspace, I obtain a MVC white window with
>a lightYellow subView on the right. But when I minimize the window and then
>restore it, all the area of the topView (white) is occupied by the subView
>(lightYellow).
>Could anyboby tell me, what I'm doing wrong.
>Thanks in advance.
>
>Francisco.
>
>| aTopView aSubView |
>aTopView := StandardSystemView new.
>aTopView window: ( 0 @ 0 extent: 100 @ 100 );
>  insideColor: Color white;
>   borderWidth: 2;
>   label: ' TopView '.
>aSubView := View new.
>aSubView insideColor: Color lightYellow;
>  borderWidth: 1.
>aTopView addSubView: aSubView
>   window: (0 @ 0 extent: 100 @ 100 )
>   viewport: ( 50 @ 0 extent: 50 @ 100).
>aTopView controller open







More information about the Squeak-dev mailing list