PDW widget: get the rect of the hilitedRange

Keith Clarke keith.clarke at me.com
Mon Jan 10 17:19:51 EST 2022


Hi folks,
Please can anyone advise how to get the rendered rectangle of highlighted text in the PDF widget…?

I can successfully get the first word from the page text using something like:
put pPageNum into tHilitedArray["from"]["page”] // = 1

put pPageNum into tHilitedArray["to"]["page”] // = 1
put the length of word tWordNum of pPageText into tWordLength // = ‘3’ as the word is “the"

put tWordIndex into tHilitedArray["from"]["index”] // = 1

put tWordIndex + tWordLength -1 into tHilitedArray["to"]["index”] // = 3
set the hilitedRange of control "PDF1" to tHilitedArray

put the hilitedRangeText of control "PDF1" into tText // = “the"


However, when I attempt to get the rendered rect of this word, to compare with namedDestinations in the page ... 
put the rectangle of the hilitedRange of control "PDF1" into tRect // returns (Chunk: error in object expression) near “the”...

I’ve tried using the hilitedRangeText but get similar errors. 
Any clues?
TIA
Keith


More information about the use-livecode mailing list