[squeak-dev] SystemsWindow color mixup

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[squeak-dev] SystemsWindow color mixup

Trygve
Squeak3.10.gamma.7159

The following code gives surprising results:
--
    | window pasteUpMorph |
    (pasteUpMorph := PasteUpMorph new) color: Color green.
    window := SystemWindow new.
    window addMorph: pasteUpMorph frame: ([hidden email] corner: 1@1).
    window openInWorld.

--
The result is a SystemsWindow with all submorphs green except the pasteUpMorph, which is white!

The offending statements are in SystemWindowaddMorph: aMorph fullFrame: aLayoutFrame
    aMorph adoptPaneColor: self paneColor.
    aMorph borderWidth: 1; borderColor: Color lightGray; color: Color white.

self paneColor
has surprising side effects.
    -    It sets set the SystemsWindow property: paneColor->pasteupMorph color. (i.e., green)
    -     It sets the color of all SystemsWindow  submorphs to the new color (i.e. green)
aMorph borderWidth: 1; borderColor: Color lightGray; color: Color white.
      
simply sets the color of the pasteUpMorph to white.

The result is that  ScrollPane>>example1 and any other simple use of ScrollPane don't work properly.
I fixed the problem by setting the SystemWindow>>paneColor early:
    | window pasteUpMorph |
    (pasteUpMorph := PasteUpMorph new) color: Color green.
    window := SystemWindow new.

    window paneColor: Color white.
    window addMorph: pasteUpMorph frame: ([hidden email] corner: 1@1).
    window openInWorld.



Enjoy
--Trygve






--


--

Trygve Reenskaug       mailto: [hidden email]

Morgedalsvn. 5A         http://heim.ifi.uio.no/~trygver

N-0378 Oslo               Tel: (+47) 22 49 57 27

Norway