i am actually quite intrigued.
.. by following a numerous code paths i found this:

handlerForMouseDown: anEvent
        "Return the (prospective) handler for a mouse down event. The handler
is temporarily
        installed and can be used for morphs further down the hierarchy to
negotiate whether
        the inner or the outer morph should finally handle the event."

        anEvent blueButtonPressed
                ifTrue: [^ self handlerForBlueButtonDown: anEvent].
        anEvent yellowButtonPressed
                ifTrue: [^ self handlerForYellowButtonDown: anEvent].
        anEvent controlKeyPressed
                ifTrue: [^ self handlerForMetaMenu: anEvent].
        (self handlesMouseDown: anEvent)
                ifFalse: [^ nil].       "not interested"

        anEvent handler
                ifNil: [^ self ].       "Same priority but I am innermost"

        "Nobody else was interested"
        ^self mouseDownPriority >= anEvent handler mouseDownPriority
                ifTrue: [ self]
                ifFalse: [ nil]


now, i was wondering, what that #mouseDownPriority means.. and how it
influencing the overall
logic for determining who will handle the event..
and as it appears, this guy means nothing.. because the only
implementation of it in Pharo is:

mouseDownPriority
        "Return the default mouse down priority for the receiver"

        ^ 0

and 2 methods sending it (the above one and following):

handlerForYellowButtonDown: anEvent
        "Return the (prospective) handler for a mouse down event with the
yellow button pressed.
        The     handler is temporarily installed and can be used for morphs 
further
        down the hierarchy to negotiate whether the inner or the outer
        morph should finally handle the event."

        (self hasYellowButtonMenu or: [ self handlesMouseDown: anEvent ])
                ifFalse: [ ^ nil].      "Not interested."

        anEvent handler
                ifNil: [^ self].        "Nobody else was interested"

        "Same priority but I am innermost."
        ^ self mouseDownPriority >= anEvent handler mouseDownPriority
                ifFalse: [nil ]
                ifTrue: [self]


Notice that both methods are actually semantically equivalent in their
last statement,
but at first glance i thought not, because first uses

                ifTrue: [ self]
                ifFalse: [ nil]

but second uses:
                ifFalse: [nil ]
                ifTrue: [self]

so, the last statement is always answers self...

Ok, after reading it, i think i finally got an idea what it does: it
looks like a way to redefine the natural z-order of morphs by
overriding this method and answering other value(s).
But my mind fails to figure at least one case where it can be useful.
What about yours?

-- 
Best regards,
Igor Stasenko.

Reply via email to