information need - focusgain event in SDK

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

joeitaliano
User
Posts: 89
Joined: Wed Dec 29, 2010 8:50 am

information need - focusgain event in SDK

Post by joeitaliano »

hello

i am playing with the fulldemo program that came with the SDK

when i click on a form field I have noticed that the VS debug screen displays CMainDlg::OnNamedNotify("Global::FocusGained")

i would like to know where i can get some information about this notification.

i would like to find out if it is possible to then get the field name that i have just selected

with this i could then bring up an option list in my c++ application which the user can select

then i could update the form field text with the selected text.

may thanks

joe@csolutions.com.au
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2448
Joined: Thu Jun 30, 2005 4:11 pm

Re: information need - focusgain event in SDK

Post by Vasyl - PDF-XChange »

Hi, joeitaliano.
when i click on a form field I have noticed that the VS debug screen displays CMainDlg::OnNamedNotify("Global::FocusGained")
i would like to know where i can get some information about this notification.
The simple notify "Global::FocusGained" informs you: our control (any related window from our control) gained or have already a input focus.
This event is periodically sent to the client when the end-user interacts with the our control - clicks with a mouse, activates windows, etc.
i would like to find out if it is possible to then get the field name that i have just selected
In the new build (upcoming) you will be able to use new features for get/set focused field:

Code: Select all

// get full name of focused field:
ctrl.DoDocumentVerb(docID, NULL, "GetSelectedField", dataIn, out dataOut, 0);
// dataOut == "TextBox1.0" for example
...
// change focus 
dataIn = "CheckBox1";
ctrl.DoDocumentVerb(docID, NULL, "SelectField", dataIn, NULL, 0);
Wait for the new build and look to the updated help file...

HTH.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
joeitaliano
User
Posts: 89
Joined: Wed Dec 29, 2010 8:50 am

Re: information need - focusgain event in SDK

Post by joeitaliano »

thank you so much

that is exactly what i require

one more question. i have been able to insert 1 line of text into my form field as follows

BSTR js = SysAllocString(L"var f = this.getField(\"Text2\"); if (f != null) { f.value; f.value = \"joeitaliano\"; f.value; };");

hRes = m_spView->RunJavaScript(js, NULL, 0, 0);
m_spView->GetTextFromResult(hRes, &msg);
SysFreeString(js);

however the form field is a text box that can hold 5 lines. when i try to use this line to fill up 3 lines i get an error returned
BSTR js = SysAllocString(L"var f = this.getField(\"Text2\"); if (f != null) { f.value; f.value = \"joeitaliano\rline1 \rline2\r"; f.value; };");

i tried \r in an attempt to go to the next line and also \n but still no good so there must be some other way to move to the next line or maybe there is not

any suggestions

thanks again

joe italiano
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3586
Joined: Thu Jul 08, 2004 10:36 pm

Re: information need - focusgain event in SDK

Post by Ivan - Tracker Software »

Can you try to use the following string?

Code: Select all

BSTR js = SysAllocString(L"var f = this.getField(\"Text2\"); if (f != null) { f.value = \"joeitaliano\\rline1 \\rline2\\r"; };");
Note \\ in the string.
PDF-XChange Co Ltd. (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
joeitaliano
User
Posts: 89
Joined: Wed Dec 29, 2010 8:50 am

Re: information need - focusgain event in SDK

Post by joeitaliano »

that worked

many thanks
User avatar
Paul - PDF-XChange
Site Admin
Posts: 7370
Joined: Wed Mar 25, 2009 10:37 pm

Re: information need - focusgain event in SDK

Post by Paul - PDF-XChange »

:)
Best regards

Paul O'Rorke
PDF-XChange Support
http://www.pdf-xchange.com