[Cuis-dev] For the Cuis Cookbook
H. Hirzel
hannes.hirzel at gmail.com
Tue May 20 03:42:41 PDT 2025
Hi Ken
I have realized that the construction you used in the recipe
https://github.com/DrCuis/Workbench/blob/main/Morphic/How_to_create_screenshots.md
is very compact. In particular
|clickArea (which is a BorderedBoxMorph object) has a property ||#'mouseButton1Up:localPosition:' which is set to a code block. |
|setProperty: #handlesMouseDown: toValue: true; is necessary to activate
this behavior. If you put mouseButton1Up:localPosition: into a
workspace, put the cursor in it and hit CMD-M. You get a list of morphs
which implement this and indeed class morph uses this property
mouseButton1Up: aMouseButtonEvent localPosition: localEventPosition
"Handle a mouse button 1 up event. This message will only be sent to
Morphs that answer true to #handlesMouseDown:" "Allow instances to
dynamically use properties for handling common events." self
valueOfProperty: #'mouseButton1Up:localPosition:' ifPresentDo: [
:handler | handler value: aMouseButtonEvent value: localEventPosition ] |
So the whole code is a nice example of getting instance specific behavior.
I think this should be captured in a notes or remarks section in the
recipe for the cookbook.
Not sure how the note/remark should look exactly.
And when the recipe is finished we need to move it to a folder in
https://github.com/DrCuis/How-to-guides
either into an existing folder or a new one.
And the entry
https://github.com/DrCuis/Workbench/blob/main/Morphic/How_to_create_screenshots.md
deleted.
This does not need to be done immediately ; this is why there is a
workbench repository.
--Hannes
On 19/05/2025 11:55 pm, H. Hirzel wrote:
> Hi Ken
>
> thank you for this useful contribution.
>
> I have moved it to
>
> https://github.com/DrCuis/Workbench/blob/main/Morphic/How_to_create_screenshots.md
>
>
> for the time being.
>
> -- Hannes
>
> On 19/05/2025 8:51 pm, ken.dickey--- via Cuis-dev wrote:
>> Useful to save screenshots while documenting.
>>
>> The attached creates a transparent Morph which, when clicked, saves
>> the Display view as a .png file.
>>
>> Does not capture cursor.
>>
>> Find code in File List, right click -> "workspace with contents".
>>
>> Change file #baseName to something useful; perhaps change
>> #borderWidth to zero (0).
>>
>> Safe when used as directed. ;^)
>>
>> HTH
>> -KenD
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20250520/916f2bba/attachment.htm>
More information about the Cuis-dev
mailing list