Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

grid and readonly columns

Status
Not open for further replies.

Akourou

Programmer
Mar 28, 2019
34
GR
hello

i have a grid that is populated from tables.
At start i have the readonly property to true and allowcelselection to false and i have a checkbox on the form to check it and make the grid editable. (readonly = f and allowcellselection .t.)

but this makes all columns editable even if i have the readonly property of a specific column set to true.

is this the way it works?
do i have to set each columns property seperately?

 
Akourou,

If you set the control source to an expression, instead of a simple field or variable reference, your column will remain read-only no matter what.

For instance, [highlight #FCAF3E](tablename.fieldname)[/highlight] instead of [highlight #FCAF3E]tablename.fieldname[/highlight].
 
There's another problem, no matter if you set readonly on the global level of the grid or in single columnns, also via adding brackets, you get a ping sound and a timeout before VFP reacts again whenever you try to type into a readonly column (consider accidently clicking into the wrong column) so you could also avoid that with a RETURN .F. from the When event of the columns control. When using several controls, sparse = .f. and dynamiccurrentcontrol, this also enables to allow editing based on which control is used for a row.

The downside of that is it's more restrictive than readonly, you can't select the cell or text within, you disallow using it as a source for copy&past, you make it less than readonly, you make it disabled.

On the positive side, if that matches your need you have the ability to allow individual cell selection using this cleverly.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top