This is a migrated thread and some comments may be shown as answers.

Table error

1 Answer 36 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Dominic
Top achievements
Rank 1
Dominic asked on 26 Nov 2012, 05:11 PM
I have a read-only RadRichTextBox control which contains several nested tables. When the user hovers the cursor over the tables an icon appears containing four arrows (presumably it is intended for moving and/or sizing the tables). When the user moves the cursor over the icon it produces the error below.
My first priority is to prevent this error appearing, but I would also like to stop the icon appearing if possible, given that the document is readonly and so the user is not permitted to resize or move any of the tables.
  
Error
Length cannot be less than zero
Parameter name: length

Error Details
   at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
   at System.String.Substring(Int32 startIndex, Int32 length)
   at Telerik.Windows.Documents.Layout.SpanLayoutBox.BinarySearchSplitIndex(SpanLayoutBox spanBox, Single availableWidth)
   at Telerik.Windows.Documents.SpanBoxPositionHandler.MoveToLocation(PointF location)
   at Telerik.Windows.Documents.DocumentPosition.SetPosition(PointF position, Boolean MoveToNextIfOutOfBox)
   at Telerik.Windows.Documents.UI.DocumentPrintLayoutPresenter.GetDocumentPositionFromViewPoint(Point viewPoint)
   at Telerik.Windows.Documents.UI.Layers.TableDecorationLayers.TableMovement.TableMovementUILayer.OnMove(MouseEventArgs e)
   at Telerik.Windows.Documents.UI.Layers.TableDecorationLayers.TableMovement.TableMovementUILayer.<>c__DisplayClass2.<MouseMove>b__0()
   at Telerik.Windows.Documents.Utils.DelayedExecution.ExecuteAction(Boolean asynch)
   at Telerik.Windows.Documents.Utils.DelayedExecution.timer_Tick(Object sender, EventArgs e)
   at MS.Internal.CoreInvokeHandler.InvokeEventHandler(UInt32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags)

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 28 Nov 2012, 02:01 PM
Hi Dominic,

We haven't observed such an exception when hovering over the adorner. Can you please provide a document so we can isolate the issue and elaborate on the steps to reproduce the exception?

When it comes to the current logic, we are not considering removing the layer when the document is read-only, as it also allows selecting the table (select and copy for example). 

In the meantime, as a workaround you can disable the TableMovementLayer as follows:

public MainPage()
{
    InitializeComponent();
    this.editor.UILayersBuilder = new CustomUILayerBuilder();
}
  
class CustomUILayerBuilder : UILayersBuilder
{
    protected override void BuildUILayersOverride(IUILayerContainer uiLayerContainer)
    {
        base.BuildUILayersOverride(uiLayerContainer);
        uiLayerContainer.UILayers.Remove(DefaultUILayers.TableMovementLayer);
    }
}

We will be waiting for your reply.


Regards,
Martin
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
RichTextBox
Asked by
Dominic
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or