Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Class definition problem
Message
 
To
29/05/2001 23:57:10
Jimi Lee
Pop Electronic Products Ltd.
Hong Kong, Hong Kong
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00512512
Message ID:
00512520
Views:
9
You need an lparameters in the init or the click.

>hi all,
>
>I'm gonna create an container object on a form and place a shape on it, where it can detect mouse click and do some stuff. The following code works fine:
>
>do form main
>for i=1 to 5  && to put 5 object on the form, named Room1 to Room5
>  main.addobject("Room"+alltrim(str(i)), "MyRoom")
>endfor
>
>define class MyRoom as container
>  add object "Detector" as MyShape
>
>  procedure Detector.click
>    wait window "You clicked me!"
>  endproc
>enddefine
>
>define class MyShape as shape
>  procedure init
>    with this
>      .borderstyle=0
>      .backstyle=0
>    endwith
>  endproc
>enddefine
>
>
>But I want to pass parameter to the MyShape object such that I can do different motion when user click on different MyRoom object.
>
>So I changed the MyRoom class as following, but it says "unknown member DEDECTOR" at the line "procedure Detector.click"
>
>define class MyRoom as container
>  procedure Init
>    this.addobject("Detector", "MyShape")
>  endproc
>
>  procedure Detector.click
>    wait window "You clicked me!"
>  endproc
>enddefine
>
>define class MyShape as shape
>  procedure init
>    with this
>      .borderstyle=0
>      .backstyle=0
>    endwith
>  endproc
>enddefine
>
>
>I also tried this code but it says "unknown member THIS"
>
>define class MyRoom as container
>  add object "Detector" as MyShape
>enddefine
>
>define class MyShape as shape
>  procedure init
>    with this
>      .borderstyle=0
>      .backstyle=0
>    endwith
>  endproc
>
>  procedure this.click
>    wait window "You clicked me!"
>  endproc
>enddefine
>
>
>So only the first set of code works, the other two not. What's wrong with them? No matter how, I only want to pass paramter to the class definitin such that I can determine which shape is clicked, any help please?
>
>Thanks in advance!
Eric Kleeman - EDS Consulting Services
MCP Visual FoxPro
MCSD C#.NET
Hua Hin Thailand
Los Angeles California
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform