[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kfm-devel
Subject:    Re: khtml/khtmlw and getSelected()/getSelectedText()
From:       Lars Knoll <Lars.Knoll () mpi-hd ! mpg ! de>
Date:       1999-06-17 12:59:17
[Download RAW message or body]

On Wed, 16 Jun 1999, Dawit Alemayehu wrote:

> On Wed, 16 Jun 1999, Waldo Bastian wrote:
> [snipped]
> > I had a look at this the other day. The problem seems to be that select() isn't
> > working correctly for HTMLText objects. You might have noted that Ctrl-A
> > does select all other objects (e.g. images, links) on a page.
> 
> Correct.  This is what I actually meant.  It does not select the text objects
> at all.  But what is wierd is that HTMLLinkText inherts from HTMLText and
> does not override the select() method at all.  Why would it then work for
> hyper-links and not regular text objects. 
> 
> > I think that we should add a select(...) method to HTMLText which takes into
> > account the selStart and selEnd fields of the HTMLText object. 
> 
> >From one of the select() methods in HTMLText :
> 
> void HTMLText::select( KHTMLWidget *_htmlw, HTMLChain *_chain,
>     bool _select, int _tx, int _ty )
> {
>     const char *u = getURL();
>     if ( (u == 0) || (*u == '\0') || (_select == isSelected()) )
> 	return;
> 
>     setSelected( _select );
> 
> 	selStart = 0;  
> 	selEnd = strlen( text );
> 
>     _chain->push( this );
>     _htmlw->paint(_chain, x + _tx, y - ascent + _ty, width, ascent+descent);
>     _chain->pop();
> }
> 
> setStart and selEnd values that contain the length of the text within the
> HTMLText object are indeed already in both select methods, but they are not used
> at all in these methods.  Could this be the problem ??  The reason
> I am unsure is because HTMLLinkText inherts from HTMLText and does not override
> the select() methods, however the select() function works okay for it. 

Sure, HTMLLinkText's getURL function return's != 0, opposed to KHTMLText.
After a short look through the htmlobjects... select() onlye seems to
select URL's. There's another method called selectText(). Maybe that's
what you're looking for?

Cheers,
Lars

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic