Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing Classes
Message
From
17/03/1999 12:33:35
 
 
To
17/03/1999 01:27:45
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00198394
Message ID:
00198642
Views:
14
Bonnie,

I had just the same question a few days ago and the answer came from here on the UT...

Here's a QD to change base classes that worked great for me. Of course, run this on a COPY of your .scx files first :)
CLOS ALL
CLEA ALL
CLEA

SET EXCL ON
SET TALK ON
SET SAFE OFF

ADIR(aForms,'*.scx')
FOR i = 1 TO ALEN(aForms, 1)
    FIXCLASS2( aForms[i, 1] )
ENDFOR

*------------------------------------------------------
PROCEDURE FIXCLASS2
    PARAMETERS cFormName

    USE ( cFormName ) IN 0

    * this line changes the base class for all controls to my base classes by adding a prefix of "lm_"
    REPLACE ALL CLASS WITH "lm_" + ALLTRIM(CLASS), ;
        CLASSLOC WITH "C:\LM\PROJECTS\CLASSES\LMCLASS.VCX" ;
        FOR UPPER(TRIM(CLASS))+',' $ ;
        "CHECKBOX,COMBOBOX,COMMANDBUTTON,COMMANDGROUP,EDITBOX,FORM,GRID,IMAGE,LABEL,LINE,LISTBOX,OPTIONBUTTON,OPTIONGROUP,PAGEFRAME,SHAPE,SPINNER,TEXTBOX,CONTAINER," ;
        AND UPPER(CLASS)<>"LM_"

    *!*	    * this line changes the base class for all controls back to the VFP base classes by removine the "lm_" prefix
    *!*	    REPLACE ALL CLASS WITH STRTRAN( CLASS, "lm_","" ), CLASSLOC WITH "" ;
    *!*	        FOR UPPER(TRIM(CLASS))+',' $ ;
    *!*	        "CHECKBOX,COMBOBOX,COMMANDBUTTON,COMMANDGROUP,EDITBOX,FORM,GRID,IMAGE,LABEL,LINE,LISTBOX,OPTIONBUTTON,OPTIONGROUP,PAGEFRAME,SHAPE,SPINNER,TEXTBOX,CONTAINER," ;
    *!*	        AND UPPER(CLASS)="lm_"
    USE
HTH

Larry

>Hmmmm ... maybe I should have put this question under "Form Designer" rather than "Classes", because it's an object on the instantiated form that I'm talking about, not in a form class.
>
>But thanks anyway! :-)
>
>Bonnie
>
>>>The answer to this question is probably a resounding "NO", but I have to ask anyway.
>>>
>>>I've just completed coding all the methods for an object that I had dragged onto my form from a class library and, upon testing it when it didn't work, I realized that I had used the parent class to the object class that I really intended to use. Is there an easy way to fix this? I know that I could drag the correct class onto the form, cut and paste all the properties and method code into the new object and then delete the old one, but I didn't want to have to go thru all this trouble if it's not necessary.
>>>
>>>Any quick answers???
>>>
>>>TIA,
>>> Bonnie
>>
>>You can open a form in the class browser and change the class for any object on the form.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform