2
votes

I hava a data window object, in which I am fetching some attributes from the database to show it to the users. I want to make the computed fields read-only, so that the user can not modify them.

How can I make a computed field read-only?

3

3 Answers

4
votes

Have you tried setting their tabsequence to 0?

2
votes

If you're using an Edit or an EditMask you can set the DisplayOnly or ReadOnly property, respectively. Note that although the PB docs claim that ReadOnly only is only valid for spin controls, it works whether or not spin is enabled. You can also set the entire DataWindow ReadOnly. From PowerScript: dw_control.Object.DataWindow.ReadOnly='yes'.

1
votes

If you are referring to a computed column (a column in a datawindow that comes from a data source [such as SQL] where a the column is a calculated value) then set the Protect property to 1. You can also use expressions if you need to set it based on conditions.

If you are referring to a computed field (a field on a datawindow added in the datawindow painter that is driven by a PowerBuilder expression rather than the data source) then you shouldn't have to do anything special as I believe computed fields are read-only.