15 Oct 2004 20:46
Re: Proper way to remove a child attached to a cell in a GtkSheet?
Adrian E. Feiguin <afeiguin <at> uci.edu>
2004-10-15 18:46:07 GMT
2004-10-15 18:46:07 GMT
That's correct, you have to use gtk_container_remove! I'm happy to hear about your progress. This will be a real testdrive for gtkextra. We'll figure out the text problem and I'll release. Do you like the smooth looking pango fonts on the plots so far?saludos, <ADRIAN> Al Hooton wrote: > I have figured this one out, here's the approach for anybody else on >the list that needs to properly remove an attached child from a cell >without causing memory leaks: > > GtkSheet *sheet; > GtkSheetChild *child; > GtkWidget *childWidget; > > if ((child = gtk_sheet_get_child_at(sheet, row, col)) != NULL) { > > if ((childWidget = child->widget) != NULL) { > gtk_container_remove(GTK_CONTAINER(sheet), > GTK_WIDGET(childWidget)); > } > } > > > If somebody knows a better/easier way, I'm all ears! > >-Al > > >On Thu, 2004-10-14 at 22:10, Al Hooton wrote: > > >> I have a situation where I use gtk_sheet_attach() to attach a child (an >>optionMenu, in this case) to a cell in a gtkSheet. Later on, I want to >>attach a different child to this cell. >> >> I have studied the gtk_sheet_attach() code, and note that it builds up >>a linked list of children, one for each call. This makes sense, because >>you will often want multiple children attached to a cell, but in my case >>this is not what I want -- I want to destroy the prior attached child, >>and then attach a new one. >> >> I could always call gtk_widget_destroy on the child, and then go behind >>the scenes and fix up the pointer in the gtkSheet struct myself, but >>this messy and error-prone. >> >> What is the proper way within GtkExtra to delete (and destroy) a child >>that has been attached to a gtkSheet so I can then attach a different >>one? >> >> Sorry for all the rapid-fire questions, Adrian -- but, I'm making good >>progress using the new gtkextra-2! It appears to be more stable (except >>for the microscopic text problem I posted about earlier that still has >>me puzzled), and the API changes provide for more consistency across the >>various parts of the system. >> >> Thanks for continuing to drive this forward to a proper 1.0 release! >> >>-Al >> >> >> >> >> >>------------------------------------------------------- >>This SF.net email is sponsored by: IT Product Guide on ITManagersJournal >>Use IT products in your business? Tell us what you think of them. Give us >>Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more >>http://productguide.itmanagersjournal.com/guidepromo.tmpl >>_______________________________________________ >>Scigraphica-gtkextra mailing list >>Scigraphica-gtkextra <at> lists.sourceforge.net >>https://lists.sourceforge.net/lists/listinfo/scigraphica-gtkextra >> >> >><!DSPAM:416f5c18217754311115147> >> >> > > > >------------------------------------------------------- >This SF.net email is sponsored by: IT Product Guide on ITManagersJournal >Use IT products in your business? Tell us what you think of them. Give us >Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more >http://productguide.itmanagersjournal.com/guidepromo.tmpl >_______________________________________________ >Scigraphica-gtkextra mailing list >Scigraphica-gtkextra <at> lists.sourceforge.net >https://lists.sourceforge.net/lists/listinfo/scigraphica-gtkextra > >. > > > ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl
saludos,
<ADRIAN>
Al Hooton wrote:
> I have figured this one out, here's the approach for anybody else on
>the list that needs to properly remove an attached child from a cell
>without causing memory leaks:
>
> GtkSheet *sheet;
> GtkSheetChild *child;
> GtkWidget *childWidget;
>
> if ((child = gtk_sheet_get_child_at(sheet, row, col)) != NULL) {
>
> if ((childWidget = child->widget) != NULL) {
> gtk_container_remove(GTK_CONTAINER(sheet),
> GTK_WIDGET(childWidget));
> }
> }
>
>
> If somebody knows a better/easier way, I'm all ears!
>
>-Al
>
>
>On Thu, 2004-10-14 at 22:10, Al Hooton wrote:
>
>
>> I have a situation where I use gtk_sheet_attach() to attach a child (an
>>optionMenu, in this case) to a cell in a gtkSheet. Later on, I want to
>>attach a different child to this cell.
>>
>> I have studied the gtk_sheet_attach() code, and note that it builds up
>>a linked list of children, one for each call. This makes sense, because
>>you will often want multiple children attached to a cell, but in my case
>>this is not what I want -- I want to destroy the prior attached child,
>>and then attach a new one.
>>
>> I could always call gtk_widget_destroy on the child, and then go behind
>>the scenes and fix up the pointer in the gtkSheet struct myself, but
>>this messy and error-prone.
>>
>> What is the proper way within GtkExtra to delete (and destroy) a child
>>that has been attached to a gtkSheet so I can then attach a different
>>one?
>>
>> Sorry for all the rapid-fire questions, Adrian -- but, I'm making good
>>progress using the new gtkextra-2! It appears to be more stable (except
>>for the microscopic text problem I posted about earlier that still has
>>me puzzled), and the API changes provide for more consistency across the
>>various parts of the system.
>>
>> Thanks for continuing to drive this forward to a proper 1.0 release!
>>
>>-Al
>>
>>
>>
>>
>>
>>-------------------------------------------------------
>>This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
>>Use IT products in your business? Tell us what you think of them. Give us
>>Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
>>
RSS Feed