Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating class questions
Message
De
22/02/2001 02:38:34
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
20/02/2001 22:21:58
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00477544
Message ID:
00478292
Vues:
20
Virusim,
If I read you right opendevice() is a method of a form class and oleInput, oleOutput are members of the form. IOW thisform and this point to same object and no parent. Then opendevice() method should read :
with this && not this.parent

Also with createobject it wouldn't have a parent (before someone comes out saying no it has a parent I must admit yes it has a parent but not in the context we are talking about - simply meaning this.parent wouldn't return an object). Try thisform.addobject or thisform.newobject instead of createobject then. But keep in mind still :
'with this'
would be required to refer the class methods and objects (oleInput, oleOutput objects and opendevice method are all members of the class itself not a parent's).
Cetin

>Hi,
>
>Thank a lot for your advise.
>I actually use the visual class designer to do it. But I still
>encountered problem in using the class. Please advise and help
>as I am green in this area.
>
>I created a class name test with 02 method like opendevice and closedevice,
>subclass from form.
>
>On the form of my class, I placed 02 ActiveX control, giving name of
>oleInput and oleOutput. The oleinput and oleoutput had their own methods
>and properties like opendevice and closedevice
>
>So, on my class form, I add the following code in my class form method
>as show below
>
>Test.OpenDevice Method PROCEDURE
>
> WITH THIS.PARENT
>
> .oleInput.OpenDevice
> .oleOutput.OpenDeice
>
> ENDWITH
>
>ENDPROC
>
>
>On my application, with a form and a command button, I had the following code
>
>PUBLIC odevice = CREATEOBJECT('test')
>
>Exit.Click Procedure
>
> test.OpenDevice()
>
>EndProc
>
>
>On clicking the button, it give error of 'PARENT is not a object'.
>
>I am confused, what is wrong, please advise and help. Thank a lot
>
>
>
>
>
>>>Hi,
>>>
>>>I like to learn more about creating class library for my application use.
>>>However, I often encountered the problems of not know whether which
>>>control especially ActiveX which I am using can be sub-class from.
>>>
>>>For example, I am creating a new class, to include a timer and 02 ActiveX
>>>controls, since it can simplify my coding. However, I do not
>>>know to sub-class from form, custom or control ? Please advise
>>>and help. Thank you
>>
>>Virusim,
>>I do like this :
>>Create a test form and put controls on it.
>>Add code to controls till I get the effect I want and add some form props-methods as necessary.
>>In controls' code instead of saying thisform I say this.parent (or this.parent.parent) and use with...endwith to possible extent.
>>When I'm satisfied with behaviour I select the controls and Saveasclass (selected controls). This creates a 'container' based class.
>>I modify the saved class to copy&paste properties-methods formerly added to the form (either visually or by hacking the .vcx).
>>
>>Last step sounds to be cumbersome but since it reduces testing phase (as a form) it's something I can live with (IMHO better than directly creating container and adding it to form for testing).
>>
>>As another final step I put the class to a new test form and test.
>>Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform