GTK_Entry



Is there any way of disabling the cursor in a Gtk
Entry?

I have inherited a programme which uses a Gtk_Entryu
object for text entry.  It uses the following code to
handle key presses.

   int cursor_pos = 0;
   char *text = NULL;
   int string_size = 0;
   cursor_pos =
gtk_editable_get_position(GTK_EDITABLE(pt->entry));
   text = gtk_entry_get_text(GTK_ENTRY(pt->entry));
   if( text != NULL )
   {
       string_size = strlen( text );
       if( cursor_pos < string_size )
       {
           text[cursor_pos] = event->keyval;
           gtk_entry_set_text( GTK_ENTRY(pt->entry),
text );
          
gtk_editable_set_position(GTK_EDITABLE(pt->entry),
cursor_pos+1 );
           gtk_signal_emit_stop_by_name(
GTK_OBJECT(pt->entry),"key_press_event");
       }
   }

Occasionally when a key is pressed the cursor will
appear to jump to the end of the entry and then back
to the appropriate position.

Any idea if the cursor can be turned on and off in
a GTk_Entry (or its parent class)?  Looking at the
header files and the tutorial on the gtk site doesn't
help.  
Or is there a more obvious solution beyond completely
rewriting the code.



		
___________________________________________________________ 
Yahoo! Model Search 2005 - Find the next catwalk superstars - http://uk.news.yahoo.com/hot/model-search/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]