Connecting page switching in Notebook with selection in Ctree.



Hello ! 

I'm new to using Gtk-Perl and I'm in trouble. 

I've tied together a CTree and a notebook: a selection in the 
$ctree sets the appropriate page in the $notebook through the call 

        (+) $notebook->set_page($page_num); 

in the callback function &select_row associated with signal 
'tree_select_row': 

Users can manually switch the page. Reversely, I would 
like to update selection in $ctree according to the newly selected page: 
I've attached a callback function &switch_page to the 'switch_page' 
signal of $notebook. There: 

        (+) I retrieve the number of the new page and the corresponding 
            node in the $ctree; 
        (+) call &select_row after having let the callback blocked itself 
            to avoid infinite loop. 
        (+) Finally, the callback unblocks itself at the end of the 
            routine, when returning from &select_row.

But this hack does not correctly work: first, I obtain the message below 
when switching pages in a notebook: 

        (+) Wed Jul 25 12:38:14 2001 Gtk-WARNING **: invalid cast from (NULL) pointer to `GtkObject' at 
./adf_xwin.pl line 582.

Line 582 is 

        (+) $notebook->set_page($page_num); 

Second, inspection of the arguments of the callback function, &switch_page, 
reveals that, for a given page, the hash reference, corresponding to the 
associated NotebookPage, changes from call to call, taking values in an 
apparently limited set. I don't believe it's normal ...

I thank you in advance for your help.

Best regards, 
Max

-- 
***********************************************
Latevi Max LAWSON DAKU 
Departement de chimie physique
Laboratoire de photophysique et photochimie 
des composes de metaux de transition
Universite de Geneve -- Sciences II
30, quai Ernest-Ansermet  
CH-1211 Geneve 4 
Switzerland 

Tel: (41) 22/702 6548 ++ Fax: (41) 22/702 6103
***********************************************




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