Re: appending a clist row
- From: learfox furry ao net
- To: GTK Application Development List <gtk-app-devel-list gnome org>
- Subject: Re: appending a clist row
- Date: Thu, 4 Jan 2001 18:23:36 -0800 (PST)
create blank rows without having to allocate and initialize additional
memory to do so. Any help or suggestions would be greatly appreciated!
The GTK Tutorial mentions this.. have a go at chapter 11.
gtk_tutorial/html/gtk_tut-11.html
By using gtk_clist_append/prepend/insert with NULL as *text[] it adds an
empty slot for your to fill.
(look at me... I just found that out two days ago ;-) )
When you use gtk_clist_append/prepend/insert, you need to pass non-NULL
values (contrary to what the tutorial says).
One thing you can do is creating a blank array:
gint i, clist_columns = 4;
gchar **text;
/* Allocate a blank array of strings. */
text = (char **)malloc(clist_columns * sizeof(char *));
if(text != NULL)
{
/* Set each pointer to point to an allocated empty string. */
for(i = 0; i < clist_columns; i++)
text[i] = strdup("");
}
/* Add the item into the clist. */
gtk_clist_append(clist, text);
/* Now deallocate text. */
if(text != NULL)
{
for(i = 0; i < clist_columns; i++)
free(text[i]);
}
free(text);
text = NULL;
clist_columns = 0;
--
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/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]