[squeak-dev] Question on the signals/slots mechanism in Morphic Designer

Edwin Ancaer eancaer at gmail.com
Tue Mar 27 22:48:54 UTC 2018


Hello,


I  struggle a bit to make my problem clear, so forgive me if I write too
much text.

To better understand how to build User Interfaces in an Object Oriented
environment, I did some searching on the internet. I stumbled upon an
article of Martin Fowler on the different GUI architectures. To help me
understand what I was reding, I tried to build the UI that was used as an
example. I did this with Morphic Designer, and building the UI went fine.

Next, I had to write some methods, to get the UI displayed on the screen.
Still no big problems.

But then I needed to add some logic to use the value that was selected in a
combobox widget to edit a lineEdit widget.:  I connected its signal
#currentIndexChanged:text: to the method  #fill that initializes a textbox
edtStationId with the value that was selected from the combobox..

*connecting the signal:*
self connect:  self ui cmbStations signal: #currentIndexChanged:text:
toSelector: #fill.


*the method #fill: *

self ui edtStationId theText: *self ui cmbStations currentText.*

This works, but it feels like cheating: I had hoped to be able to use the
parameters from the signal to initialize the textfield, instead of having
to reread this value explicitly with the currentText method from the
comboBox. Also, I think this will only work when my fill method is defined
in the same class where the comboBox is used.As I see how the interface
should interact with the rest of the application, this should not be the
case as it seems its better to decouple the UI from the application.

Is there a way to use the parameters of the signal directly instead of
going back through the comboBox to get the selected values.

Hope that I was clear enough in my explications, and thanks already,

Edwin Ancaer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20180328/f9c4c4a4/attachment.html>


More information about the Squeak-dev mailing list