Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

...and scantily clad females, of course. Who cares if it's below zero outside. -- Linus Torvalds


devel / comp.lang.smalltalk.dolphin / Event bubbling

SubjectAuthor
* Event bubblingJoe Betz
+- Re: Event bubblingjohn.a...@gmail.com
`* Re: Event bubblingvin...@gmail.com
 `- Re: Event bubblingJoe Betz

1
Event bubbling

<dd51e84f-c21a-477e-b9e7-246c55771644n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=175&group=comp.lang.smalltalk.dolphin#175

  copy link   Newsgroups: comp.lang.smalltalk.dolphin
X-Received: by 2002:ad4:56a4:: with SMTP id bd4mr13045613qvb.16.1635742381691; Sun, 31 Oct 2021 21:53:01 -0700 (PDT)
X-Received: by 2002:a9d:70c9:: with SMTP id w9mr18643983otj.243.1635742381401; Sun, 31 Oct 2021 21:53:01 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!tr2.eu1.usenetexpress.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.smalltalk.dolphin
Date: Sun, 31 Oct 2021 21:53:01 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=2001:861:51c3:bae0:bc1c:5076:1555:ccb2; posting-account=P1X3VgoAAADgSty0b3mKYJl_KPjmW842
NNTP-Posting-Host: 2001:861:51c3:bae0:bc1c:5076:1555:ccb2
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <dd51e84f-c21a-477e-b9e7-246c55771644n@googlegroups.com>
Subject: Event bubbling
From: joebetz91@gmail.com (Joe Betz)
Injection-Date: Mon, 01 Nov 2021 04:53:01 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 9
 by: Joe Betz - Mon, 1 Nov 2021 04:53 UTC

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?

Re: Event bubbling

<a7174559-a452-49d2-888f-0c44dc41fa21n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=176&group=comp.lang.smalltalk.dolphin#176

  copy link   Newsgroups: comp.lang.smalltalk.dolphin
X-Received: by 2002:ac8:5f0c:: with SMTP id x12mr29621906qta.309.1635764902889;
Mon, 01 Nov 2021 04:08:22 -0700 (PDT)
X-Received: by 2002:aca:3e09:: with SMTP id l9mr25132042oia.131.1635764902677;
Mon, 01 Nov 2021 04:08:22 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.smalltalk.dolphin
Date: Mon, 1 Nov 2021 04:08:22 -0700 (PDT)
In-Reply-To: <dd51e84f-c21a-477e-b9e7-246c55771644n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=85.203.71.185; posting-account=OQ6sIwoAAAC1iWrFEUhdmRsgEkeDOgOm
NNTP-Posting-Host: 85.203.71.185
References: <dd51e84f-c21a-477e-b9e7-246c55771644n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a7174559-a452-49d2-888f-0c44dc41fa21n@googlegroups.com>
Subject: Re: Event bubbling
From: john.aspinall@gmail.com (john.a...@gmail.com)
Injection-Date: Mon, 01 Nov 2021 11:08:22 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 95
 by: john.a...@gmail.com - Mon, 1 Nov 2021 11:08 UTC

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?

Re: Event bubbling

<4eb3b500-900e-4817-a5a9-f962e0a0e1c2n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=177&group=comp.lang.smalltalk.dolphin#177

  copy link   Newsgroups: comp.lang.smalltalk.dolphin
X-Received: by 2002:a05:622a:13cc:: with SMTP id p12mr29837703qtk.227.1635765068106;
Mon, 01 Nov 2021 04:11:08 -0700 (PDT)
X-Received: by 2002:aca:606:: with SMTP id 6mr19984714oig.82.1635765067800;
Mon, 01 Nov 2021 04:11:07 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.smalltalk.dolphin
Date: Mon, 1 Nov 2021 04:11:07 -0700 (PDT)
In-Reply-To: <dd51e84f-c21a-477e-b9e7-246c55771644n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:44b8:215d:5b00:6152:b00f:54e0:f156;
posting-account=5_w1_goAAAB1Y5P4_YBwBlB76XHrI38U
NNTP-Posting-Host: 2001:44b8:215d:5b00:6152:b00f:54e0:f156
References: <dd51e84f-c21a-477e-b9e7-246c55771644n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <4eb3b500-900e-4817-a5a9-f962e0a0e1c2n@googlegroups.com>
Subject: Re: Event bubbling
From: vinref@gmail.com (vin...@gmail.com)
Injection-Date: Mon, 01 Nov 2021 11:11:08 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 17
 by: vin...@gmail.com - Mon, 1 Nov 2021 11:11 UTC

On Monday, 1 November 2021 at 14:53:02 UTC+10, 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?

Maybe you should look at #createSchematicWiring. With this you can 'listen' to events on an object you hold a reference to, such as a child component in a composite presenter. There are examples and explanations on its use in the Helpfile example (Tutorials > Creating a GUI Application).

Vince

Re: Event bubbling

<7674f85e-58de-4e1e-bcfa-64b4cc960d6an@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=185&group=comp.lang.smalltalk.dolphin#185

  copy link   Newsgroups: comp.lang.smalltalk.dolphin
X-Received: by 2002:a05:622a:94:: with SMTP id o20mr59653603qtw.169.1636099791003;
Fri, 05 Nov 2021 01:09:51 -0700 (PDT)
X-Received: by 2002:a9d:d68:: with SMTP id 95mr43140452oti.377.1636099790701;
Fri, 05 Nov 2021 01:09:50 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.smalltalk.dolphin
Date: Fri, 5 Nov 2021 01:09:50 -0700 (PDT)
In-Reply-To: <4eb3b500-900e-4817-a5a9-f962e0a0e1c2n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:861:51c3:bae0:a425:ea25:373b:b422;
posting-account=P1X3VgoAAADgSty0b3mKYJl_KPjmW842
NNTP-Posting-Host: 2001:861:51c3:bae0:a425:ea25:373b:b422
References: <dd51e84f-c21a-477e-b9e7-246c55771644n@googlegroups.com> <4eb3b500-900e-4817-a5a9-f962e0a0e1c2n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7674f85e-58de-4e1e-bcfa-64b4cc960d6an@googlegroups.com>
Subject: Re: Event bubbling
From: joebetz91@gmail.com (Joe Betz)
Injection-Date: Fri, 05 Nov 2021 08:09:50 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 11
 by: Joe Betz - Fri, 5 Nov 2021 08:09 UTC

> Hope this helps.

Yup, that helped. :)

> Maybe you should look at #createSchematicWiring. With this you can 'listen' to events on an object you hold a reference to, such as a child component in a composite presenter. There are examples and explanations on its use in the Helpfile example (Tutorials > Creating a GUI Application).

Makes sense. I had looked at the GUI tutorial but was missing examples of low level key and mouse events though. Good to know they're already being emitted from Dolphin view objects.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor