Please allow me to simplify my question. I need a basic answer.
One of the articles on Morphic says you can create composite morphs either programatically, using addMorph, or using drag and drop from the Objects menu of the morphic World. I have done the latter, because it is easier to design my layout that way. Once that has been done, how do I address the submorph from a browser? If I inspect my button submorph, for example, all it will tell me about it is "a ScriptableButton<Button>(1364754)". I have no idea how to access that object in order to do anything with it. This is the crux of my questions.
Thank you
Tim Cuthbertson
On Wed, Feb 22, 2017 at 10:03 AM, < beginners-request@lists.squeakfoundation.org> wrote:
Send Beginners mailing list submissions to beginners@lists.squeakfoundation.org
To subscribe or unsubscribe via the World Wide Web, visit http://lists.squeakfoundation.org/mailman/listinfo/beginners or, via email, send a message with subject or body 'help' to beginners-request@lists.squeakfoundation.org
You can reach the person managing the list at beginners-owner@lists.squeakfoundation.org
When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..."
Today's Topics:
- Re: Using squeak with a script? (H. Hirzel)
- Re: Beginner Morphic Question (Tim Cuthbertson)
- Re: Beginner Morphic Question (H. Hirzel)
Message: 1 Date: Wed, 22 Feb 2017 15:49:35 +0100 From: "H. Hirzel" hannes.hirzel@gmail.com To: "A friendly place to get answers to even the most basic questions about Squeak." beginners@lists.squeakfoundation.org Subject: Re: [Newbies] Using squeak with a script? Message-ID: <CAGQxfVh_a3V8qotwfQn=BMF4Rbq098hG=BZjHjs=cph3SqG32Q @mail.gmail.com> Content-Type: text/plain; charset=UTF-8
Maybe
ExternalCommandShell http://wiki.squeak.org/squeak/6023
this is of some help?
--Hannes
On 2/22/17, Göran Krampe goran@krampe.se wrote:
On 21/02/17 20:51, Jacques Harmand wrote:
Hi list, I try to use squeak to execute the following basic Smalltalk script (in a file "hello.st http://hello.st") "Transcript show: 'Hello world'; cr." from the command line with Squeak. This works as expected with both GNU Smalltalk and Pharo, but with Squeak nothing happens: Squeak seems to wait forever. If I add "Smalltalk snapshot: false andQuit: true." after the above line, the execution of the script terminates, but without printing anything.
I haven't looked closely at latest Squeak (perhaps Pharo has coupled Transcript to stdout for headless mode?), but Transcript is not the same thing as stdout - so you wouldn't see anything on stdout.
regards, Göran _______________________________________________ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Message: 2 Date: Wed, 22 Feb 2017 09:18:16 -0600 From: Tim Cuthbertson ratcheer@gmail.com To: beginners@lists.squeakfoundation.org Subject: Re: [Newbies] Beginner Morphic Question Message-ID: <CAAKzf7nSsRE=TSto62ae6FN--zN0bDOerSAooK61ioPMz7__nA@ mail.gmail.com> Content-Type: text/plain; charset="utf-8"
Date: Tue, 21 Feb 2017 22:41:36 +0100 From: "H. Hirzel" hannes.hirzel@gmail.com To: "A friendly place to get answers to even the most basic questions about Squeak." beginners@lists.squeakfoundation.org Subject: Re: [Newbies] Beginner Morphic Question Message-ID: <CAGQxfVjPLxhKo09-c9r-1XyUMT1qjCHXF4AWRFDuvkaaUsQHaw @mail.gmail.com> Content-Type: text/plain; charset=UTF-8
Have you seen this example
http://wiki.squeak.org/squeak/526
?
Code
http://wiki.squeak.org/squeak/uploads/MorphicGUIDemo.2.cs.gz
Could you please explain in more details what you would like to build?
--Hannes
On 2/21/17, Tim Cuthbertson ratcheer@gmail.com wrote:
I am trying to start a Morphic application. I have read a lot of
tutorials,
but I can't figure out how to program my submorphs.
I have created my top level as a subclass of PasteUpMorph, opened it, and embedded a ScriptableButton and, separately, a RoundRect into which I
have
embedded a TextMorph. (eventually, I plan to have five siblings of each
of
these submorphs, but I'm trying to start the project, simply).
I think I am supposed to start programming these submorphs from my PasteUpMorph, in which they are all directly or indirectly embedded. If I inspect the PasteUpMorph subclass, I can see the others as submorphs of
it,
but if I browse it, I don't see any objects into which to put any code. I just see an empty PasteUpMorph.
How do I access and code the submorphs within subclasses (I think) of my top level morph?
Tim Cuthbertson
No, I had not come across that example of "How to work with multiple text morphs". I will study it and your other link.
I am starting a project (just as an example to learn Squeak) to come up with a Yahtzee game clone. My text morphs will simply display a number that represents a randomly rolled die. The button morphs will allow the user to select whether a particular die is to be held from being rerolled. There will be an additional button to allow the user to re-roll unheld dice.
I have this model working in a text-based model, but I decided to try to re-implement it in a morphic GUI framework.
Thank you for the tips.
Tim Cuthbertson
Tim,
One of the articles on Morphic says you can create composite morphs either programatically, using addMorph, or using drag and drop from the Objects menu of the morphic World. I have done the latter, because it is easier to design my layout that way. Once that has been done, how do I address the submorph from a browser? If I inspect my button submorph, for example , all it will tell me about it is "a ScriptableButton<Button>(1364754)". I have no idea how to access that object in order to do anything with it. This is the crux of my questions.
This is, in my opinion, the most significant limitation of Morphic for interactive GUI creation. In the original Morphic in Self the way to handle this was to simply search through all your submorphs for the one you were interested in, usually by comparing the morphType string. In Squeak we can add properties to Morphs very easily so that would be one way to tag it. Something like:
| stopButton | stopButton := nil. self submorphsDo: [ :m | (m hasProperty: #stopButton) ifTrue: [ stopButton := m ] ]. stopButton ifNotNilDo: [ :b | b ... ].
Code like this will work even if there are no stopButtons at all and if you add more than one the code will just use the last one and ignore the others.
After creating the button you have to get its halo and use the red button (menu) with the debug->inspect morph option to set the #stopButton property.
An alternative to using specially created properties is to depend on the morph's name. In your case it is "a ScriptableButton<Button>(1364754)".. So:
self subMorphsDo: [ :m | (m name includesSubString: 'Button') ifTrue: ...
should work for you as long as there is only one button.
-- Jecel
Hi.
On Wed, Feb 22, 2017 at 10:52 AM, Tim Cuthbertson ratcheer@gmail.com wrote:
Please allow me to simplify my question. I need a basic answer.
One of the articles on Morphic says you can create composite morphs either programatically, using addMorph, or using drag and drop from the Objects menu of the morphic World. I have done the latter, because it is easier to design my layout that way. Once that has been done, how do I address the submorph from a browser? If I inspect my button submorph, for example, all it will tell me about it is "a ScriptableButton<Button>(1364754)". I have no idea how to access that object in order to do anything with it. This is the crux of my questions.
Thank you
Tim Cuthbertson
Hi, having been through this recently myself, let me share what I do.
First, expore the new morph, and name the morph, such as: self name: 'NameString' Then, when you need to find the morph later use #externalName, roughly like what Jecel suggests:
| stopButton | stopButton := nil. self allMorphsDo: [ :m | (m externalName = 'NameString') ifTrue: [ stopButton := m ] ]. stopButton ifNotNilDo: [ :b | b ... ].
In my code, I store all of the submorphs I want in local variables for later use.
(note that I use #allMorphsDo: - this check morphs embedded in other morphs in your main morph, which I did a lot of!).
-cbc
beginners@lists.squeakfoundation.org