help with gtk_text_view_add_child_in_window



Hello, I'm trying to add to empathy a widget in the input text box,
which is a GtkTextView in a GtkScrolledWindow.
What I need is to place a send button in the right area, which needs
to stay always at the bottom.

This is my code:
send_icon = [....]
gtk_text_view_set_border_window_size (GTK_TEXT_VIEW (self),
GTK_TEXT_WINDOW_RIGHT, 30);
  gtk_text_view_add_child_in_window (GTK_TEXT_VIEW (self),
priv->send_icon_event_box, GTK_TEXT_WINDOW_RIGHT, 5, 0);
/* this places the send button at the top, since the input box is only
1 line at the beginning, then it is resized up to 5 lines, after that
the vscrollbar appears */

then I connected to a signal (don't remember which, but it's called
when the text box is redrawn, so this is ok)

This is the signal handler:
range = GTK_RANGE (gtk_scrolled_window_get_vscrollbar (sw));
adj = gtk_range_get_adjustment (range);
value = (int) (gtk_adjustment_get_upper (adj) - 16); /* 16x16 icon */
gtk_text_view_move_child (GTK_TEXT_VIEW (self), send_icon, 5, value);

Well it does not work, in the sense that when the text box gets
resized the icon disappears (and if I remove the last inserted line
the icon appears again, unless the scrollbar is visible). I've tried
to play with "value" but without any achievement (I've only managed to
let the icon jump around, but not to stay at the bottom of the view,
like I want)

can you help me?


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