Re: [gtk-list] Uppercase only entry widget?




Denis Sarrazin <dsarrazin@cyberus.ca> writes: 
> I'm in the process of learning to code in GTK+ and I am trying to permit
> only uppercase text to be typed in an entry widget.  I can't seem to be
> able to do it?  Any help would be appreciated.
> 
> Note that I am using GTK+ 1.0 running under Corel/Debian Linux (KDE).
> 

OK, step one is upgrade this GTK+; it's broken, none of the
documentation applies to it, it's just generally a world of pain.  You
can upgrade to the latest GTK in Debian, it should work fine on Corel;
www.debian.org to find that package.

After you upgrade your GTK+, do the following:
 - connect to insert_text on the entry
 - in your callback, map the text to be inserted to uppercase, 
   gtk_signal_emit_stop_by_name() the insert_text signal, 
   then call gtk_editable_insert_text() with your new uppercase text.
 - Clearly there's an infinite loop problem, so you'll need to block
   your callback with the gtk_signal_handler_block() functions when 
   you call insert_text(), or maybe don't re-insert if your string 
   is already all-uppercase.

Havoc
  



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