Re: GtkComboBox: How to be notified of selection



On Tue, 20 Aug 2002, John Cupitt wrote:
> Lars Clausen wrote:
>> On 02 Aug 2002, Lars Clausen wrote:
>> 
>>>I'm using a GtkComboBox in Dia for zoom selection.  I can't quite get it
>>>to behave the way I'd like.  It ought to be that when the user selects
>>>an item from the drop-down list (making the drop-down disappear), the
>>>zoom amount should be updated.  However, I haven't found a signal that
>>>will tell me that the user made his or her final selection.
>>>"select-child" and "selection-changed" from the GtkList is called while
>>>the mouse is dragged over the items.  "unmap", "hide" and "unrealize"
>>>don't get called.  I don't want the user to have to press Enter after
>>>selecting from the menu, that's all.  What should I do?
>> 
>> 
>> In the end, I dropped the ComboBox and changed to combined Entry and
> Button
>> with menu-popup.  Works just the way the ComboBox should have.
>> 
>> -Lars
>> 
> 
> Hi Lars, this is a bit late, but I got around this by catching "hide" on 
> the combo's popup window:
> 
>    popwin = GTK_COMBO (fred)->popwin;
>    gtk_signal_connect (GTK_OBJECT (popwin), "hide",
>                        GTK_SIGNAL_FUNC (selected),
>                        (gpointer) xx);

The problem with that is that you're signalled when the menu disappears,
whether or not the user selected an item.  With the popup menu, I am only
notified when an item is actually selected.  

-Lars

-- 
Lars Clausen (http://shasta.cs.uiuc.edu/~lrclause)| Hårdgrim of Numenor
"I do not agree with a word that you say, but I   |----------------------------
will defend to the death your right to say it."   | Where are we going, and
    --Evelyn Beatrice Hall paraphrasing Voltaire  | what's with the handbasket?



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