Parent of ExampleBuilderMorph

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

Parent of ExampleBuilderMorph

DougEdmunds
If subclassed under ComposableMorph instead of MorphicModel, ExampleBuilderMorph would need only this one method, instead of 157 methods:

!ExampleBuilderMorph methodsFor: 'as yet unclassified' stamp: 'gvc 3/6/2010 17:08'!
openModal: aSystemWindow
        "Open the given window an available position without modality.
        Answer the system window."
       
        |baseArea areas searching foundRect|
        aSystemWindow extent: aSystemWindow initialExtent.
        areas := World submorphs
                select: [:m | m isKindOf: DialogWindow]
                thenCollect: [:m | m bounds expandBy: 8].
        baseArea := RealEstateAgent maximumUsableArea insetBy: 8.
        searching := true.
        baseArea allAreasOutsideList: areas do: [:rect |
                searching ifTrue: [
                        aSystemWindow extent <= (rect insetBy: 8) extent
                                ifTrue: [foundRect := rect.
                                                searching := false]]].
        searching ifTrue: [foundRect := baseArea].
        aSystemWindow setWindowColor: self theme windowColor.
        aSystemWindow position: foundRect topLeft + 8.
        aSystemWindow openAsIs.
        ^aSystemWindow! !

Reply | Threaded
Open this post in threaded view
|

Re: Parent of ExampleBuilderMorph

Fernando olivero-2
Hi Doug, note that its using a trait. Even though the methods show up
in the browser, they dont belong to the class itself.

ExampleBuilderMorph  localSelectors size 2

MorphicModel subclass: #ExampleBuilderMorph
        uses: TEasilyThemed
        instanceVariableNames: ''
        classVariableNames: ''
        poolDictionaries: ''
        category: 'Polymorph-Widgets'

Fernando

On Mon, May 9, 2011 at 11:45 PM, DougEdmunds <[hidden email]> wrote:

> If subclassed under ComposableMorph instead of MorphicModel,
> ExampleBuilderMorph would need only this one method, instead of 157 methods:
>
> !ExampleBuilderMorph methodsFor: 'as yet unclassified' stamp: 'gvc 3/6/2010
> 17:08'!
> openModal: aSystemWindow
>        "Open the given window an available position without modality.
>        Answer the system window."
>
>        |baseArea areas searching foundRect|
>        aSystemWindow extent: aSystemWindow initialExtent.
>        areas := World submorphs
>                select: [:m | m isKindOf: DialogWindow]
>                thenCollect: [:m | m bounds expandBy: 8].
>        baseArea := RealEstateAgent maximumUsableArea insetBy: 8.
>        searching := true.
>        baseArea allAreasOutsideList: areas do: [:rect |
>                searching ifTrue: [
>                        aSystemWindow extent <= (rect insetBy: 8) extent
>                                ifTrue: [foundRect := rect.
>                                                searching := false]]].
>        searching ifTrue: [foundRect := baseArea].
>        aSystemWindow setWindowColor: self theme windowColor.
>        aSystemWindow position: foundRect topLeft + 8.
>        aSystemWindow openAsIs.
>        ^aSystemWindow! !
>
>
>
> --
> View this message in context: http://forum.world.st/Parent-of-ExampleBuilderMorph-tp3510422p3510422.html
> Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Parent of ExampleBuilderMorph

DougEdmunds
In reply to this post by DougEdmunds
I see now both both classes used the same Trait, thus the apparent duplication of methods.  

Is there a way to see just those methods of a class which are not part of a Trait that's being used? I tried deleting the portion of the class definition "uses: TEasilyThemed", but it reappears when saving the class.
Reply | Threaded
Open this post in threaded view
|

Re: Parent of ExampleBuilderMorph

Fernando olivero-2
You can send: Trait>>removeFromComposition:
You have a similar method in Behavior as well.
Fernando

On Tue, May 10, 2011 at 6:37 AM, DougEdmunds <[hidden email]> wrote:

> I see now both both classes used the same Trait, thus the apparent
> duplication of methods.
>
> Is there a way to see just those methods of a class which are not part of a
> Trait that's being used? I tried deleting the portion of the class
> definition "uses: TEasilyThemed", but it reappears when saving the class.
>
> --
> View this message in context: http://forum.world.st/Parent-of-ExampleBuilderMorph-tp3510422p3510990.html
> Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
>
>