We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Caret position does not match text.

I’ve run into a very interesting issue with the RichTextBoxAdv in my application.  To level set I don’t see this issue in any of the sample applications, and I can’t seem to re-create it in a smaller sample application. So, I’m pretty sure it’s something I’m doing wrong, but for the life of me, I cannot figure out how to correct this issue.

What’s happening is that the caret(cursor) is traveling at a different distance per character than the actual text.  So as I continue to type along the line, the caret is either behind the text, which then actually truncates the letters or hides them completely, or it is far ahead of the text making it hard to know where the next character is going to be.  It definitely seems to be line dependent.  At the start of a new line all is well, but as more text is added to this line the caret becomes more distant from the text.  After getting past the end of the line, and text wraps to the next line it positions itself right again for a while. It seems like the character font size is different than what the caret thinks it is.  

See the truncated 'S' below:
Image showing truncated characters
Has anyone else run into this?  Any thoughts on what I could be doing to cause this?

Any help will be greatly appreciated.     

5 Replies

JP John Prass December 8, 2019 02:29 PM UTC

After more research I was able to narrow this issue down a bit.  

It is happening when you have a SfRichTextBoxAdv in a TabControlExt when the TabControl TabStripPlacement is set to any option other than Top.

I've attached a small sample that exhibits the issue.  

Steps to re-create:
1. Load solution
2. Build and run solution
3. Start typing in the SfRichTextBoxAdv.
4. Notice that the cursor starts hiding the text as you type because it is behind where the actual text is being placed.
5. If you change the textbox to use a bigger font ({ FontSize = 18 }) and run again, you'll notice that the cursor will move farther away from the placed text.

If you set TabStripPlacement="Top", build and run again.  The problem will no longer exist.  

Thank you.

Attachment: TestOverrunofCaret_848cb67.zip


PS Premkumar Sundaramoorthy Syncfusion Team December 9, 2019 05:09 AM UTC

Hi John, 
 
Thank you for using syncfusion product, 
 
We were able to reproduce the reported issue cursor gets misplaced while moving. We will validate this issue and get back to you with more details on 12/11/2019.  
 
Please let us know if you have any other question. 
  
  
Regards, 
Premkumar 



PS Premkumar Sundaramoorthy Syncfusion Team December 11, 2019 01:38 PM UTC

Hi John,  
  
Our SfRichTextBoxAdv uses TextBlock to display the text’s. On analysing further, the TextOptions.TextFormattingMode attached property is set to Display for TabItem when the strip placement is other than top for better display of text. The attached property value is inherited for all the visual tree child elements of TabItemEx. Hence, the text blocks measure values differ in code behind and in Visual tree (the text measured based on GDI settings) for the text. We need to break the inheritance of the property value by setting it to default value for SfRichTextBoxAdv control. We have modified the code in sample and attached in the following link,  

Sample link: 

Please find the modified code snippet below, kindly try the code and let us know whether the issue resolved at your end?  
Sample code:  
<syncfusion:TabControlExt x:Name="TheTabControl"  
                                  ItemsSource="{Binding TheTabItems}"  
                                  Grid.Column="2" 
                                  SelectedItem="{Binding SelectedTab}"  
                                  CloseButtonType="Hide"                                    
                                  IsNewButtonEnabled="True"  
                                  TabStripPlacement="Bottom" 
                                  IsCustomTabItemContextMenuEnabled="True" 
                                  DefaultContextMenuItemVisibility="Collapsed" 
                                  TextOptions.TextFormattingMode="Ideal"> 
        </syncfusion:TabControlExt> 

For more information about TextOptions: 

Please let us know if you have any questions. 
  
  
Regards, 
Premkumar 



JP John Prass December 11, 2019 11:34 PM UTC

That took care of the issue.  Thank you so much. 

I want to add that your customer support is top notch.  It's probably the best I have received from any company.  You guys are doing something right!


PG Pon Geetha A J Syncfusion Team December 12, 2019 11:18 AM UTC

Hi John, 
  
Thank you for the feedback. We are glad to know that your issue is resolved. 
  
Regards, 
Geetha 


Loader.
Live Chat Icon For mobile
Up arrow icon