gtk_entry_get_layout_offsets with gtk_editable_set_position

Linux specific forum
User avatar
grabiller
Enthusiast
Enthusiast
Posts: 309
Joined: Wed Jun 01, 2011 9:38 am
Location: France - 89220 Rogny-Les-Septs-Ecluses
Contact:

gtk_entry_get_layout_offsets with gtk_editable_set_position

Post by grabiller »

Hi,

I've tried to find the solution on some gtk+ forums, even on their irc channel but without luck.

So I'm posting the question here, just in case:

For a StringGadget (entry/editable), and when the text is longer than the widget width, I'm trying to find the offscreen offset of the start of the text.

It works perfectly well by using gtk_entry_get_layout_offsets() if the current cursor position is at the end of the text.

But I want to know this information even if the cursor is not currently at the end of the text.

So I've tried to use gtk_editable_set_position() to set the cursor position at the end of the text followed by a call to gtk_editable_set_position(). And it does not work.

It seems the PangoLayout is not immedialty updated, until it is drawed to the screen.

So the question is: is there a way a 'force' the layout to update whenever you issue commands that moves the text position in a entry/editable widget ?

On Win32 I just have to send 2 messages equivalent to the commands above and it works, but with GTK+ there seems to be a more 'lazzy' evaluation of the widget layout.

Thanks in advance for any help.

Cheers,
Guy.
guy rabiller | radfac founder / ceo | raafal.org