Re: GtkCombo



In message <200104192342 TAA63628 ww2 tqstats com>, jgotts linuxsavvy com write
s:

>In message <200104192248 SAA07141 renoir op net>, Paul Davis writes:
>
>>In message <200104192202 SAA34526 ww2 tqstats com>you write:
>
>>>Do anyone know what signal to use to handle the user clicking on the down
>  ^^ Oops, I meant to say Does.
>>>arrow in the GtkCombo widget?
>
>>i believe that you want to use the "map" signal, and return FALSE from
>>your handler. its been a while since i did this, and i can't find the
>>code where i did it, so i'm not sure which widget you need to attach
>>to, but picking one of the lesser known signals like this is the way
>>to do this. i often do this for menus, for example: when map is
>>signalled, i redefine the content of the menu, return FALSE and voila:
>>a totally dynamic menu.

>Good advice!

>gtk_signal_connect(GTK_OBJECT(combo->popwin), "map", (GtkSignalFunc) foo, NULL
>);

>worked.

>Of course, gtkcombo.h has the following to say:

>/* you should access only the entry and list fields directly */

>It would be nice to have a higher level API for this kind of thing.

I spoke too soon.  When I receive the map event, I send a request for my data
and the response comes back some time later (in this case via GnomeSocket).
When this happens, I use gtk_combo_set_popdown_strings() but the size of the
popup is barely large enough to fit the scrollbars with about 3 pixels of
visible text.  Then I need to double click the arrow to make the tiny list go
away.  A third click brings up a list which is actually visible, but it takes
two more clicks to make it go away.  Incidentally, using the map event in this
way makes XFree86 4.0.2 reproducibly seg fault.

Alternatively, I tried attaching a button_press_event handler to combo->button,
but this acts even more strange.  You have to click half a dozen times or more
to make the popup disappear and then you can't get it to come back.

I had the best luck emitting an extra button_press_event signal during my data
is ready handler (with a guard causing my button_press_event handler to
immediately exit when it gets triggered the second time).  Things appear to
work normally, except the first time the popup is displayed, it's the tiny
widget where nothing is visible (see above).

I briefly perused gtkcombo.c and it looks hairy, e.g. it generates fake events,
has two button_press_event handlers, etc.

Does anybody have any ideas?

-- 
John GOTTS <jgotts linuxsavvy com>  http://linuxsavvy.com/staff/jgotts




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