[gtkmm] Searching object into a box



Hi everybody.

	I'm new to the list and this is my first post. I'm nota a native
english speaker, so please excuse my poor English.

	I'm programming with gtkmm for six monts now. Until now I made only
simple things. But when I tried to do my first nice trick I discovered
it was not so easy as I thought :(

	I'm trying to make a function that gets a Box object and aplyes some
changes to all Entry the objects packed into it. Of course it will be
recursive by calling to itself when finds a Box.

	Following you can find an skeleton code I have writen to test to do
that, the code is a little bir dirty because I tried to change a lot of
things on it in order to fix the problem. When I run it I get a core
dump, also attached you can see the backtrace from gdb.

	I don't want to critisize the people who gives us their work in form of
gtkmm, but in the documentation nor in the header files I can't find any
clue about what I'm doing bad.

Please, can you help me?

Thanks in advance.

-------- Function code ---------
void activaEntryFlags(Gtk::Box& base,gint flag, bool activa)
{
        DUMP("activaEntryFlags");

        // Toma el principio de la lista de ojetos
        Gtk::Box_Helpers::BoxList::iterator listaClaves =
base.children().begin();
        Gtk::Box_Helpers::BoxList::iterator finClaves =
base.children().end();

        // Busca todos los Entry
        do
        {
DUMP("A1");
                Gtk::Object* objetoActual = dynamic_cast<Gtk::Object
*>((*listaClaves)->get_widget());
DUMP("A2");
                // Comprueba si es una Box, si lo es, la aplica tambien
                if(Gtk::Box::isA(objetoActual))
                {
                        DUMP("Es una Box!!");
                }
        } while ((listaClaves++) != finClaves);
}

-------------
DUMP is a simple macro that dumps his argument to cout with the source
file name and the line number, only to debug.

------------- This is the backtrace got form gdb --------------
Program received signal SIGSEGV, Segmentation fault.
0x400b3b51 in Gtk::Box_Helpers::Child::get_widget ()
   from /usr/lib/libgtkmm-1.2.so.0
(gdb) bt
#0  0x400b3b51 in Gtk::Box_Helpers::Child::get_widget ()
   from /usr/lib/libgtkmm-1.2.so.0
#1  0x0804e7e6 in activaEntryFlags (base= 0xbffff174, flag=2048,
activa=true)
    at jvclib.cc:18
#2  0x0804e415 in Form::set_status (this=0xbffff0e8,
nuevo_estado=REPOSO)
    at jvcform.cc:59
#3  0x0804c678 in F_Delegado::F_Delegado (this=0xbffff0e8, __in_chrg=1)
    at F_Delegado.cc:80
#4  0x0804b86c in main (argc=1, argv=0xbffff994) at Sencora.cc:23
#5  0x4044817d in __libc_start_main () from /lib/libc.so.6

-----------------




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