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

How to change the cursor's color?

20 Answers 413 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Chen
Top achievements
Rank 1
Chen asked on 08 Nov 2010, 02:41 AM
Hello,

When the text's highlight is Black, I can't find the cursor, because the cursor's color is black, how to change it?

Thanks.
Chen

20 Answers, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 11 Nov 2010, 08:52 AM
Hello Chen,

We do not provide API for customizing the look of the caret.
Thank you for pointing out this use-case, where the caret must not be black. We will make sure to change that behavior in the future.

Sincerely yours,
Iva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Toby Riley
Top achievements
Rank 1
answered on 08 Apr 2011, 12:09 PM
Hi,

Any update on this one?

I would like to change the caret colour.

Thanks T.
0
Mike
Telerik team
answered on 11 Apr 2011, 09:36 AM
Hi Tobias Riley,

You can add the following Style to RadRichTextBox resources in order to change the caret color:
<telerik:RadRichTextBox.Resources>
    <Style TargetType="telerikUI:Caret">
        <Setter Property="CaretBrush" Value="White" />
    </Style>
</telerik:RadRichTextBox.Resources>

Let us know if this worked for you.

Kind regards,
Mike
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Toby Riley
Top achievements
Rank 1
answered on 12 Apr 2011, 12:27 PM
Thanks,

Strangely it works 50% of the time.

I have the richtextbox in tha childwindow, on popup/show the cursor flashes white but then loses focus to another control. On return to focus it sometimes keeps it's white color or reverts back to black.

What can I do about this?

Thanks.
0
Iva Toteva
Telerik team
answered on 15 Apr 2011, 08:01 AM
Hello Tobias Riley,

We were not able to reproduce the issue. Could you please open a support ticket and send a sample application that illustrates the problem and some steps (if necessary) that would lead to the behavior you describe?

All the best,
Iva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Toby Riley
Top achievements
Rank 1
answered on 05 May 2011, 04:51 PM
Hi,

I'm really stuggling to recreate this in a test app! typical.

Any ideas as where to start with this....any holes that you could think are causing this problem?
0
Boby
Telerik team
answered on 11 May 2011, 09:26 AM
Hi Tobias Riley,

The Caret actually inherits from TextBox, so at first place you should check if you set any implicit styles to text boxes in your application.
How do you set the style of the caret - implicit or explicit? Do you perform any additional manipulations to the focus - for example calls to Focus method of some of the controls?

Best wishes,
Boby
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Toby Riley
Top achievements
Rank 1
answered on 11 May 2011, 12:03 PM
Hi,

I'm setting like like below within a custom theme.

I have this within a childwindow and on the open event I call focus on another control, I did remove this as I noticed that the RadRichTextBox seems to open with focus and then it flicks to this other control but then on return to the RadRichTextBox it sometimes doesn't keep it's white CaretBrush. Even after removal it still occurred so I didn't explore this much further.

Any help is really appreciated.

    <Style TargetType="telerikUI:Caret">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="telerikUI:Caret" >
                    <Grid x:Name="RootElement"  >
                        <ScrollViewer 
                            x:Name="ContentElement"
                            BorderThickness="0" Padding="0" />
                        <Rectangle x:Name="Rectangle" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="HorizontalAlignment" Value="Left" />
        <Setter Property="VerticalAlignment" Value="Top" />
        <Setter Property="AcceptsReturn" Value="True" />
        <Setter  Property="CaretBrush" Value="White"/>
        <Setter Property="Padding" Value="0" />
        <Setter Property="Foreground" Value="Transparent" />
    </Style>

0
Boby
Telerik team
answered on 13 May 2011, 10:05 AM
Hi Tobias Riley,

We managed to reproduce the issue and it looks like this is a problem in the ChildWindow, as Microsoft's TextBox has similar behavior. I'm attaching a simple demo that illustrates the case - on second or third showing of the ChildWindow both TextBox and RadRichTextBox carets
As a workaround you could add the Caret style directly in the RadRichTextBox resources (or anywhere in the ChildWindow):

<telerik:RadRichTextBox Name="radRichTextBox" Background="Black">
    <telerik:RadRichTextBox.Resources>
        <Style TargetType="telerikUI:Caret">
            <Setter Property="CaretBrush" Value="White" />
        </Style>
    </telerik:RadRichTextBox.Resources>
</telerik:RadRichTextBox>

Don't hesitate to contact us if you have other questions.


Kind regards,
Boby
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Toby Riley
Top achievements
Rank 1
answered on 13 May 2011, 11:33 AM
Hi Boby,

Thanks for looking into this but I'm still loosing the color, even with the fix below.

Any other suggestions?

Thanks Toby.
0
Boby
Telerik team
answered on 18 May 2011, 05:04 PM
Hello Tobias Riley,

It would be really hard to continue investigating the issue without a way to reproduce it; so the best thing you can do is to isolate the problem and send us a sample application (attaching it in a support ticket) that can reproduce it. The very first thing I would check would be if the ChildWindow is involved – try to remove it and see if the problem persists.

Kind regards,
Boby
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Chandra Prakash
Top achievements
Rank 2
answered on 20 Jun 2011, 06:14 PM
Hi Boby,

I am using RadRichTextBox and there is a problem that Focus not set in text area and cursor is not blinking. However I write text in text area the cursor should be blinking, But anyhow its not working. Any idea that you could think this type of behavior?

Regards
Prakash Gupta
Web Designer
INDIA
0
Vesko
Telerik team
answered on 22 Jun 2011, 12:34 PM
Hi Chandra Prakash,

Thanks for your question!
To be able to understand properly what the problem might be, we will need to have a small demo application demonstrating it. Please open a support ticket and send us an example application which isolate the problem.

Best wishes,
Vesko
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Rakesh Gandhi
Top achievements
Rank 2
answered on 18 Jul 2011, 02:47 PM
Hi,

I am using RadRichTextBox control, I have added telerik.windows.controls.input dll to the reference of this control. but I am facing below exception error.
anyone have any idea?

Exception Message : Object reference not set to an instance of an object.

 Stack Trace :    at Telerik.Windows.Documents.DocumentPositionLocationHelper.GetLineY(InlineLayoutBox box)
   at Telerik.Windows.Documents.DocumentPositionLocationHelper.GetCenter(InlineLayoutBox layoutBox)
   at Telerik.Windows.Documents.DocumentPositionLocationHelper.IsBetterSolution(InlineLayoutBox currentSolution, InlineLayoutBox candidateSolution, PointF position)
   at Telerik.Windows.Documents.DocumentPositionLocationHelper.GetNearestLeafBoxByPosition(PointF position, LayoutBox root, LayoutBox& currentSolution)
   at Telerik.Windows.Documents.DocumentPositionLocationHelper.GetLayoutBoxByPosition(PointF position, LayoutBox root)
   at Telerik.Windows.Documents.DocumentPosition.SetPosition(PointF position, Boolean MoveToNextIfOutOfBox)
   at Telerik.Windows.Documents.Selection.MouseSelectionHandler.SetDocumentPosition(DocumentPosition documentPosition, Point position, Boolean moveToNextIfOutOfBox)
   at Telerik.Windows.Documents.Selection.MouseSelectionHandler.RegisterDocumentSingleMouseDown(Boolean ctrlPressed, Boolean shiftPressed, Point position)
   at Telerik.Windows.Documents.Selection.MouseSelectionHandler.RegisterDocumentMouseDown(Boolean ctrlPressed, Boolean shiftPressed, Point position)
   at Telerik.Windows.Documents.UI.DocumentPresenterBase.Owner_MouseLeftButtonDown(Object sender, MouseButtonEventArgs e)
   at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)

Thanks,
- Parth Gandhi
Samyak Infotech Pvt. Ltd.
Ahmedabad
0
Toby Riley
Top achievements
Rank 1
answered on 19 Jul 2011, 04:56 PM
Strange that you would post this in this thread but.....I have the same/similar intermittant error.

The stack trace is below:

at Telerik.Windows.Documents.DocumentPositionLocationHelper.GetLineY(InlineLayoutBox box)

   at Telerik.Windows.Documents.DocumentPositionLocationHelper.GetCenter(InlineLayoutBox layoutBox)

   at Telerik.Windows.Documents.DocumentPositionLocationHelper.IsBetterSolution(InlineLayoutBox currentSolution, InlineLayoutBox candidateSolution, PointF position)

   at Telerik.Windows.Documents.DocumentPositionLocationHelper.GetNearestLeafBoxByPosition(PointF position, LayoutBox root, LayoutBox& currentSolution)

   at Telerik.Windows.Documents.DocumentPositionLocationHelper.GetNearestLeafBoxByPosition(PointF position, LayoutBox root, LayoutBox& currentSolution)

   at Telerik.Windows.Documents.DocumentPositionLocationHelper.GetLayoutBoxByPosition(PointF position, LayoutBox root)

   at Telerik.Windows.Documents.DocumentPosition.SetPosition(PointF position, Boolean MoveToNextIfOutOfBox)

   at Telerik.Windows.Documents.UI.DocumentWebLayoutPresenter.GetDocumentPositionFromViewPoint(Point viewPoint)

   at Telerik.Windows.Documents.UI.DocumentPresenterBase.Owner_MouseRightButtonUp(Object sender, MouseButtonEventArgs e)

   at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)

   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)


HELP!

 
0
Boby
Telerik team
answered on 21 Jul 2011, 08:38 AM
Hi Rakesh and Tobias,
We are sorry for the inconvenience. Could you please give us more details about the way to reproduce the exception - for example some steps to follow or sample project (document)?
Looking forward to your reply.

Kind regards,
Boby
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Toby Riley
Top achievements
Rank 1
answered on 25 Jul 2011, 01:48 PM
Sorry I cannot recreate, it seems a random issue.

I'll post if I discover what it is.
0
Rakesh
Top achievements
Rank 1
answered on 26 Sep 2012, 06:44 PM
I have similar requirement where my richtextbox background is black, I need to change cursor to white. I am using radrichtextbox in radwindow. If I use the style in richtextbox resource, it works for the first time when you open a window. If you reopen same window, you lose the foreground.

I see similar issue with the example you provided.
Even when user types, the foreground of text is black. Is there any way we can set foreground to white as whatever user enters.

Is there any workaround to this problem. How can we get this functionality. Please help me. It's really very important to us.

Thanks

Rakesh
0
Todor
Telerik team
answered on 28 Sep 2012, 05:04 PM
Hi Rakesh,

We are still not able to reproduce the issue with the care you have reported. If you like, you can open a support ticket and send us a sample project which contains the problem.

As for your other question, in order to set the RadRichTextBox text color to white by default, you can use this line of code which sets the default color for the current document instance:
((RadRichTextBox)sender).Document.StyleRepository["Normal"].SpanProperties.ForeColor = Colors.White;

You can execute it on RadRichTextBox_Loaded and on RadRichTextBox_DocumentChanged, as the StyleRepository is a property of the document.

Hope this helps.

 

Kind regards,
Todor
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

0
Jan
Top achievements
Rank 1
answered on 04 Oct 2013, 11:34 AM
Now easily done

[code]<telerik:RadRichTextBox CaretColor="White">[/code]
Tags
RichTextBox
Asked by
Chen
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Toby Riley
Top achievements
Rank 1
Mike
Telerik team
Boby
Telerik team
Chandra Prakash
Top achievements
Rank 2
Vesko
Telerik team
Rakesh Gandhi
Top achievements
Rank 2
Rakesh
Top achievements
Rank 1
Todor
Telerik team
Jan
Top achievements
Rank 1
Share this question
or