From jrmaffeo at gmail.com Mon Sep 5 19:49:10 2016 From: jrmaffeo at gmail.com (John-Reed Maffeo) Date: Mon Sep 5 19:49:15 2016 Subject: [Newbies] Expand TextMorph to encompass entire string? Message-ID: Skipped content of type multipart/alternative-------------- next part -------------- A non-text attachment was scrubbed... Name: WrappingQuestion.png Type: image/png Size: 53949 bytes Desc: not available Url : http://lists.squeakfoundation.org/pipermail/beginners/attachments/20160905/0e2bfb55/WrappingQuestion-0001.png From ron at usmedrec.com Tue Sep 6 00:06:50 2016 From: ron at usmedrec.com (Ron Teitelbaum) Date: Tue Sep 6 00:07:23 2016 Subject: [Newbies] Expand TextMorph to encompass entire string? In-Reply-To: References: Message-ID: <03bc01d207d2$91ce2ae0$b56a80a0$@usmedrec.com> From: John-Reed Maffeo Sent: Monday, September 5, 2016 3:49 PM Total Morphic newbie here - I am trying to build a simple app with two panes (BorderedRectangles), each pane contains a column of rows. Each row contains a String for a label and a TextMorph to contain data that I want to display and possibly edit. Some of the TextMorphs contain long strings which cause the parent pane to expand out past the boundaries of the SystemWindow which contains it. I can't figure out how to limit the width of the row and let the height of the TextMorph vary based on the size of its contents. Any suggestions? [Ron Teitelbaum] Hi John-Reed, There are a number of method available to you on TextMorph. Browse TextMorph and press the instVars button. Select wrapFlag to see Accesses to that. In general the TextMorph has methods that should update the text to wrap the contents when you update or add text. You can also probably wrap the text manually (calling the wrap method yourself) as you add it depending on the width of the string you are adding. Also look for how to set the height of the row, and set that based on the results of the number of lines returned from the wrapping times the font height + some bounds between lines. It may do that already in some cases (not reading the code so not sure). In general you need some sort of compose method that looks for all the variables. The length of the string, the width of the column, the font size, and it should trim the strings based on width to rows (possibly in something like a paragraph), and set the height of the row to accommodate the string, and possibly add a scroll bar if it doesn?t fit. (remember to add the width of the scroll bar in your compose method). That method needs to be called whenever something changes, like when the component is resized or new text is added or removed. I would think that there is already a method that does all this so start with the wrap flag method and see how others are doing the same thing. Not sure if that is much help but you never know! All the best, Ron Teitelbaum jrm -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20160905/d67231cd/attachment.htm From dnorton at mindspring.com Tue Sep 6 00:58:22 2016 From: dnorton at mindspring.com (Dan Norton) Date: Tue Sep 6 00:58:27 2016 Subject: [Newbies] Expand TextMorph to encompass entire string? In-Reply-To: <03bc01d207d2$91ce2ae0$b56a80a0$@usmedrec.com> References: , <03bc01d207d2$91ce2ae0$b56a80a0$@usmedrec.com> Message-ID: <57CE14AE.23684.25AE72F@dnorton.mindspring.com> Hi John, It might be better to separate the labels from the text morph. Each of your current panes would contain two morphs: a list morph with the labels and beside it a text pane with the text associated with the selected label. Text panes wrap text well, but list panes do not. - Dan Norton From jrmaffeo at gmail.com Thu Sep 8 02:37:12 2016 From: jrmaffeo at gmail.com (John-Reed Maffeo) Date: Thu Sep 8 02:37:15 2016 Subject: [Newbies] Expand TextMorph to encompass entire string? In-Reply-To: <57CE14AE.23684.25AE72F@dnorton.mindspring.com> References: <03bc01d207d2$91ce2ae0$b56a80a0$@usmedrec.com> <57CE14AE.23684.25AE72F@dnorton.mindspring.com> Message-ID: Ron / Dan, Thanks. I have resolved the issue, by trying a lot of different, minor modifications to my methods; 59 versions of the most problematic one! The answer to my question seems to be rooted in my choice of a #layoutPolicy: ( btw, what is the appropriate use of the # sign when talking about Smalltalk code?) and specifying the height of containing morph based on the height of the largest contained morph. Comment to anyone reading this in search of information, be patient and confident of finding a solution. Keep searching for answers and asking questions. ---- begin createEditMorphFor: dataItem title: string "Use a standard definition of the data entry elements in the form. The changes I make here will propagate to all the items in the form and keep the calling method cleaner" | container contents title | container := BorderedMorph new. container color: Color tan. container layoutPolicy: ProportionalLayout new. container borderColor: Color tan. container hResizing: #spaceFill; hResizing: #spaceFill. title := StringMorph contents: string. title emphasis: 1. contents :=TextMorph new contents: dataItem. contents wrapFlag: true. container height: contents height. container addMorph: title fullFrame:((LayoutFrame fractions: (0.0 @ 0.0 corner: 0.3@ 1))). ^ container addMorph: contents fullFrame:((LayoutFrame fractions: (0.3 @ 0.0 corner: 1.0 @ 1.0))). --- end On Mon, Sep 5, 2016 at 5:58 PM, Dan Norton wrote: > Hi John, > > It might be better to separate the labels from the text morph. Each of > your current panes > would contain two morphs: a list morph with the labels and beside it a > text pane with the text > associated with the selected label. Text panes wrap text well, but list > panes do not. > > - Dan Norton > > _______________________________________________ > Beginners mailing list > Beginners@lists.squeakfoundation.org > http://lists.squeakfoundation.org/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20160907/b5a9ac33/attachment.htm From ron at usmedrec.com Thu Sep 8 02:58:48 2016 From: ron at usmedrec.com (Ron Teitelbaum) Date: Thu Sep 8 02:59:25 2016 Subject: [Newbies] Expand TextMorph to encompass entire string? In-Reply-To: References: <03bc01d207d2$91ce2ae0$b56a80a0$@usmedrec.com> <57CE14AE.23684.25AE72F@dnorton.mindspring.com> Message-ID: <084301d2097c$ec3d7110$c4b85330$@usmedrec.com> From: John-Reed Maffeo Sent: Wednesday, September 7, 2016 10:37 PM Ron / Dan, Thanks. I have resolved the issue, by trying a lot of different, minor modifications to my methods; 59 versions of the most problematic one! [Ron Teitelbaum] Excellent I?m glad you figured it out! The answer to my question seems to be rooted in my choice of a #layoutPolicy: ( btw, what is the appropriate use of the # sign when talking about Smalltalk code? [Ron Teitelbaum] # followed by some string literal indicates a symbol which are great for things like parameters (#spaceFill) which are easy to compare. In the context of discussing code in an email I will sometimes use #foo to indicate a method name but I?m also likely to use Object >> foo or anObject >> foo because of how the debugger shows messages. Had you not asked the question ?my choice of a #layoutPolicy: ? was perfectly understandable. ) and specifying the height of containing morph based on the height of the largest contained morph. Comment to anyone reading this in search of information, be patient and confident of finding a solution. Keep searching for answers and asking questions. ---- begin createEditMorphFor: dataItem title: string "Use a standard definition of the data entry elements in the form. The changes I make here will propagate to all the items in the form and keep the calling method cleaner" | container contents title | container := BorderedMorph new. container color: Color tan. container layoutPolicy: ProportionalLayout new. container borderColor: Color tan. container hResizing: #spaceFill; hResizing: #spaceFill. title := StringMorph contents: string. title emphasis: 1. contents :=TextMorph new contents: dataItem. contents wrapFlag: true. container height: contents height. container addMorph: title fullFrame:((LayoutFrame fractions: (0.0 @ 0.0 corner: 0.3@ 1))). ^ container addMorph: contents fullFrame:((LayoutFrame fractions: (0.3 @ 0.0 corner: 1.0 @ 1.0))). --- end On Mon, Sep 5, 2016 at 5:58 PM, Dan Norton wrote: Hi John, It might be better to separate the labels from the text morph. Each of your current panes would contain two morphs: a list morph with the labels and beside it a text pane with the text associated with the selected label. Text panes wrap text well, but list panes do not. - Dan Norton _______________________________________________ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20160907/5f6f2b31/attachment-0001.htm From stephan at stack.nl Fri Sep 9 10:15:43 2016 From: stephan at stack.nl (Stephan Eggermont) Date: Fri Sep 9 10:16:10 2016 Subject: [Newbies] Re: Expand TextMorph to encompass entire string? In-Reply-To: References: <03bc01d207d2$91ce2ae0$b56a80a0$@usmedrec.com> <57CE14AE.23684.25AE72F@dnorton.mindspring.com> Message-ID: On 08/09/16 04:37, John-Reed Maffeo wrote: > The answer to my question seems to be rooted in my choice of a > #layoutPolicy:...and specifying the height of containing > morph based on the height of the largest contained morph. Indeed. I've found it helpful to copy one of the complex layoutPolicies and strip it to do just what I needed. All those features make understanding difficult. Stephan From rpboland at gmail.com Thu Sep 22 01:34:01 2016 From: rpboland at gmail.com (Ralph Boland) Date: Thu Sep 22 01:34:05 2016 Subject: [Newbies] generating animations Message-ID: I am creating an educational computer game in Squeak in which I need to have animals (cats, dogs, birds, possibly other animals) move mostly horizontally across the screen. (Vertical motion is also possible but this would just be a bonus.) An animal will be in a square box (not sure if boxes will have a visible boundary) of sizes varying according to screen size. For a 1024x768 screen the boxes would be 13x13 pixels. For a 1920x1080 screen the boxes would be 24x24 pixesl. etc. The animations don't need to be great; adequate to entertain a child of age 4-10 yrs. I am not interested in animation per say and want to be able to write this code with a minimal amount of effort. Can anyone suggest where I can learn how to do this? If there is code that I can copy and modify that would be great. P.S. In the case of cats I am also in an animation of the cat turning itself right side up from upside down as it falls. P.P.S. Also neat would be of cats/dogs jumping up onto a ledge but this would just be a bonus. I am planning for the code to be open source and free. And pointers to code or documentation on how to write such code much appreciated. If any animators out there are interested in doing the animation part of my game please contact me. Thanks Ralph Boland rpboland@gmail.com From ron at usmedrec.com Thu Sep 22 01:56:40 2016 From: ron at usmedrec.com (Ron Teitelbaum) Date: Thu Sep 22 01:57:09 2016 Subject: [Newbies] generating animations In-Reply-To: References: Message-ID: <1f1f01d21474$902a7870$b07f6950$@usmedrec.com> Hi Ralph, Have you seen scratch? https://scratch.mit.edu/ All the best, Ron Teitelbaum -----Original Message----- From: beginners-bounces@lists.squeakfoundation.org [mailto:beginners-bounces@lists.squeakfoundation.org] On Behalf Of Ralph Boland Sent: Wednesday, September 21, 2016 9:34 PM To: beginners@lists.squeakfoundation.org Subject: [Newbies] generating animations I am creating an educational computer game in Squeak in which I need to have animals (cats, dogs, birds, possibly other animals) move mostly horizontally across the screen. (Vertical motion is also possible but this would just be a bonus.) An animal will be in a square box (not sure if boxes will have a visible boundary) of sizes varying according to screen size. For a 1024x768 screen the boxes would be 13x13 pixels. For a 1920x1080 screen the boxes would be 24x24 pixesl. etc. The animations don't need to be great; adequate to entertain a child of age 4-10 yrs. I am not interested in animation per say and want to be able to write this code with a minimal amount of effort. Can anyone suggest where I can learn how to do this? If there is code that I can copy and modify that would be great. P.S. In the case of cats I am also in an animation of the cat turning itself right side up from upside down as it falls. P.P.S. Also neat would be of cats/dogs jumping up onto a ledge but this would just be a bonus. I am planning for the code to be open source and free. And pointers to code or documentation on how to write such code much appreciated. If any animators out there are interested in doing the animation part of my game please contact me. Thanks Ralph Boland rpboland@gmail.com _______________________________________________ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners From ron at usmedrec.com Thu Sep 22 01:59:54 2016 From: ron at usmedrec.com (Ron Teitelbaum) Date: Thu Sep 22 02:00:23 2016 Subject: [Newbies] generating animations In-Reply-To: <1f1f01d21474$902a7870$b07f6950$@usmedrec.com> References: <1f1f01d21474$902a7870$b07f6950$@usmedrec.com> Message-ID: <1f2c01d21475$03fb5da0$0bf218e0$@usmedrec.com> And Etoys! http://www.squeakland.org/ All the best, Ron Teitelbaum -----Original Message----- From: beginners-bounces@lists.squeakfoundation.org [mailto:beginners-bounces@lists.squeakfoundation.org] On Behalf Of Ron Teitelbaum Sent: Wednesday, September 21, 2016 9:57 PM To: 'A friendly place to get answers to even the most basic questions about Squeak.' Subject: RE: [Newbies] generating animations Hi Ralph, Have you seen scratch? https://scratch.mit.edu/ All the best, Ron Teitelbaum -----Original Message----- From: beginners-bounces@lists.squeakfoundation.org [mailto:beginners-bounces@lists.squeakfoundation.org] On Behalf Of Ralph Boland Sent: Wednesday, September 21, 2016 9:34 PM To: beginners@lists.squeakfoundation.org Subject: [Newbies] generating animations I am creating an educational computer game in Squeak in which I need to have animals (cats, dogs, birds, possibly other animals) move mostly horizontally across the screen. (Vertical motion is also possible but this would just be a bonus.) An animal will be in a square box (not sure if boxes will have a visible boundary) of sizes varying according to screen size. For a 1024x768 screen the boxes would be 13x13 pixels. For a 1920x1080 screen the boxes would be 24x24 pixesl. etc. The animations don't need to be great; adequate to entertain a child of age 4-10 yrs. I am not interested in animation per say and want to be able to write this code with a minimal amount of effort. Can anyone suggest where I can learn how to do this? If there is code that I can copy and modify that would be great. P.S. In the case of cats I am also in an animation of the cat turning itself right side up from upside down as it falls. P.P.S. Also neat would be of cats/dogs jumping up onto a ledge but this would just be a bonus. I am planning for the code to be open source and free. And pointers to code or documentation on how to write such code much appreciated. If any animators out there are interested in doing the animation part of my game please contact me. Thanks Ralph Boland rpboland@gmail.com _______________________________________________ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners _______________________________________________ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners From joseph.alotta at gmail.com Fri Sep 23 05:40:33 2016 From: joseph.alotta at gmail.com (Joseph Alotta) Date: Fri Sep 23 05:40:42 2016 Subject: [Newbies] remove allInstances? Message-ID: <2159583B-3F39-474E-81D3-1AA37CF855D4@gmail.com> Greetings, The main program I am working on now is called Books. If I evaluate Books allInstances => anOrderedCollection( aBook aBook aBook ) How do I set them all equal to nil like Books removeAllInstances. Books allInstances => anOrderedCollection(). Sincerely, Joseph. From rudolf-rednose at gmx.de Fri Sep 23 09:50:19 2016 From: rudolf-rednose at gmx.de (Rudolf Rednose) Date: Fri Sep 23 09:50:22 2016 Subject: Aw: [Newbies] remove allInstances? In-Reply-To: <2159583B-3F39-474E-81D3-1AA37CF855D4@gmail.com> References: <2159583B-3F39-474E-81D3-1AA37CF855D4@gmail.com> Message-ID: Caution: lowskilled hobbyist ? anyway: ? Hi Joseph, Smalltalk garbageCollect does that automatically for you BUT it removes only objects that are not in connection with other objects. ? So you have to cut loose all connections from other objects to your Book instances. ? Maybe you have variables within a workspace pointing to some Book instances. Or a list object with references to all of your books. (How do you get to your books?) ? Even an inspector, explorer or debugger pointing to a Book instance keeps the garbagecollector from removing them. ? Hope that helps a little Rudolf ? --? ? ? Gesendet:?Freitag, 23. September 2016 um 07:40 Uhr Von:?"Joseph Alotta" An:?beginners@lists.squeakfoundation.org Betreff:?[Newbies] remove allInstances? Greetings, The main program I am working on now is called Books. If I evaluate Books allInstances => anOrderedCollection( aBook aBook aBook ) How do I set them all equal to nil like Books removeAllInstances. Books allInstances => anOrderedCollection(). Sincerely, Joseph. _______________________________________________ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners From lists at dcorking.com Fri Sep 23 09:54:11 2016 From: lists at dcorking.com (David Corking) Date: Fri Sep 23 09:54:44 2016 Subject: [Newbies] remove allInstances? In-Reply-To: References: <2159583B-3F39-474E-81D3-1AA37CF855D4@gmail.com> Message-ID: Joseph: I agree with Rudolf. See also http://forum.world.st/Deleting-an-instance-td3328590.html Have fun! David From Lou at Keystone-Software.com Fri Sep 23 13:03:40 2016 From: Lou at Keystone-Software.com (Louis LaBrunda) Date: Fri Sep 23 13:04:26 2016 Subject: [Newbies] remove allInstances? References: <2159583B-3F39-474E-81D3-1AA37CF855D4@gmail.com> Message-ID: Hi Joseph, Try: Books allInstances do: [:b | b become: nil]. Lou On Fri, 23 Sep 2016 00:40:33 -0500, Joseph Alotta wrote: >Greetings, > >The main program I am working on now is called Books. > >If I evaluate > >Books allInstances => anOrderedCollection( aBook aBook aBook ) > >How do I set them all equal to nil like > >Books removeAllInstances. > >Books allInstances => anOrderedCollection(). > > >Sincerely, > >Joseph. -- Louis LaBrunda Keystone Software Corp. SkypeMe callto://PhotonDemon From joseph.alotta at gmail.com Fri Sep 23 14:14:44 2016 From: joseph.alotta at gmail.com (Joseph Alotta) Date: Fri Sep 23 14:19:42 2016 Subject: [Newbies] Re: remove allInstances? In-Reply-To: References: <2159583B-3F39-474E-81D3-1AA37CF855D4@gmail.com> Message-ID: Nice. That causes Squeak 5.0 to unexpectedly quit. But when I start again, there are no instances of Books. Sincerely, Joseph > On Sep 23, 2016, at 7:59 AM, Louis LaBrunda [via Smalltalk] wrote: > > Books allInstances do: [:b | b become: nil]. -- View this message in context: http://forum.world.st/remove-allInstances-tp4916693p4916813.html Sent from the Squeak - Beginners mailing list archive at Nabble.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20160923/3e3f64fe/attachment-0001.htm From ron at usmedrec.com Fri Sep 23 14:28:01 2016 From: ron at usmedrec.com (Ron Teitelbaum) Date: Fri Sep 23 14:28:38 2016 Subject: [Newbies] Re: remove allInstances? In-Reply-To: References: <2159583B-3F39-474E-81D3-1AA37CF855D4@gmail.com> Message-ID: <018d01d215a6$b0e381a0$12aa84e0$@usmedrec.com> Woop woop, alarm alarm, error error. Sorry my alarm just went off. If Squeak quit after a become and you are seeing differences after not saving things, something is wrong. Be afraid, be very afraid. All the best, Ron Teitelbaum From: beginners-bounces@lists.squeakfoundation.org [mailto:beginners-bounces@lists.squeakfoundation.org] On Behalf Of Joseph Alotta Sent: Friday, September 23, 2016 10:15 AM To: beginners@lists.squeakfoundation.org Subject: [Newbies] Re: remove allInstances? Nice. That causes Squeak 5.0 to unexpectedly quit. But when I start again, there are no instances of Books. Sincerely, Joseph > On Sep 23, 2016, at 7:59 AM, Louis LaBrunda [via Smalltalk] <[hidden email]> wrote: > > Books allInstances do: [:b | b become: nil]. _____ View this message in context: Re: remove allInstances? Sent from the Squeak - Beginners mailing list archive at Nabble.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20160923/5fec5336/attachment.htm From joseph.alotta at gmail.com Fri Sep 23 14:48:21 2016 From: joseph.alotta at gmail.com (Joseph Alotta) Date: Fri Sep 23 14:53:19 2016 Subject: [Newbies] Re: remove allInstances? In-Reply-To: <018d01d215a6$b0e381a0$12aa84e0$@usmedrec.com> References: <2159583B-3F39-474E-81D3-1AA37CF855D4@gmail.com> <018d01d215a6$b0e381a0$12aa84e0$@usmedrec.com> Message-ID: maybe they were garbage collected before the crash or on startup. > On Sep 23, 2016, at 9:23 AM, Ron Teitelbaum [via Smalltalk] wrote: > > Woop woop, alarm alarm, error error. > > > > Sorry my alarm just went off. If Squeak quit after a become and you are seeing differences after not saving things, something is wrong. > > > > Be afraid, be very afraid. > > > > All the best, > > > > Ron Teitelbaum > > > > From: [hidden email] [mailto:[hidden email]] On Behalf Of Joseph Alotta > Sent: Friday, September 23, 2016 10:15 AM > To: [hidden email] > Subject: [Newbies] Re: remove allInstances? > > > > Nice. That causes Squeak 5.0 to unexpectedly quit. > > But when I start again, there are no instances of Books. > > Sincerely, > > Joseph > > > > > On Sep 23, 2016, at 7:59 AM, Louis LaBrunda [via Smalltalk] <[hidden email]> wrote: > > > > Books allInstances do: [:b | b become: nil]. > > > View this message in context: Re: remove allInstances? > Sent from the Squeak - Beginners mailing list archive at Nabble.com. > > > _______________________________________________ > Beginners mailing list > [hidden email] > http://lists.squeakfoundation.org/mailman/listinfo/beginners > > > If you reply to this email, your message will be added to the discussion below: > http://forum.world.st/remove-allInstances-tp4916693p4916819.html > To start a new topic under Squeak - Beginners, email ml-node+s1294792n107673h12@n4.nabble.com > To unsubscribe from Squeak - Beginners, click here. > NAML -- View this message in context: http://forum.world.st/remove-allInstances-tp4916693p4916832.html Sent from the Squeak - Beginners mailing list archive at Nabble.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20160923/02600b5a/attachment.htm From Das.Linux at gmx.de Fri Sep 23 17:47:31 2016 From: Das.Linux at gmx.de (Tobias Pape) Date: Fri Sep 23 17:47:35 2016 Subject: [Newbies] remove allInstances? In-Reply-To: References: <2159583B-3F39-474E-81D3-1AA37CF855D4@gmail.com> Message-ID: Hi, On 23.09.2016, at 15:03, Louis LaBrunda wrote: > Hi Joseph, > > Try: > > Books allInstances do: [:b | b become: nil]. I would advise against that. Become is a sledgehammer and you're about to crush ants with it. What happens with 'a become: b' ? All occurrences of 'a' in the image are replaced by 'b' and (this is important) vice versa. So, all 'b's are replaces by 'a'. With your example, all occurrences of nil are replaced with an instance of Book, in the whole image. This is most probably _not_ what you want. These two versions work better: Books allInstances do: [:b | b becomeForward: nil]. Books allInstances do: [:b | b become: Object new]. The first avoids the 'vice versa' part of become: and is more safe, the second one does the switcharoo with a new object every time, wich is also more safe. Anyhow, I presume that your intent is to track down instances of Book wich you don't know where they are. Maybe they are actually unreferenced already, so Smalltalk garbageCollect can get already rid of them. If that does not help, you can try to track the references down by doing Books allInstances do: [:b | b chasePointers] which will open a PointerFinder for each of the rouge object so you can inspect where they get referenced. I hope this helps. Best regards -Tobias > > Lou > > On Fri, 23 Sep 2016 00:40:33 -0500, Joseph Alotta wrote: > >> Greetings, >> >> The main program I am working on now is called Books. >> >> If I evaluate >> >> Books allInstances => anOrderedCollection( aBook aBook aBook ) >> >> How do I set them all equal to nil like >> >> Books removeAllInstances. >> >> Books allInstances => anOrderedCollection(). >> >> >> Sincerely, >> >> Joseph. > -- > Louis LaBrunda > Keystone Software Corp. > SkypeMe callto://PhotonDemon > > _______________________________________________ > Beginners mailing list > Beginners@lists.squeakfoundation.org > http://lists.squeakfoundation.org/mailman/listinfo/beginners From Lou at Keystone-Software.com Fri Sep 23 18:09:05 2016 From: Lou at Keystone-Software.com (Louis LaBrunda) Date: Fri Sep 23 18:09:45 2016 Subject: [Newbies] remove allInstances? References: <2159583B-3F39-474E-81D3-1AA37CF855D4@gmail.com> Message-ID: <3qraub5gk5ej09osbonr0dv15kmrr271eh@4ax.com> Hi, Tobias is right. I'm use to the VA Smalltalk one way #become: and forgot about Squeaks two way #become:, sorry about that. Lou On Fri, 23 Sep 2016 19:47:31 +0200, Tobias Pape wrote: >Hi, > >On 23.09.2016, at 15:03, Louis LaBrunda wrote: > >> Hi Joseph, >> >> Try: >> >> Books allInstances do: [:b | b become: nil]. > >I would advise against that. Become is a sledgehammer and you're about to crush ants with it. > >What happens with 'a become: b' ? All occurrences of 'a' in the image are replaced by 'b' and (this is important) vice versa. >So, all 'b's are replaces by 'a'. > >With your example, all occurrences of nil are replaced with an instance of Book, in the whole image. This is most probably _not_ what you want. > >These two versions work better: > >Books allInstances do: [:b | b becomeForward: nil]. >Books allInstances do: [:b | b become: Object new]. > >The first avoids the 'vice versa' part of become: and is more safe, the second one >does the switcharoo with a new object every time, wich is also more safe. > >Anyhow, I presume that your intent is to track down instances of Book wich you don't know where they are. > >Maybe they are actually unreferenced already, so > Smalltalk garbageCollect >can get already rid of them. > >If that does not help, you can try to track the references down by doing > > Books allInstances do: [:b | b chasePointers] > >which will open a PointerFinder for each of the rouge object so you can inspect where they get referenced. > >I hope this helps. > >Best regards > -Tobias > > >> >> Lou >> >> On Fri, 23 Sep 2016 00:40:33 -0500, Joseph Alotta wrote: >> >>> Greetings, >>> >>> The main program I am working on now is called Books. >>> >>> If I evaluate >>> >>> Books allInstances => anOrderedCollection( aBook aBook aBook ) >>> >>> How do I set them all equal to nil like >>> >>> Books removeAllInstances. >>> >>> Books allInstances => anOrderedCollection(). >>> >>> >>> Sincerely, >>> >>> Joseph. >> -- >> Louis LaBrunda >> Keystone Software Corp. >> SkypeMe callto://PhotonDemon >> >> _______________________________________________ >> Beginners mailing list >> Beginners@lists.squeakfoundation.org >> http://lists.squeakfoundation.org/mailman/listinfo/beginners -- Louis LaBrunda Keystone Software Corp. SkypeMe callto://PhotonDemon