I'm not aware of a mechanism for this other than configuring subviews to bubble up individual events of interest. For example (modifying the FlowLayout example from the other thread):
(shell := View desktop addSubView: ShellView new)
backcolor: Color face3d;
layoutManager: (layout := FlowLayout new);
extent: 300 @ 200.
shell insets: (10 @ 10 corner: 10 @ 10).
layout
verticalGap: 10;
horizontalGap: SmallInteger maximum. "Force one item per row"
entireArea := FramingConstraints new rightFraming: #fixedParentRight; bottomFraming: #fixedParentBottom.
1 to: 10 do:
[ :index || messageView label |
(messageView := shell addSubView: ContainerView new)
extent: 100@20;
layoutManager: FramingLayout new;
addSubView: (label := StaticText new).
label
arrangement: entireArea;
text: 'Label <1d>' << index;
when: #leftButtonPressed: send: #onLeftButtonPressed: to: messageView.
messageView
arrangement: entireArea;
when: #leftButtonPressed: send: #inspect to: messageView].
shell show.
Older versions of Dolphin included a View subclass named Shield which was used by the View Composer to detect mouse events in the composition area - class comment:
"Shield is a covering <view> that the View Composer uses to overlay its arena in order to capture appropriate mouse down events before they reach the windows in the underlying view being composed. The intercepted events are relayed to the Shield's target
which, normally, will be a <ViewComposer>."
Shield doesn't exist in current Dolphin versions, however since you don't need the "events are relayed to the Shield's target" function you can implement a minimal version with a class and two methods as follows:
View subclass: #Shield
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
classInstanceVariableNames: ''
defaultWindowExStyle
"Private - Answer the default extended window creation style"
^super defaultWindowExStyle bitOr: WS_EX_TRANSPARENT
onEraseRequired: aColorEvent
"Private - Handler for erase background"
^true
You can then use this to capture all mouse events before they reach other subview(s). To demonstrate replace the loop block in the above example:
[ :index || messageView label shield |
(messageView := shell addSubView: ContainerView new)
extent: 100@20;
layoutManager: FramingLayout new;
addSubView: (shield := Shield new);
addSubView: (label := StaticText new).
label
arrangement: entireArea;
text: 'Label <1d>' << index.
shield
arrangement: entireArea;
when: #leftButtonPressed: send: #inspect to: shield;
when: #rightButtonPressed: send: #inspect to: label;
when: #leftButtonDoubleClicked: send: #inspect to: messageView].
Hope this helps.
John
On Monday, November 1, 2021 at 4:53:02 AM UTC,
joeb...@gmail.com wrote:
Does Dolphin have any mechanisms for bubbling up mouse events?
For example, I have a MessagePresenter which has a ContainerView which has a StaticText for the author name and another StaticText for the message content. I'd like for MessagePresenters to be able to handle all mouse events from all its subviews, but
as is getting swallowed by the subviews.
I think there should be a flag in View objects for controlling whether events are bubbled up to their parents. Or perhaps there are existing mechanisms I haven't discovered yet?
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)