Web lists-archives.com

Re: Dynamically filled combo box




John,

On Mon, Oct 19, 2015 at 2:54 PM,  <jcupitt@xxxxxxxxx> wrote:
> On 19 October 2015 at 18:45, Igor Korot <ikorot01@xxxxxxxxx> wrote:
>> On Mon, Oct 19, 2015 at 1:37 PM,  <jcupitt@xxxxxxxxx> wrote:
>>> On 19 October 2015 at 17:45, Igor Korot <ikorot01@xxxxxxxxx> wrote:
>>>> On Windows I have an ability to create a dynamically filled combobox.
>>>> I.e. I can catch a dropdown event (message), where I can remove all
>>>> items from the list
>>>> and insert a new string to be displayed. Then on the popup event
>>>> (message) I can remove everything and depending whether there is a
>>>> selection or not, add the appropriate string.
>>>>
>>>> Is it possible to do the same with GTK+? Either with 2 or 3?
>>>
>>> Sure, in gtk2, try:
>>>
>>> https://developer.gnome.org/gtk2/stable/GtkComboBoxText.html#gtk-combo-box-text-append-text
>>>
>>> Same thing, though a little fancier, in gtk3:
>>>
>>> https://developer.gnome.org/gtk3/stable/GtkComboBoxText.html#gtk-combo-box-text-append-text
>>
>> Ok, but the trouble is that in GTK those signals are "Actions".
>> They don't have "Run First"/"Run Last" flag.
>>
>> So, how do I properly connect to them?
>
> The signals are on the parent class. I use "changed" for an option
> being selected.  There are popup and popdown signals too, though I've
> not tried them.
>
> https://developer.gnome.org/gtk3/stable/GtkComboBox.html#GtkComboBox-changed

I am not selecting anything.
I want to dynamically fill up the combo box list, when it is displayed
and remove everything leaving just
one line in after it is pops up.

To give you an exampple:

I have a dialog with the combo box. The text in the combo box says:
"Make a selection".
When I click on the combo box arrow to display the list, the strings I
see are "Choice 1", "Choice 2", "Choice 3".
No "Make a selection".
Then after selection is made all strings are disappear and I am seeing
"Selected - Choice 1".
And so internally there is only one string available which is
currently selected.

This is what I mean by dynamically filled combo box.
Thank you.
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list