- I've a NULL gtklabel. Upon the occurrence of an event, I set a text in this label (with gtk_label_set_text). How can I reset the gtklabel after the event (reset to NULL)?
- How can I set the max length (characters) of a GtkTextView?
- What's the easiest way to set the distance from the margin of a widget in a GtkTable?
views:
89answers:
1
A:
- As I understand from code, you can just use
gtk_label_set_text (label, NULL)
. If that fails for any reason (e.g. earlier version doesn't allowNULL
), just replace it with""
. - You cannot, directly. Simplest non-direct approach would be to connect to "insert-text" on the view's
GtkTextBuffer
andg_signal_stop_emission_by_name()
when you don't want the insertion to actually happen. Never did this, so it's just what I'd try, no guarantees it will really work. - Not quite sure what you mean. You could try using a
GtkAlignment
around your widget and set padding on it — may or may not be what you want.
doublep
2010-05-15 23:29:38
1. I already tried but not working. I've a mylabel=gtk_label_new(NULL), upon the occurrence of an event, the gtklabel display a text (passed through gtk_label_set_text(GTK_LABEL(mylabel), "text")). For example, I write a sleep(5) and a new gtk_label_set_text(GTK_LABEL(mylabel), NULL), but the result is that the occurrence of the event, I only have a NULL label after five seconds.2-3. I'll try.
stdio
2010-05-15 23:50:10
@stdio: "I only have a NULL label after five second" — this sounds like threading problems *or* lack of required threading. Display update only happens in a separate main loop iteration, so if you block the main thread for 5 sec after updating a label, you will *see* it updated only when main loop gets to make another iteration, i.e. after 5 sec.
doublep
2010-05-16 13:08:21
1. I used button-press-event and button-release-event signal to switch null and text label.2-3. I followed your suggestion and everything is ok. Thanks!
stdio
2010-05-21 23:18:20