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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

grid rows 1

Status
Not open for further replies.

sqlpro

Programmer
Dec 30, 2003
297
NZ
hi guys
I have a grid that displays data based on some paramaters.
How to disable some rows it displays
bcoz grid has checkbox control which can b marked by user
only under certain conditions.

what happens is some rows in grid dont meet those conditions
so i dont want user to update those rows.
How can i achieve that
Thanks

cheers
 
There are a few different ways to accomplish this:

1. setting the ReadOnly property of the column

2. setting the readonly property of the contained control

3. putting Return .F. into the when event of the control

4. making the column invisible to the user

...there are others as well. This response is in know way an exhaustive answer of all the ways you can keep a user from being able to edit in a particular column in a grid.

boyd.gif

craig1442@mchsi.com
"Whom computers would destroy, they must first drive mad." - Anon​
 
Thanks Craig
may b i could use setall() for this like

.SetAll("readonly","iif(cur1.fld1=1,.t.,.f.", "Column")

cheers
 
I just tried it why it gives error like
data type is invalid for this property

actual command is

.SetAll("readonly","iif(UPPER(TRIM(curAss.staffid))==ALLTRIM(gcstaffid),.f.,.t.)", "Column")

cheers
 
sqlpro,

How come you are putting the second parameter in quotations like that?

helpfile said:
Value
Specifies the new setting for the property. The data type of Value depends on the property being set.

...as it is right now you are trying to assign the string "iif(UPPER(TRIM(curAss.staffid))==ALLTRIM(gcstaffid),.f.,.t.)" to the readonly property of the column controls...why don't you try it without those added quotation marks around it and see what that gives you?

boyd.gif

craig1442@mchsi.com
"Whom computers would destroy, they must first drive mad." - Anon​
 
I did that and i even tried

Thisform.grdAss.SetAll("ReadOnly",ThisFORM.setassflag(), "Column")

but in this case it does not give any error but it does not
do what it supposed to do.

cheers
 
The following always works for me even though the second parameter in quotations

.SetAll("dynamicbackcolor","ThisFORM.setgrdasscolor()", "Column")


cheers
 
HI

The code used is the cause of problem.

1. SETALL is done only once when the init is done or when called. SO when the columns are set based on the value of one column for another column.., it is set when the init takes place. However, this code is not run when the user changes the value of the controlling column.

2. Dynamic properties are executed every time the cell is touched or refreshed unlike the SETALL which is exeecuted only once on INIT or when called.

That explains the bahaviour.

I have shown in your other thread as well on the similar topic. Using WHEN event in these cases will be more appropriate.

:)

____________________________________________
ramani - (Subramanian.G) :)
 
Hi Ramani
Thank you very much for the post.I think get the idea.
Actually i even tried when event but to no avail.
i fedup with it so i added required code in grid's column
click event(this column's active control is a custom checkbox).
May b i'll try again ur idea abt When event.
Thanks
Rajani :)


cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top