Hello,
after learning about oop as suggested you may start "the visual way" like this :
lets take a table /cursor srcdata with 10 columns colu1-colu10
Start a new project, in the project goto classes - new :
classname frm_myform (or whatever), based on form. Change to your needs (color, width,...)
You may also add propertys ("variables") and methods ("functions")
propertys can be accessed with thisform.propertyname = value, or read with m.value = thisform.propertyname
Methods contain code and can be called for example from a button, a timer, other methods, events (click), ....
saveit into a new library (vcx) myclasses.vcx
(you "subclass" the vfp formclass)
do similar with txtbox or button (text_whatever from textbox, btn_whatever from commandbutton).
Add propertys / methods to your needs, for example a method _setcaption() and a property _position (later use)
Change coolor, font , border, ...
saveit into a new library (vcx) myclasses.vcx
Create a new form and drag your new textbox/button from myclasses on it, no need to save it, its just for easy cut&paste
Now mark txtbox/button in temp form, press strg+C.
Then do like for new form/txtbox similar with grid (grd_whatever based on grid), set deletemark, .. set column count to 10
In grid for each of the 10 columns :
set sparse to .f., set controlsource (colu1-10)
mark the column
mark element "text1" in the columns in vfp propertysheet, click on grid, press del. This will remove text1 (so columns has no control).
click on grid and press strg+v. This will copy your button into the grid column.
Set _position of each txtbox/button according to columnn number (1-10) if you like (for later use ??)
saveit into a new library (vcx) myclasses.vcx
setup and use extras - toolbox which allows a very efficent way to attach your myclasses.
From toolbox choose your formclass frm_myfrom , create new (you built a new instance)
Drop a grid from myclasses on it.
(you may also have put grid into fromclass, then this is not needded but less flexible, because all new form from this class will have the grid)
save this form as main
I have done a sample with 4 columns, column 1-3 contain mytextbox, col4 the standard one
(pls set default to extract folder before starting mainform)
Now close main form, goto you myclasses- txtbox and change color or font, save it and close designer.
Reopen main form, without changing a line of code in grid of mainform it is changed
Remark
I started with btn_mybtn and some code to set caption , not finished, had to leave
You may have a look on it in _setcaption which can be called from _setit (see comments)
Best regards
tom
I know, there are much better ways like subclassing a column, this is just meant for a "visual start" and show some tools like toolbox
And there is bindevent
