Re: GtkEntry Question




Brandon Long <blong@fiction.net> writes:

> I'm selecting from a list of names in a GtkClist, and the name and path is
> then placed in a GtkEntry widget.
> 
> It is likely that the name+path will be longer than the Entry widget,
> and this is fine, but I would like to automatically show the last part
> of the name, not the first part.
> 
> Default:                         What I'm trying to get:
> |------------------------|       |------------------------|
> |/path/to/signal/name/ver|       |to/signal/name/very/long|
> |------------------------|       |------------------------|
> 
> So, in the select_row callback, I get the text for the entry, prepend
> the path, and then do:
> 
> gtk_entry_set_text (GTK_ENTRY (SignalEntry), buf);
> gtk_entry_set_position (GTK_ENTRY (SignalEntry), strlen (buf));

> gtk_entry_adjust_scroll (GTK_ENTRY (SignalEntry));

This is a bug in GTK+-1.0.5. In GTK+-1.1, gtk_editable_set_position()
calls gtk_entry_adjust_scroll which calls gtk_widget_queue_draw()
on the entry.

(Hmm, I suppose that needs to be merged back for 1.0.6)

So, if you add a line 

  gtk_widget_queue_draw (SignalEntry)

after the gtk_entry_adjust_scroll(), then things will work fine
for now, and will only be doing a little bit of extra work
when the bug fixes get in.

[ BTW - gtk_entry_adjust_scroll should never have been made public. 
  That just covered up for bugs. It will be deprecated for GTK+-1.2. ]

Regards,
                                        Owen



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