1. Sivaprakash BKR
  2. PowerBuilder
  3. Wednesday, 7 April 2021 07:47 AM UTC

Hello,

Using PB 2017 R3

Got a selection window, whereby users can select a row by pressing 'ENTER' key or 'DOUBLIC CLICK' that row by mouse.   

*********************************
Code in ue_key event (Event Id: pbm_dwnkey)

If dw_list.RowCount() > 0 Then
        If Keyflags = 0 and Key = KeyEnter! Then
               Event ue_selection()
        End If
End If
*******************************

Code in rowfocuschanged event,   [ To highlight the row selected ]

If currentrow > 0 Then
      SetRow ( currentrow )
      SelectRow ( 0, False )
      SelectRow ( currentrow, True )
End If
*******************************

Code in doubleclicked event,

If row > 0 and row <= rowcount() Then
       Event ue_selection()
End If
********************************

If the user press ENTER key in one row, the rowfocuschanged event is fired and it highlights the next row before firing the event ue_selection.   No code(s) in any other event(s).

This happens in PB 2017 and NOT in PB 11.5.   The same code doesn't move the highlight row to next row in PB 11.5  

Has anything changed in firing order in PB 2017 ?

Happiness Always
BKR Sivaprakash

 

Accepted Answer
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Wednesday, 7 April 2021 08:26 AM UTC
  2. PowerBuilder
  3. # Permalink

I don't know if anything has changed, but the ENTER key moves one row down. SHIFT+ENTER moves one row up (just like the same thing happens in Excel).

If you want to prevent that from happening, you could code the rowFocusChanging() event and return a value of 1.

return 1 // will prevent the rowchange to happen and stay on the same row.

Even better, instead of using the pbm_dwnkey(), use the pbm_dwnprocessenter() event, that's a specific event for the Enter key.
I'm not sure if you would still have to also code the rowFocusChanging() event and do a return 1 if the key is keyEnter!

regards

 

Comment
  1. Sivaprakash BKR
  2. Thursday, 8 April 2021 10:23 AM UTC
Miguel,

I can confirm that that particular window / dw got only those code(s) without any change. With NO change in the functionality in that window, we haven't added any other code.



ENTER key doesn't invoke rowfocuschanged in PB 11.5 and it fires rowfocuschanged event in PB 2017.
  1. Helpful
  1. Miguel Leeuwe
  2. Thursday, 8 April 2021 10:56 AM UTC
Ok, thanks for confirming. It's been a while I haven't used 11.5 so I was probably wrong in thinking it was like that also in 11.x.

regards
  1. Helpful
  1. Chris Pollach @Appeon
  2. Thursday, 8 April 2021 16:09 PM UTC
Hi Miguel ... correct .. the RowFocusChanging & RowFocusChanged events indicate the row(s) affected and the PB App should *never* try & change the Row value(s) in these two events otherwise, an infinite loop or bad behaviour could occur.
  1. Helpful
There are no comments made yet.


There are replies in this question but you are not allowed to view the replies from this question.