>>AddObject is my favorite for more special grids. Gives you more control, and actually allows you to discard the default textbox without much clicking around.
>
> Yes, you're right. One little problem here - we work as a team and use predefined set of classes, and I am not a person, who can change our classes.
>
>Sure, I can design my own and use it in my app, but don't want...
I'm in charge of such decisions over here, so this grid of ours gets built at runtime, using AddObject(cColumnName, "ColumnClass") - and this column class is defined in a .prg, so it has different defaults regarding the default control and its
>>> Actually, right now I solved this problem another way, which satisfied my manager: I know the name of Memo field of my table - Notes, it's only one, so I didn't put it in Grid, I put editbox on my Form instead... - easy solution, but definetely not universal...
>>I've done that, and I'm planning to make it universal enough. I like it for a search grid class - the searchable columns are in the grid, and the details on the active row are in several controls (including Editboxes) in a container to the right. In AfterRowColChange I just check if I've moved to a new record, and refresh the controls in the container. Works like a charm.
>
> May be you can send me a sample? (
nnosonov@thewarrengroup.com)
This is all it takes, in grid's AfterRowColChange (nCurrentRec is the form's custom property to keep the RecNo(), initially 0):
IF ThisForm.nCurrentRec <> RECNO()
ThisForm.nCurrentRec = RECNO()
ThisForm.LockScreen = .T.
ThisForm.Refresh()
ThisForm.LockScreen = .F.
ENDIF
Now I do a ThisForm.Refresh() just because I'm not sure other controls will be within a container with a predefined name, and this is what makes it work for sure, with probably a little more effort by the processor. Anyway, this refresh doesn't take long, and we surely don't expect the user to do hundred of these in a second - he's supposed to take a look or use some search function, not to press down arrow indefinitely (though it still works fine even that way). Just make sure the other controls have a controlsource with the same alias as the controls in the grid have, or belong to related tables (so their value changes as we navigate down the grid).