Hi!
As you may know, in Pharo one can define an action using a #script pragma.
This is useful for example to have examples as in:
C class >> example01
<script>
…
This creates a small icon actionable next to the method name in the code browser. Clicking on it send the message #example01 to C.
You can you have another pragma #script: as in:
C>> example01
<script: ‘self new example01>
…
I have been using this kind of example because I want to have the examples available when I select a class. However, I see myself in using this pragma as a super easy way to have a button available in the code browser that execute something else than an example. For example, in one of my class, I have:
-=-=-=-=-=-=-=-=-=-=-=-=
SmallMultiple >> openMultiple
<script: 'SmallMultiple new openMultiple inspect'>
| b times c |
times := OrderedCollection new.
MCCVSImporter new
blockToExecute: [ :line | …
…
SmallMultiple >> menuCommandOn: aBuilder
<worldMenu>
(aBuilder item: #'Small Multiple')
label: 'Small Multiple';
icon: MatrixCubeIcons current cubeIcon;
action: [ self new openMultiple inspect ]
-=-=-=-=-=-=-=-=-=-=-=-=
The method #openMultiple open a file browser and let the user to select a file and do some treatment on a .csv file. As you can see, this is not an example, but really the starting point of the application.
All this long mail, to say that the code browser may not only be a place to look at code, execute tests, but also having user buttons to trigger and launch an application.
By the way, there has been some effort with examples from the GT team. How does this compare with the #script: pragma? How to use it?
Cheers,
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel
http://www.bergel.eu^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev