Re: Set maximum length for text control

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

 



Your callback looks to be set up correctly but you have some unnecessary assignments in the function. You don't want.

text = text;
len = len;
ptr = ptr;

The len and text variables are already set up for you to use in the callback. GTK takes care of that part for you. The ptr variable in your set up is going to have the variable or variables that you want to send to the maxlen_handler() function. It can also be NULL so I don't know by looking at your code how that pointer is set up. What does

g_signal_connect_after(buffer, "insert-text", G_CALLBACK(maxlen_handler), NULL);

look like in your code? Is there a value in the NULL position that you need in your function?

Check where the location iter is.

g_print("Iters %i %i\n", gtk_text_iter_get_offset(location), gtk_text_iter_get_offset(&end));

It might be at the same position as the end iter. Then the delete won't do anything. You might need another iter to get the starting position of where you want to remove text.

Eric
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux