How to disable a single row in a datawindow?

我的未来我决定 提交于 2019-12-11 05:06:59

问题


Can anybody help me that how can I protect individual column of an individual row, though my datawindow has more than one row. I am writing a code like this:

dw_1.Modify("column_name.protect = '1'")

However it is making all my rows disabled.


回答1:


You need to have some sort of conditional statement for the particular row/column you wish to protect. One way is to have an additional field you set programatically like.

dw_1.setitem(1,"protect_me","Y")

Then in your other column you set an expression on the protect property like:

if(protect_me[0] = "Y", 1, 0)



回答2:


You cane make it like : dw_1.SetRedraw ( FALSE )

ls_modstring = as_columnnane + ".background.color = '" + String(RGB( 255, 255, 255 )) + &
                    "~tIf( protection = 1," + String(RGB( 192, 192, 192 )) + "," + &
                    String(RGB( 255, 255, 255)) + ")'"
dw_1.Modify( ls_modstring )

ls_modstring = as_columnnane + ".protect = '0 ~tIf( protection = 1, 1, 0 )'"
dw_1.Modify( ls_modstring )

dw_1.SetRedraw ( TRUE )

Where as_columnnane is the column name.




回答3:


Hi Santosh Kumar Dutta,

I suggest you use datawindow protect properties instead of modify syntax. could you please give us exact small code based on what field or condition you want to protect.

from pb_developer



来源:https://stackoverflow.com/questions/30885291/how-to-disable-a-single-row-in-a-datawindow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!