Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding code to existing grid textboxes
Message
 
To
18/07/2007 07:48:01
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Vista
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01241212
Message ID:
01241441
Views:
20
>John,
>You can look at it as a two part problem. What would I do with the grids that have been already designed and what would I do for new grids. For new grids you could simply use member* properties available in VFP9 (or like me have your own custom grids that build themselves with custom controls).
>For existing ones you can't simply change with a custom grid building its own members because then you'd lose already coded methods if any. So for existing an 'in place' class changing is better.
>
>Now your current problem is existing grids and you'd be more than happy if you could change all textboxes with your textbox class, right? Go for a hack! It's simple and fast (ie: 100 forms would be done in less than 100 seconds). Backup and do it with courage:)
>
>lcMyTextBoxClassName = "myTxtClass"
>lcMyTextBoxClassLib = "c:\my libs\myClassLib.vcx"
>lcFormsFolder = getdir()
>for ix=1 to adir(aForms, addbs(m.lcFormsFolder)+'*.scx')
>use ( addbs(m.lcFormsFolder) + aForms[m.ix,1] )
>replace class with m.lcMyTextBoxClassName, ;
> classloc with m.lcMyTextBoxClassLib ;
> for lower(baseclass) == 'textbox' and empty(classloc)
>use
>compile form ( addbs(m.lcFormsFolder) + aForms[m.ix,1] )
>endfor
>
You can extend the code to do that only for textboxes which are in a grid (check parent), create a log of what have changed, what were already edited properties/methods etc.
>Cetin

Cetin,
I was wondering if this could be done. I would need to add a few things to your code as we only want to change out text boxes that are from the VFP base class but that's not a problem. I the previous post in this thread you will see where Borislav came up with some code for the grid init that swaps them out at runtime. It seems to work well on the test form I did and I am going to put it into the grid base class and see what happens. If we don't run into any problems I will probably swap them all out using your code.
Thanks for the help.
Beer is proof that God loves man, and wants him to be happy. - Benjamin Franklin
John J. Henn
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform