Article View: borland.public.cppbuilder.internet.web
Article #1420Re: DISPID_HTMLELEMENTEVENTS2_ONFOCUS :: How to force text insertion point(caret position) of a input text box
From: Remy Lebeau (TeamB)
Date: Fri, 11 Feb 2005 21:37
Date: Fri, 11 Feb 2005 21:37
36 lines
2303 bytes
2303 bytes
"James O'Brien" <obrien@niscnet.com> wrote in message
news:420d1f09@newsgroups.borland.com...
> Below is the ONFOCUS event handler used for the InputText elements.
> The "CaretPos" value that is passed in is unique to whatever InputText
> element fired the event(I've verified this).
You did not show the code that is calling ElementCTRL_OnFocus(), or the code
that is saving the caret positions for each element.
> After this event handler executes and indicates that the cursor/caret has
> infact been moved, the text in the InputText element is fully selected
> (default behavior).
What is the actual problem you are having? My guess would be that the
browser to assigning its own caret positioning after the OnFocus event has
exited.
> //get IID_IHTMLDocument2 interface
> pElement->get_document(&Dispatch);
> if(SUCCEEDED(Dispatch->QueryInterface(IID_IHTMLDocument2,
> (LPVOID*)&Doc))){
Why are you going back to the document?
> //get IID_IHTMLTxtRange interface
> Doc->get_selection(&Selection);
You are querying the document's selection information. Why? You said that
you wanted to set the INPUT ELEMENT's caret position, but your code is not
actually doing that at all. You are modifying the DOCUMENT'S selection
instead.
Gambit
Technical Details
Message-ID:
<420d24c4$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<420d1f09@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,b4f655a4eb3bf0d7 X-Google-Attributes: gidfeeec,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.internet.web References: <420d1f09@newsgroups.borland.com> Subject: Re: DISPID_HTMLELEMENTEVENTS2_ONFOCUS :: How to force text insertion point(caret position) of a input text box Date: Fri, 11 Feb 2005 13:37:28 -0800 Lines: 38 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 68.69.17.41 Message-ID: <420d24c4$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1108157636 68.69.17.41 (11 Feb 2005 13:33:56 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail