Reputation: 11
I have a Gtk entry. I need to completely remove this caret cursor, how can I do this? I searched for information about this for a long time but found only how to remove the blinking of Gtk entry.
Upvotes: 1
Views: 324
Reputation: 5307
Until you find a better one use CSS.
Just set the caret-color
background to the same background-color of the entry
:
main.c
#include <gtk/gtk.h>
int main ( void )
{
GtkWidget *window;
GtkWidget *grid;
GtkWidget *entry;
/// ***
gtk_init ( NULL, NULL );
/// ***
window = gtk_window_new ( GTK_WINDOW_TOPLEVEL );
gtk_window_set_title ( GTK_WINDOW ( window ), "Hello There!" );
gtk_window_set_default_size ( GTK_WINDOW ( window ), 200, 100 );
g_signal_connect ( window, "destroy", gtk_main_quit, NULL );
///***
grid = gtk_grid_new();
gtk_container_add ( GTK_CONTAINER ( window ), grid );
///***
entry = gtk_entry_new();
g_object_set ( entry, "margin-top", 30, NULL );
g_object_set ( entry, "margin-left", 20, NULL );
gtk_grid_attach ( GTK_GRID ( grid ), entry, 0, 0, 1, 1 );
/// ***
gtk_widget_show_all ( window );
gtk_main();
}
CSS:
window
{
background-color: red;
}
entry
{
background-color: yellow;
caret-color: yellow;
}
Upvotes: 2