one model, two viewer



Hi, everyone!


I'm making an Gtk application, which has a table (GtkTreeView), and a customized canvas widget providing 
graphical view, both corresponding to same data (GtkTreeModel).


I want to synchronize the selection state between the table and the canvas. When people change the selection 
in table, or click on an item in canvas, both of them should change their selection: select to corresponding 
row, and highlight on corresponding item.


Now the problem comes: GtkTreeSelection emits the 'changed' signal, no matter it is caused by mouse click or 
by program. If I organize callbacks in the way below, the callback will fall into a cycle.


on_table_change {
    change_model
}
on_canvas_item_change {
    change_model
}
on_model_change {
    change_table_selection
    change_item_rendering
}


So, how should I organize those callbacks? Thanks a lot!!!


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