send CTRL-C to dchtmlviewer

This forum is for eXpress++ general support.
Message
Author
skiman
Posts: 1183
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: send CTRL-C to dchtmlviewer

#21 Post by skiman »

Hi,

Sending the key was working, the problem I had was setting focus to the PDF control in the htmlviewer. It seems as this isn't possible.

Once you click somewhere on an xbase++ control, the pdfcontrol loses the focus. There seems no way to set it back.

However, I found a solution for this with an eventhandler.

When a user select something in the pdfcontrol, the control has focus. As soon as the mouse cursor is out of the range of that pdfcontrol, the eventhandler detects this movement. The only thing you have to do is 'detecting' this and sending the CTRL-C. The PDFcontrol still has focus, and the CTRL-C is send to it.

Now I have the solution I want:
1. user clicks in the PDF control to select a word.
2. Moves the mouse cursor to a get. (CTRL-C is send by the event handler, so the selected text is put in the clipboard)
3. User clicks on the get, and in the gotfocus block, I read the clipboard.

My customer processes about 600 invoices a day, where ther need to copy/paste about 5 elements. This is about 3000 times a day to copy/paste. Now they can do it without these 3000 clicks.
Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: send CTRL-C to dchtmlviewer

#22 Post by rdonnay »

I tried using the event handler and made no progress.

Show me your solution.
The eXpress train is coming - and it has more cars.

skiman
Posts: 1183
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: send CTRL-C to dchtmlviewer

#23 Post by skiman »

Hi Roger,

In attachment the fileviewer with a handler. According to the needs, you can detect on mouse move, buttonclick.

In my application I have added a big vertical button with a width of 10 pixels. When you move the mouse from the PDF to the input fields, the mouse move above that button. This is my handler to detect this.

Code: Select all

STATIC FUNCTION PDFHandler ( nEvent, mp1, mp2, oXbp, _oDlg, GetList, aApp )
***************************************************************************
IF Valtype(oXbp) = 'O' .and. oXbp:ClassName() = 'DC_XbpPushButton' .and. valtype(oXbp:caption)=="C" .and. DC_GetProperty( oXbp, cGETLIST_TITLE )="xpdfx"
	SendCtrlKey( VK_C )
endif

RETURN DCGUI_NONE
See the button with yellow line in the screenshot. It has as title 'xpdfx', so I can select on it. So I select text on the right side, and move the cursor to the left. When it passes the button, the CTRL-C is send and selected text is copied. Each field at the left has a gotfocus with a 'getclipboard' function.
samplepdf.PNG
samplepdf.PNG (91.47 KiB) Viewed 7621 times
Attachments
fileviewer.zip
(460.89 KiB) Downloaded 573 times
Best regards,

Chris.
www.aboservice.be

User avatar
Auge_Ohr
Posts: 1405
Joined: Wed Feb 24, 2010 3:44 pm

Re: send CTRL-C to dchtmlviewer

#24 Post by Auge_Ohr »

skiman wrote:Sending the key was working, the problem I had was setting focus to the PDF control in the htmlviewer. It seems as this isn't possible.
"where" do you send your Keystroke with SendInput API function to :?:
greetings by OHR
Jimmy

skiman
Posts: 1183
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: send CTRL-C to dchtmlviewer

#25 Post by skiman »

Hi Jimmy,

The keystroke is send to the component that has focus on that moment. In this case it is the goal to send it the pdfcontrol. Since a user has selected something in the pdf (some text, date or number) this control has the focus.Now the CTRL-C is automatically send to the pdfcontrol.

Meanwhile I changed my event handler, so I can simulate a drag/drop from the PDF control to the fields I need. This will avoid thousands of mouse clicks a day. :dance:
Best regards,

Chris.
www.aboservice.be

Post Reply