The reason is that the class defines the number of colums. You cannot change a class definition in an instance - that is the whole point of inheritance. An object is NOT a copy of the class, but is actually a reference to it! So if you define 9 columns, then you cannot create a grid based on that class that has only 8 (you CAN increase the number because you get the original 9 PLUS some local ones) but you cannot reduce the number that are inherited.
A better design is to define your grid class with NO columns and simply set the colulmn count property each time you need it. Use the grid builder to set the grid up rather than trying to define it all in the class.
1) You can decrease columncount to 8,7 ... in code.
2) You can use SetAll() to assign properties to all member controls of a container type class (like a grid).
3) You can't set when/valid to values like .f./.t. They are not properties but procedures. You can however return values of .f./.t. from their code.
If it's saying "Inherited ..." then that means you didn't write any code but the class from which you created the instance had code in that method (otherwise just Default for built-in VFP code). When it says "User procedure" then that means you have code overriding class' code in instance. Doubleclick to see the code you have written (warning: even spaces that you might somehow left there counts as code. If you don't see any code and sure that you don't want to have instance code there then in PEM sheet, right click and select "reset").
"Am I right in assuming that in a "normal" grid, "each control in every column of the grid" refers to the text box controls (but not header controls) in the columns And, if that is correct, the code in question cannot be entered into my base class grid (or base grid class) if I choose, as you suggested, to set the number of columns to -1 "
No you are not right in your assumption. A column.controls collection has header and other controls in column (typically Controls[1] is the header and Controls[2] is the textbox - unless edited).
I don't know what code are you trying to add but probably it can be added to base class. Many grid aspects are controlled directly at grid level.You can also add your own column,header, textbox ... controls.
> 1) You can decrease columncount to 8,7 ... in code.
Okay, but I need it when designing (e.g. in Project manager)
> 2) You can use SetAll() to assign properties to all member controls of a container type class (like a grid).
Okay, but again, I need it as design time (e.g. in Project manager)
> 3) You can't set when/valid to values like .f./.t. They are not properties but procedures. You can however return values of .f./.t. from their code.
1001 Things ... FoxPro, "How do I highlight the current grid row", page 164: "We also need to set the grid's lAbout2LeaveGrid property to true in its Valid method and to false in its When."> If it's saying "Inherited ..." then that means you didn't write any code ...
I re-entered text and everything turned out okay after that."Am I right in assuming that in a "normal" grid, "each control in every column of the grid" refers to the text box controls (but not header controls) in the columns And, if that is correct, the code in question cannot be entered into my base class grid (or base grid class) if I choose, as you suggested, to set the number of columns to -1 "
> No you are not right in your assumption. A column.controls collection has header and other controls in column (typically Controls[1] is the header and Controls[2] is the textbox - unless edited).
On page 163, it says : "To change the highlight when the current grid row changes, this code is needed in the When method of each control in every column of the grid: [code]
> 1) You can decrease columncount to 8,7 ... in code.
>> Okay, but I need it when designing (e.g. in Project manager)
As I told you, you cannot do this - Cetin is, of course, correct that you can change it at run time in code. But at design time you can't.
> 2) You can use SetAll() to assign properties to all member controls of a container type class (like a grid).
>> Okay, but again, I need it as design time (e.g. in Project manager)
And the only way to do that is to use a builder - which is just code that runs at design time. Look at the ASelObj() function - it will allow you to get a reference to an object at design time and then you can manipulate it in code.
> 3) You can't set when/valid to values like .f./.t. They are not properties but procedures. You can however return values of .f./.t. from their code.
>>1001 Things ... FoxPro, "How do I highlight the current grid row", page 164: "We also need to set the grid's lAbout2LeaveGrid property to true in its Valid method and to false in its When."
I don't understand why you are quoting our book here (and yes, I am one of the authors of that book!) You have to add code to do that - In the VALID you need "This.lAbout2LeaveGrid = .T." and in the WHEN, you need "This.lAbout2LeaveGrid = .F." and code only executes at RunTime!
> If it's saying "Inherited ..." then that means you didn't write any code ...
>> I re-entered text and everything turned out okay after that.
But that means that you over-wrote anything that was in the SuperClass - you may as well not bother creating the class if you are going to do everything in every instance. (Do you actually understand how inheritance works in VFP )
>> On page 163, it says : "To change the highlight when the current grid row changes, this code is needed in the When method of each control in every column of the grid: [code]
>>I just assumed that "header" did not apply here (I now know it does not have a When method), but only the text boxes of the grid columns (and, of course, any other control that had been placed into the grid)
Again I am very confused trying to understand what you are thinking. There are two unrelated items here. The column that you see in the Grid - which is what the text you quote refers to, and the Column Object that exists in VFP, which is what Cetin is referring to. The Object has a "controls" collection which defines the class of all obejcts in the column, the Header, the Textbox and any other controls that may have been added. This has nothing to do with the code that you add to any control that you want to display IN the column (which is what the text refers to).
Since you seem to be fond of quoting our book, how about re-reading the paragraph at the bottom of Page 1 where it states:
As we have already said, this book will not teach you to use Visual FoxPro,
it assumes you have a reasonable degree of comfort with the basic operation of the VFP Database and Command Language, and with the basic principles of Object Oriented Programming. We would expect that you will have read, and used, such excellent and useful references as Whil Hentzen¡¯s ¡®Programming VFP¡¯; ¡®The Revolutionary Guide to VFP OOP¡¯ by Will Phelps, Andy Kramek and Bob Grommes and, of course, the indispensable ¡®Hacker¡¯s Guide to VFP¡¯ by Tamar Granor and Ted Roche.I suspect that you may have skipped one or more of those volumes....
>> Now, if you want to direct me to more of a beginners forum, I will receive that very positively, and get back here only when I have more experience. I know how frustrating it can be with people who are balancing on the edge of ignorance.
Not at all please ask away I wasn't trying to be sarcastic, just trying to say that KiloFox (1001 Things...) is probably NOT the best source for you based on the level of experience you are showing us. I would stongly suggest taking a look at http://www.hentzenwerke.com/catalog/fund6.htm (Fundamentals: Building Visual Studio Applications on a Visual FoxPro 6.0 Foundation). It is an old book and slightly out of date, but does cover the basic tools and techniques well. It's only available in E-Book form now but you may find it more immediately useful than KiloFox.
But do not be afraid to ask anything - we are only too pleased to help where we can but you do need to give us as much information as possible.