Ralph Boland wrote:
> Besides error intractability, there is also a cost to understanding the
> system via exploration - a glorious benefit of Morphic. In the past, one
> only had to bring up halos on and inspect a button to see how to
duplicate
> its action. Now, to see what happens when one presses Versionner's
"Commit
> the project" button, you have to drill down in the inspector from
> aButtonXyzMorph -> model -> actionHolder -> value, a tedious and opaque
> process.
> Of course, I'm not in any way against Spec or its goals, just sharing my
> unfolding experience using it.
I'm running Squeak 4.0 but I assume my question still applies. If not,
other
Pharo users might want to know.
I am not in the habit of using halos, not really sure what they are
for. But your description implies they are quite useful.
What does "bring up halos on and inspect a button to see how to duplicate
> its action" mean? Could you please describe in step by step detail.
Ralph Boland
Say you wanted your application to add a new package to the system. So
you wonder how would to do that. Well... the system already does it!
Right click in the first pane of the System Browser and you get a menu
it <Add package...>. So why not just copy how that does it?
But how do you look under the hood to see how it works you ask? Halos to
the rescue! Hold the key combination to invoke halos and click on the
menu item (varies between platforms, mac is <shift-option>, win is
<shift-alt>) so that "ToggleMenuItemMorph" shows as the object type the
halos are related to.
On the right click the spanner "Debug" icon, and <inspect morph>.
Scroll down looking for something that looks like a relevant method call
(in this case 'target' contains [ target addPackge ].
#addPackage looks a likely candidate, so browse implementors and put a
"self halt" at the top of the methods. Then back in the System Browser,
invoke the <Add package...> menu item, and the debugger appears. Now
you can trace through the execution of the system code that creates
package. As an example, nothing beats real-life code.
-----
Another use I have is sometimes to go World > System,
use the Duplicate Halo on the <Enable halt/inspect once> menu item
to drag it onto the background and using it as a button.
HTH -ben