[gtkmm] custom cellrenderer - dynamically sizing TreeViewColumn



I wrote a custom cell renderer. It works but the problem is that the
widget used in edit mode was significantly wider than the normal(not
being edited) cell display width. Not only that but there are several of
these in the same treeview, so if each column was wide enough to display
the whole edit widget there wouldn't be enough room. 

I thought of two solutions. One, somehow have the edit widget shown over
the neighboring cells (no idea how to do this). Or two, when a cell is
being edited, resize the width of the column to accommodate the whole
edit widget. This I did, and it was pretty straightforward. 

But there is one bug. The column is resized alright. But the edit widget
doesn't expand to take up the entire space, rather, it just fills the
original column width. However if you click in the empty space to the
right of the edit widget in the now larger column the program restarts
the edit process and the edit widget completely fills the column.
Likewise if you don't reset the column to a smaller size after the first
edit the edit widget is correctly displayed (taking up the entire
column) the second time the column is edited.


Attached is an example I derived from the attachment at the following
address:

http://mail.gnome.org/archives/gtkmm-list/2003-January/msg00107.html

The code to accomplish the resizing is in Comb_CellRenderer::on_edited() 
and Comb_CellRenderer::start_editing_vfunc() in renderer.cc.


My only possible solution so far is to try and catch a signal or function call
which happens when someone starts editing a cell (via enter or clicking) and then
resize the column there so that it is resized after someone initiates a cell edit
but before the cell renderer is notified of this. But I haven't
found one that works yet.




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