1. Mihai Apostol
  2. PowerBuilder
  3. Wednesday, 5 May 2021 20:31 PM UTC

Once we click on the text field (with AutoSelect = false) in a dw, the cursor is positioned at the beginning of the field by default. We should make another click to change it position to the desired one. 

Is there a way to set the cursor position at the mouse position on the first click? 

There is the SelectText() function that can be used to change the position in a field but I do not have the "start" parameter. 

Thank you and best regrards,

Mihai.

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 6 May 2021 14:19 PM UTC
  2. PowerBuilder
  3. # 1

Hi Mihai ;

  Yes, you are on the right track with the thought of using the SelectText() command. On the ItemFocusChanged event for the column(s) in question, issue the following command to place the cursor at the end of the data ...

THIS.SelectText ( LEN ( THIS.GetItemString ( Row, DWO.name) ) , 0 )

HTH

Regards ... Chris

Comment
  1. Andrew Barnes
  2. Thursday, 6 May 2021 19:39 PM UTC
I agree it might able to be done, but I think it would be a serious pain. I am extremely comfortable with using Windows API in PowerBuilder and have done things with PowerBuilder that PowerBuilder was never intended to do, but the only way I can think of even approaching it is so involved, that I would just tell my users to just click twice.

  1. Helpful
  1. Miguel Leeuwe
  2. Thursday, 6 May 2021 22:12 PM UTC
LOL, the users are clicking "all day" anyway. Also, this seems to be standard windows behaviour. I do see the point of this when "autoselect" is not enabled though.

You'd probably also get complaints from users who DON'T want to have to click on the left of the first character in a field to position the mouse there (as that would be a lot more difficult than just clicking anywhere on the field).

So, yes, I know there's crazy managers or customers who would ask for such a feature, but I would just tell them that it's not standard windows behaviour, some users might not like it and that it's just not possible.

Regards
  1. Helpful
  1. Mihai Apostol
  2. Friday, 7 May 2021 02:02 AM UTC
Thank you guys! At least I have proof that this is almost impossible.

I had tried to call the Clicked event in a post from ItemfocusChanged() with the same coordinates as the first click with no success. If the click does not came from a real mouse event it does not have visual effects:-(
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Wednesday, 5 May 2021 23:52 PM UTC
  2. PowerBuilder
  3. # 2

That's a very interesting question, but NO, I don't think it will be possible in an easy way or at all ...

regards.

 

Comment
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.