simple way to intercept mouse clicks on a view OR any subview

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

simple way to intercept mouse clicks on a view OR any subview

Jochen Riekhof-6
Hi...

is there a way to intercept mouse clicks on a view or any of its subview
without hooking event handlers into all of these?

For now I hooked into all of the subPresenters
EachSubpresenter>>when: #leftButtonPressed send:
subviewLeftButtonPressed to: self.

Ciao

...Jochen


Reply | Threaded
Open this post in threaded view
|

Re: simple way to intercept mouse clicks on a view OR any subview

Andy Bower-3
Jochen,

> is there a way to intercept mouse clicks on a view or any of its
> subview without hooking event handlers into all of these?
>
> For now I hooked into all of the subPresenters
> EachSubpresenter>>when: #leftButtonPressed send:
> subviewLeftButtonPressed to: self.

Not really. This is because of the way Windows performs the
distribution of mouse clicks. Basically, hit testing is performed
"bottom-up" with the sub-views being looked at first which means that
there is no easy way to override a mouse click just in the parent view.

One thing you could look into (depending on whether the views in
question by your own classes or not) would be to override #wmNcHitTest:
wParam:lParam: in the sub-views and have the method answer
HTTRANSPARENT. This would then make the sub-views appear invisible when
Windows performs its hit-testing and it would then pass the mouse
clicks up the view parent chain. You can see an example of this in
TextEdit>>wmNcHitTest: wParam:lParam:.

Best regards,

--
Andy Bower
Dolphin Support
www.object-arts.com


Reply | Threaded
Open this post in threaded view
|

Re: simple way to intercept mouse clicks on a view OR any subview

Jochen Riekhof-6
Hi Andy...

thank you for the info! I simply solved it by hooking
#leftButtonPressed: handlers on all the (few) clickable subviews.

Ciao

...Jochen

BTW: (if you remember my post about Shells in ContainerViews) I gave up
on trying to fiddle out what goes wrong with Shells in ContainerViews
and have built my own artificial windows. Now z-Ordering works just
fine, while with Shells the clicking went right but the repaints were
unchangeably always in order of the Shell addition to the parent views
regardless of any zOrderTop calls or whatever.