Customizable text input cursor

Discussion of features and help with problems encountered while using libRocket

Customizable text input cursor

Postby spacedude on Wed Apr 02, 2008 11:30 pm

With the theme I've created the default cursor size on the text input elements are too big, see below:
cursor_size1.png
Unmodified cursor height
cursor_size1.png (50.13 KiB) Viewed 7591 times


I found the line of code which determines it's size in WidgetTextInput::GenerateCursor:
Code: Select all
cursor_size.y = (float) Core::ElementUtilities::GetLineHeight(text_element) + 2;

And got rid of the +2 at the end and it now looks better:
cursor_size2.png
Modified cursor height
cursor_size2.png (49.03 KiB) Viewed 7591 times


But I think it would be nice to be able to customise this without modifying the code. Ideally we should be able to use any graphic to represent the cursor, perhaps something similar to the way the mouse cursor works.
spacedude
 
Posts: 100
Joined: Fri Feb 08, 2008 10:16 am

Re: Customizable text input cursor

Postby RobertP on Thu Nov 19, 2015 11:54 pm

Is there a better way to change the caret height without changing the source code? Or do we still need to modify the source code to change the caret height, as described above?
RobertP
 
Posts: 8
Joined: Tue Apr 07, 2015 2:22 pm

Re: Customizable text input cursor

Postby RobertP on Fri Nov 20, 2015 8:57 pm

I found another way that worked for me and might work for others:

Set the line-height rcss property on the element. This changes both the cursor height and the height of the box that highlights any selected text.
RobertP
 
Posts: 8
Joined: Tue Apr 07, 2015 2:22 pm


Return to Using libRocket


cron