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 ... * No procedure or function statement here! BackColor=ThisForm.BackColor but VFP does not like this. Apparently, there is some limitation to the expression being evaluable at compile-time. I had to create an Init to do the initialisation.
Or am I missing something? What are the limitations to the initialisation expression?
Sincerely,
Gene Wirchenko
If you want to have a shape backcolor as the form. Backcolor you could also Try to work with a shape with a transparant back Koen
Op wo 26 dec. 2018 om 04:15 schreef Gene Wirchenko genew@telus.net
Hello:
I have been experimenting with the Shape control. One of thethings that I wanted to do want to have one shape have the same colour as the form's BackColor. This led to define class ... * No procedure or function statement here! BackColor=ThisForm.BackColor but VFP does not like this. Apparently, there is some limitation to the expression being evaluable at compile-time. I had to create an Init to do the initialisation.
Or am I missing something? What are the limitations to theinitialisation expression?
Sincerely,
Gene Wirchenko
[excessive quoting removed by server]
On Tue, Dec 25, 2018 (Merry Christmas!) at 10:15 PM Gene Wirchenko < genew@telus.net> wrote:
Hello:
I have been experimenting with the Shape control. One of thethings 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.BackColorbut 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 theinitialisation 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...
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...
So if I scratch FoxPro behind the ears, it will go get my slippers?
Paul H. Tarver Email: paul@tpcqpc.com
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Ted Roche Sent: Wednesday, December 26, 2018 6:15 AM To: profoxtech@leafe.com Subject: Re: Initialising in a Class
On Tue, Dec 25, 2018 (Merry Christmas!) at 10:15 PM Gene Wirchenko < genew@telus.net> wrote:
Hello:
I have been experimenting with the Shape control. One of thethings 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.BackColorbut 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 theinitialisation 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...
On Wed, Dec 26, 2018 at 12:58 PM Paul H. Tarver paul@tpcqpc.com wrote:
So if I scratch FoxPro behind the ears, it will go get my slippers?
I think that's one of those things it would just twist it's head sideways and say something useless like "syntax error."
I could probably teach my dogs to go get my slippers, but once they got them, they'd hide in a corner and chew them up.
There are some things better to do yourself.
Kind of like LMGTFY!
:-) -K-
On Wed, Dec 26, 2018, 10:31 AM Ted Roche tedroche@gmail.com wrote:
On Wed, Dec 26, 2018 at 12:58 PM Paul H. Tarver paul@tpcqpc.com wrote:
So if I scratch FoxPro behind the ears, it will go get my slippers?
There are some things better to do yourself.
-- Ted Roche
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---