1. Sivaprakash BKR
  2. PowerBuilder
  3. Saturday, 1 September 2018 11:41 AM UTC

Hello,

PB 2017 R3

Got one datawindow [dw_1] with one field, and a sle_1 on a window.  

Need to move from dw_1 to sle_1 using enter [also].  Added the following code in pbm_dwnprocessenter event

Send(Handle(This), 256,9, Long(0,0))
Return 1

 

In sle_1 also, I need to process capture and process enter key.  Added the following code in an pbm_keyup event.

String      ls_text
ls_text = Upper(Text)

If Key = KeyEnter! Then
          Messagebox('in', 'ue_enter')
          Messagebox('entered', ls_text)
End If

Now, if I press enter while in dw_1 datawindow, I get the messagebox written in sle_1 field.  Why ?

 

Tried:

Changed pbm_keyup to pbm_keydown in sle_1.   Effect is I could not get the last pressed key in ls_text variable.  Say if the user pressed 'NICE', ls_text contains 'NIC' only. 

How can I get the both feature, ie allow enter key in dw_1, as well as to get full entered text in sle_1.

Happiness Always
BKR Sivaprakash

 

Accepted Answer
Sivaprakash BKR Accepted Answer Pending Moderation
  1. Wednesday, 28 November 2018 13:32 PM UTC
  2. PowerBuilder
  3. # Permalink

Hello

Done successfully by introducing a instance variable.

Comment
There are no comments made yet.
Kevin Ridley Accepted Answer Pending Moderation
  1. Tuesday, 4 September 2018 12:13 PM UTC
  2. PowerBuilder
  3. # 1

Why not create a window function that does the processing and you pass an argument to the function that tells it whether you're coming from the dw or the sle.  Then you can call AcceptText() on the DW or modified event on the sle as needed.

Comment
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Saturday, 1 September 2018 23:56 PM UTC
  2. PowerBuilder
  3. # 2

Another good place to process data that needs to be captured is in the LoseFocus event of the object, unless the object is a command button who when clicked, starts a specific process.

Olan

Comment
  1. Sivaprakash BKR
  2. Monday, 3 September 2018 09:12 AM UTC
Thanks Olan. But I don't think code in LoseFocus event will solve my purpose here. I have to filter out a list as and when something entered in sle_1.

  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Saturday, 1 September 2018 13:15 PM UTC
  2. PowerBuilder
  3. # 3

Hi;

   Yes, the key down events would not be the place to handle the keyboard activity as the keyboard's Z80 processor has not yet generated the new character until the key(s) have been released. The key up events are the proper event where a character in the keyboard buffer is now present however.

   In the case of the DC, you have to remember that the character in the keyboard buffer is not yet known to the DWO until another character is keyed in or a loose focus event occurs. If you want the last keyed sequence in keyboard buffer to be processed into the DWO before you move on, you would need to use the AcceptText() command. You could also consider using the Edit Changed event as well to get each character.

  The SLE also needs to have it's modifed event fired to get the last character from the keyboard's buffer. This happens automatically on a loose focus or another key in. The thing to keep in mind here is to make sure when using the key up event, is to process the last character before forcing focus to change to the DC.

HTH

Regards ... Chris

Comment
  1. Sivaprakash BKR
  2. Monday, 3 September 2018 09:10 AM UTC
Thanks Chris.

My purpose is to filter data in dw_list. For this I list a set of field names in dw_1, and search string in sle_1. Allow users to navigate between dw_1 to sle_1 to dw_list using enter keys. [ Enter key will work differently in sle_1. this will present the data in edit mode in a separate dw].



When user clicks 'ENTER' key, after selecting the field name on which filter needs to works, it moves to sle_1. field. and also executes code written in sle_1's Key event under ENTER key.



Though ENTER key is pressed once, it executes codes written in two different places. Need to prevent this double execution.



Well, this could be prevented by having a instance variable and proper settings and checking. Looks like not an elegant solution.



Would like to know the reason for this double execution and to have an elegant solution.

  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.