So if I scratch FoxPro behind the ears, it will go get my slippers? Paul H. Tarver Email: [email protected]
-----Original Message----- From: ProfoxTech [mailto:[email protected]] On Behalf Of Ted Roche Sent: Wednesday, December 26, 2018 6:15 AM To: [email protected] Subject: Re: Initialising in a Class On Tue, Dec 25, 2018 (Merry Christmas!) at 10:15 PM Gene Wirchenko < [email protected]> wrote: > Hello: > > I have been experimenting with the Shape control. One of the > things that I wanted to do want to have one shape have the same > colour as the form's BackColor. This led to > define class ... > "MyShapeName As Shape"? Perhaps there's some clue there if you would share your code, or even a simple working example. * No procedure or function statement here! > BackColor=ThisForm.BackColor > but VFP does not like this. I think you are mistaken. VFP likes everything. Perhaps you mean it threw an error message? VFP likes to do that, but it's all in fun. VFP is not malicious. It's playful. I think of it more as a Golden Retriever than an undomesticated wolf, eager to please, but limited in vocabulary and intellect. It means well, but sometimes doesn't understand. Or perhaps you mean it fails to compile, or gives you an error when you save the file. VFP is not mean, it's trying to be helpful, although sometimes it's a bit misleading. Again, there is a way to ask for help. Supply info. If we can see the text of the error message, we can help. Apparently, there is some limitation to > the expression being evaluable at compile-time. I had to create an > Init to do the initialisation. > It seems like initializing the object in its Init() event is a pretty good idea. Before the Init() event runs, is it possible the object "ThisForm" doesn't exist? Or exists, but isn't "connected" to the form? Since the Init()s of object fire from the inside out (ref: https://www.tedroche.com/hackfox7/s4g376.html), it's possible that you can't refer to a container object from the inner contained object until later in the object's lifetime. In addition, having the initial value of object depend on something external to the object is introducing a dependency you might not want or might not be able to support. For example, you may want to test out the return value of a method on the Shape object from the command window, and have no need to construct a form to hold a shape you never need to see. And what did you put in the Init? And did it work? My first thought was perhaps the BackColor property didn't exist, or was spelled "Colour" in your version... ;) > Or am I missing something? What are the limitations to the > initialisation expression? > Looking at the references for Shape, https://www.tedroche.com/hackfox7/s4g539.html, and https://docs.microsoft.com/en-us/previous-versions/visualstudio/foxpro/63c8e f7d%28v%3dvs.71%29 I see indeed there is a BackColor property, so that's not likely the issue. I'm suspecting a container-relationship problem, but look forward to further clues... -- Ted Roche Ted Roche & Associates, LLC http://www.tedroche.com --- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html --- [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[email protected] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

