ComboBox Problem



Hi

I'm trying to get a combobox handler (callback) react on a selection from the
popup menu only (i.e. not react on text typed into the entry part), without
too much success. What's the generic way ?

Here's what I've tried. I connected my callback function to the "changed" signal.
This reacts to virtually everything that possibly happens to the combo, including 
text typed in. There are no parameters passed to the callback from what it could
determine which way the entry was changed.
So I tried a flag set from a "key_press_event" handler, preventing the "changed" 
handler from executing if set. This hack seemed to work, until I discovered what
happens if the user selects part of the entry, and types a key, i.e. replacing
part of the entry by a single, new, character. These signals get fired:
"key_press_event", "delete_text", "changed", "insert_text", "changed"
The changed-signal fires twice, which makes the mentioned hack break down. I
could do the same trick (setting that flag) with the "insert_text", but that
also prevents reaction to popup selections; well, unless I make setting the
flag depending on whether only one, or more characters, are "inserted_text" -
which then breaks the situation where the user uses the X-drag-n-drop mechanism
to paste a couple of characters into the entry.

So you see these hacks end up with a horrible mess of probably unportable code
which really isn't what I want. I can't help the feeling that the combo box
implementation is severely screwed up, by hiding far too much from the application,
or, there are some API calls that are nowhere documented. In the latter case it
is the docs that are screwed, but that is true anyway.

Any suggestions ?

BTW. I'm using GTK 1.2.10.
And does anybody know the full set of signals that are possibly emitted by combo 
boxes (= that applications can connect to) ?


Cheers  Peter

-- 
      Dr. Peter Rottengatter       peter rottengatter de
                                   http://www.rottengatter.de

 PGP fingerprint : FD8C 16E5 25CB ED06 43FD  3A0F 11AD E2F8 E89A 83E8



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