tags:

views:

44

answers:

3

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  A: 

Have you tried setting their tabsequence to 0?

klennepette
+1  A: 

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.

Bernard Dy
+2  A: 

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'.

Hugh Brackett