TextEditor new method setCaretColour() request


#1

Could we please get a public method for TextEditor:

    void setCaretColour (Colour colour)
    {
        caret->setColour (CaretComponent::caretColourId, colour);
    }

Thanks,

Rail


#2

Hi Rail, hope I'm not mistaken but I don't think that can work with the current TextEditor as the caret component isn't garaunteed to last the lifetime of the TextEditor (If you take a look at setCaretVisible you'll see how it can be destroyed).  Instead you'll need to use a lookandfeel to change it.


#3

Hi Graeme,

I’ve tested this and it seems to be working okay… caret is a private member of TextEditor… so I don’t believe I’d be able to change it’s color using a LookAndFeel…

Video: https://www.platinumsamples.com/public/juce/customTextEditor.swf

Rail


#4

Aah… I hadn’t seen LookAndFeel_V2::createCaretComponent (Component* keyFocusOwner) before when I was looking through the code…

Thanks!

Rail