How to set caret size?


#1

here an image to explain for my question:

the first one is initial state, as you look, the size is not correct...

but it will be auto resized after you typing some text - second one.

and even you remove all text, the caret is still correct.

 

so my question is, how to set the initial size of the caret for the texteditor?

thank you.

 


#2

Take a look at void CaretComponent::setCaretPosition(const Rectangle< int > & characterArea)

http://www.juce.com/api/classCaretComponent.html
 

 


#3

but the TextEditor class does not have a method to get the caret component...


#4

The caret size will be based on the font, so maybe call applyFontToAllText when you first create the editor?


#5

i replace my .setFont(26.0f) to .applyFontToAllText(26.0f) and now it works.

but i think .setFont should do this? and .applyFontToAllText is just unnecessary?


#6

ahhhh. sorry my falt.   i just thought that TextEditor is not only a sinlge line text editor..

it probably have huge of text, and applyFontToAllText does a very slow performance...

 

many thanks jules.