1. Jan Hoppe
  2. PowerBuilder
  3. Friday, 20 November 2020 07:55 AM

You can put an expression on the procect property on a column in a datawindow, which allows you to specify that when in querymode user can type here otherwise he can only read.

The problem is that sometimes you want user to copy from that column, but then you have to do a modify statement when you take your dw in and out of querymode.

Does anyone know a better way?

Who is viewing this page
mike S Accepted Answer Pending Moderation
  1. Friday, 20 November 2020 13:06 PM
  2. PowerBuilder
  3. # 1
0
Votes
Undo

your use of protect for querymode is fine (i do the same thing), you don't have to do a modify to copy:

 

FOR RMB menu popup to copy:

You want to use getobjectatpointer to see what the user has clicked on and thus what they may want to copy from.  Then you just can do a getitem for columns/computes, and even get the value of text if the object is text.

Since you are talking about querymode, you also need to see if the dw is in querymode when the user is doing a copy since you can't do a getitem in querymode (just do a .copy() )

 

Also, don't forget about Datawindow.Selected.Data - check that first to get what the user has selected, and only if they have not selected anything do you get the current column

 

 

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 20 November 2020 08:26 AM
  2. PowerBuilder
  3. # 2
0
Votes
Undo

I don't think you can avoid having to do the Modify().

The protect attribute is very nice, since you can use an expression, but what I don't like is that you always have to make sure that the cursor is not in the column when it needs to be protected and also, when ALL columns are protected you cannot do a ScrollToRow().

Instead, I prefer to use the tabsequence attribute. It needs some coding, but once you have coded 3 functions:
1 to initially store all columns and their tabsequences,
1 to set them all to 0
and 1 to restore them to their initial value,
... then it's easy to use. It neither prevents you from having to code though. 

What I do to allow a user to copy a column's contents when "not editable" (protected or tabsequence=0), is to have an option "Copy value" in a right-mouse popup menu.

It's a shame you cannot use an expression for the "readOnly" attribute of a column.

regards

Comment
Thanks for reply, I think I will make a suggestion to Appeon to include such feature in a future release.
  1. Jan Hoppe
  2. Friday, 20 November 2020 08:42 AM
yw,

Thank you for that. (I was thinking of doing the same thing).
  1. Miguel Leeuwe
  2. Friday, 20 November 2020 08:47 AM
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.