1. Subhabrata Das
  2. PowerBuilder
  3. Wednesday, 20 April 2022 19:53 PM UTC

Hi Everyone,

Is there any way to control the acceleration of an editmask spin control?? 

If user keeps up/down arrow pressed of an editmask spin control it changes the display value at a certain rate. Is there any way to increase or decrease this acceleration of the display value.

Following are the few details:

  • Powerbuilder Version: 2017 R3 Build 1880
  • Control Type : EditMask (Spin)
  • Using CodeTable
  • Increment = 1
  • Min = 1
  • Max = 10

Has anyone encountered this issue and Is there any way to resolve the same??

Thank you!!

Accepted Answer
John Fauss Accepted Answer Pending Moderation
  1. Wednesday, 27 April 2022 17:59 PM UTC
  2. PowerBuilder
  3. # Permalink

Hello, all -

Having some spare time time while I'm away from work for a couple of days, I've come up with a solution for this problem. I created a small example app to demonstrate the solution, which is attached to this post as a zip file. The app was created using PB 2017 R3 and it is 100% PB, no Windows API function calls are used.

To accomplish the goal of slowing down the repeat rate when the left-mouse-button (LMB) is held down on an edit mask control's spin button, I created a custom edit mask control inherited from the standard control. In the custom edit mask control, I added a user event mapped to the pbm_enchange event. This event is triggered each time the user changes the data value in the control, either by typing or by clicking on a spin button. When the LMB is held down on a spin button, PB triggers this event repeatedly, approximately every 0.155 seconds. This timing is NOT configurable.

Then it occurred to me: To effectively slow down the repeat rate, maybe it is possible to prevent the data value from being changed until every second, or third, or fourth, etc. event occurs. After handling a few complicating conditions, it appears to work! A dedicated Timing object is needed in order to detect when the LMB is no longer being held down, since the typical LButtonDown/LButtonUp events do not get passed along to the application when the user clicks on a spin button.

To incorporate this functionality into your own application, you need to export the n_timing_editmask and u_editmask_slowdown objects from the sample application and import them into your app's PBL (Note: Import the Timing object first, then the custom edit mask control to get a clean import), then replace an existing edit mask control with the u_editmask_slowdown user object. It contains a method to set the slow-down factor for the spin buttons in the range 1-10. A factor of 1 means a normal repeat rate, no slow-down, and 10 is a pretty extreme slow-down. I found that using a factor of 3 or 4 provides a nice user experience.

Subhabrata, I hope this provides you with an acceptable solution to the issue and puts a smile on your user's face.

Best regards, John

Attachments (1)
Comment
  1. Subhabrata Das
  2. Thursday, 28 April 2022 11:08 AM UTC
I really appreciate the time and effort you have put into identifying and providing a solution for this issue. Thank you so much for the help and support!!
  1. Helpful
  1. John Fauss
  2. Thursday, 28 April 2022 18:07 PM UTC
You're welcome! Please be sure to test the customized edit control thoroughly - I believe it to be working correctly with no ill behavior, but there is a possibility I overlooked something. Good luck!
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 20 April 2022 20:37 PM UTC
  2. PowerBuilder
  3. # 1

Basically no but, tell the user not to hold the arrow keys down. Just on quick push (tab) at a time in either direction.

Comment
  1. Subhabrata Das
  2. Monday, 25 April 2022 07:39 AM UTC
This is happening for mouse clicks. Even, for a single click, spin control is changing the display value twice or thrice.
  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Wednesday, 20 April 2022 22:19 PM UTC
  2. PowerBuilder
  3. # 2

Every Windows user can adjust the "repeat delay" (how long before a keystroke begins to repeat) and the "repeat rate" (how fast the held key repeats) of their keyboard.

Control Panel:

In the Keyboard Properties dialog, adjust the Repeat delay and rate sliders as desired:

You can test the changed values in the input field provided.

 

Comment
  1. Subhabrata Das
  2. Monday, 25 April 2022 07:37 AM UTC
This issue is happening for mouse clicks. When users click (Mouse: Left Mouse Button) the up/down in a spin control then only they are experiencing the issue. Even for a single mouse click spin rolls twice or thrice.
  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.