*************************************************
* Author : Ramani (Subramanian.G)
** FoxAcc Software / WInners Software
** ramani_g@yahoo.com
* 1. Purpose : To infuse new class name
* in the place of base class in forms
* 2. Does modification to all forms in the open projects
* ... SO open only the required project
* 3. Will ask you which base classes you want to modify
* ... with samples and you can add more or delete a few
* 4. After running the gsNewCls..
* ....... add the NewClass craeted to project
*
* 5. How run .. In the command window =gsNewCls()
*************************************************
** gsNewCls.PRG... Save the code as gsNewCls.PRG
*************************************************
[COLOR BLUE]
SET CONFIRM OFF
SET SAFETY OFF
** Accept the newClass name
cClass = INPUTBOX("Give a name for new class ?", ;
"New Class Name")
IF EMPTY(cClass)
=MESSAGEBOX("No class name given ",0+16,"I quit")
RETURN
ENDIF
** Create a table to refer for convertion
CREATE TABLE myClass (cBaseClass C(15), cNewClass C(15))
** Insert into this table some of the base classes and suggested NewClass
INSERT INTO myClass (cBaseClass, cNewClass) ;
VALUES ("TextBox","b_TextBox")
INSERT INTO myClass (cBaseClass, cNewClass) ;
VALUES ("CheckBox","b_CheckBox")
INSERT INTO myClass (cBaseClass, cNewClass) ;
VALUES ("EditBox","b_EditBox")
INSERT INTO myClass (cBaseClass, cNewClass) ;
VALUES ("Grid","b_Grid")
INSERT INTO myClass (cBaseClass, cNewClass) ;
VALUES ("Label","b_Label")
** Browse the table for developer input
** Use Ctrl+Y or Ctrl+T to insert or delete
BROW
SET DELETED ON
** Now create the new classes
SCAN FOR !EMPTY(cBaseClass) AND !EMPTY(cNewClass)
tBaseClass = ALLTRIM(LOWER(cBaseClass))
tNewClass = ALLTRIM(LOWER(cNewClass))
CREATE CLASS &tNewClass OF &cClass AS &tBaseClass NOWAIT
ENDSCAN
** Now the convertion
LOCAL cFormFile, i, p
FOR p = 1 TO application.Projects.Count
FOR i = 1 TO application.Projects(p).Files.Count
cFormFile = application.Projects(p).Files(i).NAME
IF UPPER(JUSTEXT(cFormFile)) = "SCX"
WAIT WINDOW cFormFile NOWAIT
SELECT 0
USE (cFormFile) ALIAS myForm
SCAN
SELECT myClass
LOCATE FOR ALLTRIM(UPPER(cBaseClass))== ;
ALLTRIM(UPPER(myForm.Class))
IF FOUND()
REPLACE myForm.Class WITH ;
ALLTRIM(LOWER(myClass.cNewClass)), ;
myForm.BaseClass WITH ;
ALLTRIM(LOWER(myClass.cBaseClass)), ;
myForm.ClassLoc WITH ;
ALLTRIM(LOWER(cClass))+".vcx"
ENDIF
SELECT myForm
ENDSCAN
USE
ENDIF
ENDFOR
ENDFOR
** Development ebnvironment
SET CONFIRM ON
SET SAFETY ON
SET DELETED OFF
CLOSE ALL
**
RETURN
*************************************************
** EOF
*************************************************
[/color]
** The code is provided as freeware with no warranty
** CAUTION : This will modify all forms in your project
** Use at your risk.
*************************************************
** Can be modified easily to redefine classes.
*************************************************
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.