Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Nov. 21, 2005 15:13:43

Simon J.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

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 = 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/_______________________________________________
gtk-list mailing list
gtk-list@gnome.orghttp://mail.gnome.org/mailman/listinfo/gtk-list

Offline

Board footer

Moderator control

Enjoy the 24th of April
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support