Re: gtk_combo_set_popdown_strings() coppies data?



It will link the GList values to the combo, so that they become visible in that
widget. That way the strings in the GList are still available to be used or
assaigned to another combo. For example:

gtk_combo_set_popdown_strings (GTK_COMBO (default_x_combo),
variables_list_items);

gtk_combo_set_popdown_strings (GTK_COMBO (plot_1_combo_box),
variables_list_items);

gtk_combo_set_popdown_strings (GTK_COMBO (plot_3_combo), variables_list_items);

This 3 lines will assign the same strings (variables_list_items) to 3 different
combo boxes without having to recreate the GList 2 more times. Incidently, the
list was loaded with the following routine:

   while(NEXT_LINE_AVAILABLE(TDF_GLBL->VARIABLES_LIST_FILE, temp_string))
   {
      temp_string[strlen(temp_string) - 2] = '\0';
      variables_list_items = g_list_append(variables_list_items,
g_strdup(temp_string));
   }

Then if you want to empty the contents of the combo before reloading or just for
cleaning purposes then you can simply set the GList pointer to NULL as such:

         variables_list_items = NULL;

I do this when I need to refresh the list so that we don't end up with duplicate
values or strings being appended at the end of the current GList.

Hope this is clear and it helps, if you need more help don't hesitate to ask.

Good luck!!


learfox furry ao net wrote:

Yes, it will assign the stings of data to the combo you called it for. I
have found this extremely practical for example when the same glist will be
used in more than one combo box so the glist is created only once and then
added to the combo(s) whenever necessary.

Could you please clarify? When you mean assign (in C that means the `='
operator). Does that mean it coppies or just sets the values as?

If so in which case how do we deallocate old strings?

--
Sincerely,                  ,"-_                         \|/
-Capt. Taura M.             ,   O=__                    --X--
..__                         ,_JNMNNEO=_                 /|\
OMNOUMmnne.                  {OMMNNNEEEEOO=_
UOOOBIOOOEOMMn.               'LONMMMMNNEEEOOO=.__..,,..
UUOOEUUOOOOOOOObe              '"=OMMMMWNEEEOOOOO,"=OEEEOO=,._
OOUUUIEEIOONNOIUbe.                "7OMMMMNNNNNWWEEEEOOOOOO"   "'.
EEBNNMMMNWNWWEEIMMNe.             __  7EMMMNNNNNWWWEEEEEEEOO.     " .
NNMMMMWWWMMMWEINMMMNn            "=BBEEEEMMMMMMMMNNNWWWEEOOOOO=._     .
                 http://furry.ao.net/~learfox/

--
Marco Quezada
Aerospaceo Engineero
NLX Corporation
22626 Sally Ride Dr.
Sterling, VA, 20164
mquezada nlxcorp com
703-234-2100 x1028
http://www.nlxcorp.com







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