Re: Widget reusing



On Tue, Dec 03, 2002 at 02:49:57PM +0100, Sebastian Tannert wrote: 
> The following code will fail:
> 
>  label=gtk_label_new("button"); /* define a label */
>  gtk_widget_show(label);
>  buttonA = gtk_button_new();
>  gtk_container_add(GTK_CONTAINER(buttonA),label); /* add it to BUTTON-A */
>  buttonB =gtk_button_new();
>  gtk_container_add(GTK_CONTAINER(buttonB),label); /* add it to BUTTON-B */
> 
> Reuse of a label may not save to much memory, but there are other
> situations like reuse of a toggle button which should be accesible from
> two pages of a notebook or having the same drawingarea on two notebook
> pages.

Nope, you can't do this. Widgets are only the "view" not the model -
if you want multiple views on one model, you have to provide a model,
and create a widget for each view.

Havoc



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