1. Michał Misijuk
  2. PowerBuilder
  3. Tuesday, 13 August 2019 11:39 AM UTC

Is there possibilty to f.e. on clicked button:

- to block row changing/mouse selection and leave only focus on current row,
- mayby grey out rest of rows?

I want to higlight as much as possible which row is now editing, since every row on start is blocked. This is not problematic where DW contains 5-10 record, but when there are dozens of them, and user scrolls down accidentally.. 

Thanks!

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 14 August 2019 01:11 AM UTC
  2. PowerBuilder
  3. # 1

Hi Michal;

  These approaches seem overly complicated. Just protect everything and then open a "Response" window to edit one specific row at a time. That way, you'll have 100% control with very little coding.

Just my $0.02.

Regards ... Chris

Comment
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Tuesday, 13 August 2019 16:34 PM UTC
  2. PowerBuilder
  3. # 2

Hmmmm....

I'd go about this the other way: have the initial state of the DW ROWS be the DISPLAY-ONLY appearance, and when the user clicks the EDIT button, the code changes that row to the EDIT appearance.


Olan

Comment
  1. Kevin Ridley
  2. Tuesday, 13 August 2019 19:42 PM UTC
That's what I said, lol ;-)
  1. Helpful
There are no comments made yet.
Kevin Ridley Accepted Answer Pending Moderation
  1. Tuesday, 13 August 2019 15:18 PM UTC
  2. PowerBuilder
  3. # 3

OK got it now.  Rene' had some great advice on using the rowfocuschanging event.  If you have an ancestor dw, I'd add an instance variable called is_mode or something similar.  If you don't have an ancestor dw, I'd create one and add the variable with get/set methods.  When the user clicks the edit button, call dw_1.of_set_mode("edit") or however you want to do it.  In the rowfocuschanging event, call this.of_get_mode and see if it's edit.  If it's edit, return 1.  Also look at the SelectRow method for row selection (you will also need to check the mode before doing the selectrow, because if you're in edit mode you don't want to select another row).  As far as making all the other rows grey, I'd probably add a "dummy" field with a value of 0, to the select.  You can conditionally set the background color to grey if it's 0, and maybe white if it's 1.  If the user clicks edit, set the dummy column to 1 (and when they save, put the mode back to view  and dummy column to 0).  I think that should take care of everything you were looking to do.

Comment
  1. Kevin Ridley
  2. Tuesday, 13 August 2019 19:51 PM UTC
You can also use the protect attribute for each column conditionally based on the "dummy" field.
  1. Helpful
  1. Kevin Ridley
  2. Tuesday, 13 August 2019 21:57 PM UTC
So when they click the edit button, get the selected row, set the dummy value to 1 to allow editing and also change the background color automatically.
  1. Helpful
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Tuesday, 13 August 2019 12:15 PM UTC
  2. PowerBuilder
  3. # 4

Hi Michał,

Look in the documentation for datawindows rowfocuschanging event. There you can prevent the rowchanging using return code 1.

For row highlighting are different ways possible. You may use SelectRow method to highlight a row. Another way is to use expression for background color for the detail band and/or for columns (like the way with the expression for column protection).

HTH,

René

Comment
There are no comments made yet.
Kevin Ridley Accepted Answer Pending Moderation
  1. Tuesday, 13 August 2019 11:53 AM UTC
  2. PowerBuilder
  3. # 5

I don't think I understand what you are trying to do, can you please give more detail?

Comment
  1. Kevin Ridley
  2. Tuesday, 13 August 2019 21:53 PM UTC
See my answer above. You may have to play with the SelectRow if you want to allow other rows to be selected while you are editing the one row. Personally I think I'd prevent the user from selecting another row if they're editing the current row, but that's up to you. You can use the technique I mentioned above and just not check the edit variable when they click a new row (or check it and don't allow if it's in edit mode as I suggested).
  1. Helpful
  1. Michał Misijuk
  2. Wednesday, 14 August 2019 05:19 AM UTC
Personally I think I'd prevent the user from selecting another row if they're editing the current row, but that's up to you. - that's what im trying to do :)
  1. Helpful
  1. Kevin Ridley
  2. Wednesday, 14 August 2019 12:48 PM UTC
Great. So in the clicked event, before you select the row, you just check whether you're in edit mode. If yes, just return without selecting (or skip the rowselect if you have more code that needs to execute). If not in edit mode, allow the row to change and be selected.
  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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.