1. Floyd Edwards
  2. PowerBuilder
  3. Wednesday, 27 February 2019 21:12 PM UTC

Is there a way to set a column protect property in a grid window?

 

What I am trying to do is if the user changes another column, I would like to change the protect property on the comment column on the same row, so they are allowed to add a comment.

 

Is this possible? I can not only find the This.object.comment.protect = 0 type stuff, which does not set the protect on a specific row. while leaving the other row comments protected... if that makes since.

Arthur Hefti Accepted Answer Pending Moderation
  1. Thursday, 28 February 2019 04:48 AM UTC
  2. PowerBuilder
  3. # 1

In the datawindow pointer define the following expression on comment.protected

if(  districtscoreid =  districtscoreid.original, 1, 0 )

and on comment.background

if(  districtscoreid =  districtscoreid.original, ??? Your origial Color, 1090519039 )

 

Comment
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Wednesday, 27 February 2019 22:38 PM UTC
  2. PowerBuilder
  3. # 2

your protect expression can be set as:

if ( isRowModified(), 0, 1 )

of course that only tells you if anything on the row changed, so it might not be a good option.

sadly, there is no   isColumnModified(colname) function.  which would be very useful.

 

 

 

 

 

Comment
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Wednesday, 27 February 2019 21:43 PM UTC
  2. PowerBuilder
  3. # 3



1. Create a computed column in the DW called "protect_flag", initialized to 1.
    Hide the column, set the taborder to zero, and it's visible property to zero.

2. Set the PROTECT expression of every relevant column of the DW to "protect_flag".

3. In your code, you can now set Protect_Flag to zero or 1 as required.

 

Olan

Comment
  1. Chris Pollach @Appeon
  2. Thursday, 28 February 2019 17:26 PM UTC
Hi Olan;

FWIW: This has always been my favourite approach as you can control the expressions exactly row by row - no matter if its current or has/has not any focus. ;-)

Regards .. Chris
  1. Helpful
  1. Olan Knight
  2. Thursday, 28 February 2019 17:32 PM UTC
Thanks, Chris.

I like this technique because it's simple, easy to understand, flexible (as you pointed out), and effective.
  1. Helpful
  1. Chris Pollach @Appeon
  2. Thursday, 28 February 2019 18:37 PM UTC
At my age .. I need "simple, easy to understand, flexible and effective" - LOL!
  1. Helpful
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Wednesday, 27 February 2019 21:19 PM UTC
  2. PowerBuilder
  3. # 4

For an expression to apply to only the current row:

if ( currentRow() = getrow(), xxx, yyy )

 

 

Comment
  1. Floyd Edwards
  2. Wednesday, 27 February 2019 21:39 PM UTC
Okay, maybe I need to show you some code....

Choose Case dwo.name

Case "districtscoreid"

This.object.comment.protect = 0

This.object.comment.background.color = 1090519039

End Choose



So if a user changes a district score on a row, I need to change the protect property and background color on the comment column of that same row.....
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.