ITextRangeProvider.GetBoundingRectangle() returns whole line's rect instead of substring

SyntaxEditor for WPF Forum

Posted 8 years ago by Xinen Lee
Version: 15.1.0624
Platform: .NET 4.5
Environment: Windows 10 (64-bit)
Avatar

For Test UI Automation, we need the bounding rectangle of a substring or token within a line in order to click it or hover over it. However currently the GetBoundingRectangle returns the bounding rectangle of the whole line instead. Our automation will not be able to click a specified token within a line.

Also, the returned rect for the line has Left == 0, which means it does not take into account the width of the margins (line numbers, outlining etc). This way it is hard (or not possible) for automation client to use the rect. The returned rect coordinates should be with respect to the left border of the whole Syntax Editor control, taking into account width of visible margins, in order for it to be useful.

Can this be fixed please?

Comments (5)

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

Thank you for reporting this.  What is the simplest way to test this with one of the MS automation applications or VS?  Please send detailed steps so that we can test any changes we make.


Actipro Software Support

Posted 8 years ago by Xinen Lee
Avatar

Hi,

You can use the Inspect tool from VS.

1. Locate the Text UI Object

2. Select menu item Action -> Text Pattern Explorer.

3. Make sure Options -> Highlight Current Range is selected

4. Select menu item Range -> Find ...

5. In Find dialog, with Text Attribute 'Text', put in the value of a substring in the line to search and press Next button

You can then see the expected highlighted range.

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

We have fixed the problem with translating to screen coordinates for the next version.

As for the GetVisibleRanges results, the docs on that method seem to indicate that doing it by line is fine.  It's more for just noting which ranges of text are visible.

On a side note, whenever we do step #2 in your list, inspect.exe shows highlights around each text line (now with properly updated screen coordinates) but then inspect.exe instantly crashes.  We tried different versions of inspect.exe but it always seems to happen, so we're not able to get to the steps after that to do any debugging.  Do you have any suggestions?


Actipro Software Support

Posted 8 years ago by Xinen Lee
Avatar

Hi, currently I'm only concerned with the rect from GetBoundingRectangle(), it should be of the TextRange itself and not the whole line, for the reasons I've stated in the first post (e.g. clicking a token, hovering over a token to check for tooltips). Thanks for fixing the screen coordinates portion, yes according to msdn it's supposed to return screen coordinates. I haven't looked into GetVisibleRanges. 

 

Yes, I get the crash from inspect as well, no idea why...

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

We've updated the GetBoundingRectangles method to properly return the ranges that intersect with the TextRange and not the whole line's bounds.  This update will be in the next version.


Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.