Re: gtk_combo



Hi,
i declared a string variable(const gchar
value[70]) and copied value read from mysql to
variable and added the string variable to list
using g_list_append (items, value);. It is
working. But the combo box contains only the
last value repeated as many as the number of
records fetched. Is it because of that GList
keeps lvalue of the added string.  Can you
please suggest a work around for this problem. 

Why can't we add some other functions to add
strings to the combo box like in the case of
option menus in gtk2.0 at least.

Regards
Rafeeq C E


Taura Milana <learfox furry ao net> said:

On 2001.12.08 05:49 Rafeeq C E  wrote:


**********************************************************
while ((row = mysql_fetch_row(result))){
    items = g_list_append (items, row[0]);  
}
combo1 = gtk_combo_new();
gtk_combo_set_popdown_strings (GTK_COMBO
(combo1), items);
gtk_widget_show(combo1);

I don't know what mysql is or what it returns,
but assuming
it returns a char *, then you should do it
like this:

const gchar *cstrptr;

items = NULL;
cstrptr = mysql_fetch_row(result);
while(cstrptr != NULL)
{
 items = g_list_append items, cstrptr);
 cstrptr = mysql_fetch_row(result);
}

Assuming that result is an incremented handle
that mysqpl_fetch_row()
increments on each call.

Also when you give code, besure to give
prototypes, espessially
about alien languages like mysql. Since this
is a gtk list,
most coders may not know what mysql is.


--
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/

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org

http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




-- 
--------------------------------------------------
There is a fine line between fishing and
standing on the shore looking like an idiot.
             



________________________________________________________________

This message was sent using Myiris Mail
For more information visit http://mail.myiris.com




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