Hi to everyone,
I have a class where I want to store a list of Dialogs; This List is
dynamical.
so I've declared an:
std::vector <Gtk::Dialog> ;
Here I've faced my first problem
when i try to do:
myList.push_back (temp_dialog);
the compiler output is:
error C2248: 'Gtk::Dialog::Dialog' : cannot access private member
declared in class 'Gtk::Dialog'
while compiling class template member function 'void
std::vector<_Ty>::_Insert_n(std::_Vector_const_iterator<_Ty,_Alloc>,__w64
unsigned int,const _Ty &)'
with (...........)
I tried with assign, with resize and many others methods of vector (also
tried std::list) and all do the same error.
Second problem:
Because I couldn't use std::vector I created a array which I would
allocate dynamically:
Declaration: Gtk::Dialog* mPopUpDialog;
void
MyClass::LaunchPopUps(bool launch)
{
1- int numberOfPopUps = mpSystem->GetNumberOfItems();
2- if (launch)
3- {
4- if (mActualpopUpListSize != 0)
5- {
6- LaunchVariablePopUps(false);
7- }
8- mActualpopUpListSize = numberOfPopUps;
9- _ *mPopUpDialog = new Gtk::Dialog[numberOfPopUps];*_
10- std::map<Glib::ustring,Variable> variableMap;
11- std::map<Glib::ustring,Variable>::iterator variableIT;
12- variableMap = mpSystem->GetVariablesList();
13- int i = 0;
14- for (variableIT = variableMap.begin(); variableIT !=
variableMap.end(); ++variableIT)
15- {
16- mPopUpsWindow.push_back (tempWindow);
17- //mPopUpDialog[i].set_parent(*pParentWindow);
18- mPopUpDialog[i].set_title(variableIT->second.GetName());
19- mPopUpDialog[i].show_now();
20- ++i;
21- }
22- }
23- else
24- {
25- for (int i = 0; i < mActualpopUpListSize; i++)
26- {
27- mPopUpDialog[i].hide();
28- }
29- mActualpopUpListSize = 0;
30- *_delete[] mPopUpDialog;_*
31- }
At line 9 I allocate memory for the pop up dialogs that I need; Here OK;
At line 19 I call show() instead of run() to allow the main window
interaction with the open dialogs. Here OK;
When I want to Hide the dialogs the program crashes when it reaches line
30. If I comment it the app runs as I want, it shows and hides well,
however it will allocate memory without freeing it.
Problem 3:
I tried to use Gtk::manage at line 9: _*mPopUpDialog = Gtk::manage(new
Gtk::Dialog[numberOfPopUps]); and comment line 30.*_ But it does not
solve the problem; The app does not crash but at debug console it
appears a gtk error message that says:
WARNING **: gtkm: Atempt to call Gtk::manage() on a Gtk::Window, but a
Gtk::Window has no parent container to manage its lifetime;
Can anyone figure out how to crate a dynamical array of Gtk::Dialogs?
Thanks in advance,
Filipe Apóstolo
_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list