1. Miguel Leeuwe
  2. PowerBuilder
  3. Thursday, 2 April 2020 10:54 AM UTC

Hi,

(I know I can use the SendInput api, but that's way more hustlle then Send() or keyb_event.)

to make a long story short:

I need to generate a "backspace" press on the keyboard.

The reason is that I'm working with a richtext control, paste an html table with it's own CSS. To do so I first have to add a " " after the insertion point, if not I'm having "problems".

It works great, but I want to get rid off the " " at the end. I've tried copytrf(false) and then replace the " " with nothing but I keep having the "problems". 

keyb_event is supposedly obsolete, but I still can get it to work. Preferably I'd use the Send() function. I can get a "Delete" press working, but I can't get the "Backspace" working. It IS detected in the key event as KeyBack!, but it doesn't do anything on my sle_1.

Here's some code and I'll attach a small sample app in pb2017:

There's 3 buttons, (one invisible, but holds info I might use). Two others for Send() and Keyb_event()

Note: The button for keyb_event only works correctly when not clicking on it, but by using the TAB key to position the focus on it and then using "spacebar" to run the clicked event.

long ll_handle
Constant Long VK_keyDelete = 46 // delete = 46 works, but should be 127?
Constant Long VK_keyBack = asc('~b') // deteced in keyevent correctly as value ll_i = 8 an key = keyBack!, but doesn't do anything?
Constant UInt WM_KEYDOWN = 256
Constant UInt WM_KEYUP   = 257

ll_handle = handle(sle_1)

setfocus(sle_1)
// this works, with code 46, but not with the expected code 127?
Send(ll_handle, WM_KEYDOWN, VK_keyDelete, 0)
Send(ll_handle, WM_KEYUP, VK_keyDelete, 0)

setfocus(sle_1)
// this is correctly detected in a key event, but doesn't do anything on the sle_1?
// What am I missing?
Send(ll_handle, WM_KEYDOWN, VK_keyBack, 0)
Send(ll_handle, WM_KEYUP, VK_keyBack, 0)

TIA regards

Attachments (1)
Accepted Answer
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 3 April 2020 21:41 PM UTC
  2. PowerBuilder
  3. # Permalink

Looks like no one is going to answer this, so let me just forget about it.

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Thursday, 2 April 2020 11:12 AM UTC
  2. PowerBuilder
  3. # 1

I've been able to resolve the "problem" by using something like this (in text mode, not replacing in rtf mode):

rte_notedet.SelectText(ll_line, ll_charpos - 1, ll_line, ll_charpos)
rte_notedet.ReplaceText("")

 

Still it would be nice to get an answer to my initial question.

 

Let me also describe the "problem":

I'm saving a dw as HTML table. Then I insert that on a rte. If the insert is at the end of the control, the css styles "htmlxxx" which are visible on the toolbar when you position the cursor inside the table, is still applied after the table. Therefore I inserted a " ". After deleting (delete key) that space, going up into the html table with arrow key up and then down again, to below the table, you'd be "stuck" in the css style. By deleting the space with BackSpace that doesn't happen.

 

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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.