Create dynamic Widget Count



Hello List,

I have a problem. I want too create in my program dynamic Widgets.

i have used pointer to create the widgets, my Code:

for(int i=0;i<*folderCount;i++) {

			mainLabel_Folder[i] = new Gtk::Label("Label");

			mainVBox_Folder.pack_start(*mainLabel_Folder[i],Gtk::PACK_EXPAND_WIDGET);

}

I can compile, if the code is in the right order, IF in false order i get compile errors.
if compiled:
i have sometimes "segemtation fault" if I clicked on an  OTHER widget(not all, only one or two):


With this code, all thinks work: (but it is not dynamic, because i have to give a array length)

for(int i=0;i<*folderCount;i++) {

	  			mainLabel2_Folder[i].set_label("LabelWork");

	  			mainVBox_Folder.pack_start(mainLabel2_Folder[i],Gtk::PACK_EXPAND_WIDGET);

}


Can someone please help me, getting a dynamical count of Widgets in my Window Class?

thanks

Robert

_______________________________________________________________________
EINE FÜR ALLE: die kostenlose WEB.DE-Plattform für Freunde und Deine
Homepage mit eigenem Namen. Jetzt starten! http://unddu.de/?kid=kid mf2



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