1. Yasir Masood
  2. PowerBuilder
  3. Friday, 18 June 2021 20:47 PM UTC

Hi guys,

I need help with the pbm_dwnkey event. I have a dropdown DW that the users select a value.

I want to stop them to use the DownArrow! or UpArrow! keys.

I am using the following code but it doesn't work.

IF keyDown(KeyDownArrow!) or keyDown(KeyUpArrow!)  THEN
    IF this.GetColumnName() = 'inspect_result' THEN    
        
        Return 1
    END IF
END IF

I am using Appeon Version 2017 R3 Build 1858. Any help would be appreciated.

Thanks

 

 

John Fauss Accepted Answer Pending Moderation
  1. Friday, 18 June 2021 21:07 PM UTC
  2. PowerBuilder
  3. # 1

Hi, Yasir -

The following code works for me in 2017 R2:

If key = KeyDownArrow! Or key = KeyUpArrow! Then
   If GetColumnName() = 'xxxxxxx' Then
      Return 1
   End If
End If

Please note I use the event argument value named "key" instead of using the KeyDown PowerScript function.

Best regards,
John

Comment
There are no comments made yet.
Yasir Masood Accepted Answer Pending Moderation
  1. Friday, 18 June 2021 21:16 PM UTC
  2. PowerBuilder
  3. # 2

John,

The event is not even firing. I tried this too.

IF key = KeyDownArrow! or key = KeyUpArrow! THEN
    MessageBox('Hi','pbm_dwnkey')
END IF

Thanks

Comment
  1. John Fauss
  2. Friday, 18 June 2021 23:01 PM UTC
What presentation style (grid, freeform, grouped, etc.) is this DataWindow? Does the DW contain data? Does the DW have focus? Can the column in question receive focus (not display-only, has a non-zero tab order, not protected)? My quick test was performed using a Grid DW, but that is not a requirement.
  1. Helpful
There are no comments made yet.
Yasir Masood Accepted Answer Pending Moderation
  1. Saturday, 19 June 2021 15:17 PM UTC
  2. PowerBuilder
  3. # 3

The DW is in Tabular style. I am populating the DW with data from the database.

Yes, the DW has focus. The dropdown changes depending upon another column.

It works if the user clicks the arrow on the dropdown but not when they use the dwnArrow key.

 

Comment
  1. John Fauss
  2. Monday, 21 June 2021 15:00 PM UTC
My earlier test did not involve columns that used the DDDW Edit Style. It appears that when the DDDW Edit Style is used, it may not be possible to do what you want. What behavior are you wanting to prevent or negate? If you want to prevent the user from changing the value, perhaps defining an expression for the Protect property for the column object that evaluates to 1 will meet your needs.
  1. Helpful
  1. mike S
  2. Thursday, 29 July 2021 16:34 PM UTC
I think there are some special undocumented dddw / ddlb related events? I am fairly certain that Chris P has them listed somewhere.

  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.