1. Michał Misijuk
  2. PowerBuilder
  3. Tuesday, 13 August 2019

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 Accepted Answer Pending Moderation
0
Votes
Undo

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.
  1. Wednesday, 14 August 2019
  2. PowerBuilder
  3. # 1
Olan Knight Accepted Answer Pending Moderation
0
Votes
Undo

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
That's what I said, lol ;-)
  1. Kevin Ridley
  2. Tuesday, 13 August 2019
There are no comments made yet.
  1. Tuesday, 13 August 2019
  2. PowerBuilder
  3. # 2
Kevin Ridley Accepted Answer Pending Moderation
0
Votes
Undo

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
You can also use the protect attribute for each column conditionally based on the "dummy" field.
  1. Kevin Ridley
  2. Tuesday, 13 August 2019
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. Kevin Ridley
  2. Tuesday, 13 August 2019
There are no comments made yet.
  1. Tuesday, 13 August 2019
  2. PowerBuilder
  3. # 3
René Ullrich Accepted Answer Pending Moderation
0
Votes
Undo

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.
  1. Tuesday, 13 August 2019
  2. PowerBuilder
  3. # 4
Kevin Ridley Accepted Answer Pending Moderation
0
Votes
Undo

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

Comment
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. Kevin Ridley
  2. Tuesday, 13 August 2019
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. Michał Misijuk
  2. Wednesday, 14 August 2019
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. Kevin Ridley
  2. Wednesday, 14 August 2019
There are no comments made yet.
  1. Tuesday, 13 August 2019
  2. PowerBuilder
  3. # 5
  • Page :
  • 1


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