How to disable Edit in Place for a column at runtime

Tags: #<Tag:0x00007f98be54c8e8> #<Tag:0x00007f98be54c460>

If you want to conditionally disable edit in place for column you can use the EIPManager’s GetEdit() method to accomplish this.

GetEdit returns true or false indicating whether or not EIP is valid for the current column.

Embed this in the GetEdit method before the Parent call.

IF SELF.Column = ### AND <Your condition to disallow edting>
  RETURN false
END

I like to use the form

IF ?List:GD {PROPLIST:Header,SELF.Column} = ‘Account Name’ AND <condition…>
RETURN false
END

as it keeps working even if new columns are added.

This is more flexible:

IF SELF.ListControl{PROPLIST:Header,SELF.Column} = ‘Account Name’ AND <condition…>
  RETURN false
END

Thanks Mike, that’s even better.

For circumstances with dynamic header strings (or no header strings), it might be more reliable to ascertain which field by using PROPList:FieldNo and WHO().

I use a template to generate equates for the column numbers. Then use those in code instead of hard-coded column numbers.

I need to enable/disable EIP for currently selected record according to value for one field from the current record. Can’t get it works. Any hint, please?

Put your logic at the top of the browse AskRecord method before the parent call.
Return RequestCancelled to stop editing.

It works!! Thanks!! :+1:

Rick,

Any chance you might share the relevant template or template code for generating the column equates?
It probably is not complex, but my guess is that I am not the only one whose last dip into template symbols was in the pre-dementia coding era.

1 Like

Sure thing.
I wrote up a ClarionHub topic and linked to a sample template on Github.

1 Like