Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Web Browser control
Message
From
22/01/2022 05:43:37
 
 
To
21/01/2022 09:07:06
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
01683307
Message ID:
01683313
Views:
64
Hi Tore,

Thanks a lot it worked exactly as expected, I did lot of searching but not found any clue.

Regards,
Jignesh


From IE version 10 some event calls need at least one parameter, even if that parameter isn't used. So instead of xx.someevent() you can try xx.someevent(.F.).

Read more here: Clicks not working in Internet Explorer Automation from FoxPro

>Hello,
>
>I have a form with Microsoft Webbrowser activex control which works as HTML editor. There are templates for remarks (plain text), which user selects and it then paste in browser control.
>The text in remark may has multiple blocks of underscores like "____________________" it should be find and selected by pressing TAB key so user can fill the blanks and move to the next blank by just pressing TAB.
>I have implemented an eventhandler (HTMLDocumentEvents2 interface) to trap TAB key in keypress/keyup/keydown events, following the code I am using to achive this.
>
>Tried Method 1
>PROCEDURE HTMLDocumentEvents2_onkeyup(pEvtObj AS VARIANT) AS VOID
>IF This.nKeyCode = 9 && Value set in keydown event.
> This.nKeyCode = 0
> LOCAL nMoveValue, nPos
> nMoveValue = IIF(THIS.lShiftPressed,-1,1)
> IF ISNULL(THIS.oRange)
> THIS.oRange = THIS.oHTMLControl.Cont.TaxIE.Document.Selection.CreateRange()
> THIS.oRange.Expand("textedit")
> ELSE
> THIS.oRange.Collapse(.F.)
> ENDIF
>
> IF THIS.oRange.FindText("__", 1, IIF(THIS.lShiftPressed,1,0))
> THIS.oRange.Select()
> THIS.oRange.Expand("word")
>
> DO WHILE (" "$THIS.oRange.text)
> THIS.oRange.moveEnd("character", -1)
> ENDDO
>
> THIS.oRange.Select()
> THIS.oRange.ScrollIntoView()
> ENDIF
>ENDIF
>ENDPROC
>
>
>
>Tried Method 2
>IF This.nKeyCode = 9 &&THIS.lTabPressed
> This.nKeyCode = 0
> LOCAL nMoveValue, nPos
> nMoveValue = IIF(THIS.lShiftPressed,-1,1)
>
> IF ISNULL(THIS.oRange)
> THIS.oRange = THIS.oHTMLControl.Cont.TaxIE.Document.Selection.CreateRange()
> THIS.oRange.Expand("textedit")
> ELSE
> IF ATC("__",THIS.oRange.Text,THIS.nForwardOccurance)=0
> THIS.oRange = THIS.oHTMLControl.Cont.TaxIE.Document.Selection.CreateRange()
> THIS.oRange.Expand("textedit")
> ELSE
> THIS.oRange.Collapse(.F.)
> ENDIF
> ENDIF
>
> nPos = ATC("__",THIS.oRange.Text,THIS.nForwardOccurance)
>
> IF nPos>0
> THIS.oRange.Move("Character",nPos)
> THIS.oRange.Expand("Word")
>
> DO WHILE (" "$THIS.oRange.text) && to remove trailing spaces
> THIS.oRange.moveEnd("character", -1)
> ENDDO
>
> THIS.oRange.Select()
> THIS.oRange.ScrollIntoView()
> THIS.nForwardOccurance = THIS.nForwardOccurance + LEN(THIS.oRange.Text)
> ELSE
> THIS.nForwardOccurance = 1
> THIS.oRange.Move("Character",1)
> THIS.oRange.Select()
> ENDIF
>ENDIF
>ENDPROC
>
>
>None of methods working and the cursor not moving by any of method.
>
>PS: The code is working if Document Mode is IE8 or lower, and doesn't work if it's higher than IE8.
>
>I have checked that the Move() and Select() doesn't work.
>
>I hope I could explain the issue.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform