Re: Cell size



Not exactly what I need... (but thanks...)

Imagine a string _s of size 150, but a cell size 70... what happens ??

If horitzontal scroll bar is set by policy, here appears... if not,
the text also *continues* back, "behind" the scrolled window. I don't
want neither this horitzontal bar nor text hide back. I search a
solution for cut lines and force, at a same cell, a multi-line view.
In my example, _s should appear in along 3 lines (sized 70, 70 and
10...)

Mr Cumming pointed me the "Gtk::CellRenderer::property_wrap_method()"
for breaking/wrapping lines but seems working only if a
"Gtk::CellRenderer::property_width()" is properly set...

In this case, it's difficult for me, to set the value of this
"Gtk::CellRenderer::property_width()" because it depends of the window
size, and I cannot guess it before. Moreover, it seems that the cells
column size changes according the text size, in order to fit all text
in one line.

Maybe, the method given by Mr Yann could help me to find the desired
size of the column each time that either the main window or the
scrolled window resizes...

What I need is like a VerticalScrolledWindow object...

Glus



2011/3/23 Yann Leydier <yann leydier info>:
> Here is what I use to force a scrolled window to fit its content's width :
>
> myclass::myclass
> {
>        …
>        sw.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_ALWAYS);
>        sw.add(widget);
>        widget.signal_size_request().connect(sigc::mem_fun(this,
> &myclass::adjust_width));
>        …
> }
>
> void myclass::adjust_width(Gtk::Requisition *req)
> {
>        sw.set_size_request(req->width + 20, -1); // TODO look for something
> more elegant than a plain "20" to take into account the vertical scroll bar
> }
>
> Depending on the widget inside your scrolled windows, you may need to
> deactivate and reactivate the signal at some point to avoid an unwanted
> recursion.
>
> I hope this will help…
> yann
>
> On 23/03/2011 08:36, Glus Xof wrote:
>>
>> 2011/3/22 Glus Xof<gtglus gmail com>:
>>>
>>> In my app, a Gtk::TreeView is included in a Gtk::ScrolledWindow...
>>>
>>> In a precedent message, I asked for the cell wrapping method... but
>>> right now, I cannot see the method to set the "property_wrap_width()"
>>> according the Gtk::ScrolledWindow width.
>>>
>>> (The concerned cells are the last column ones... so, resize when the
>>> app main window resize too).
>>
>> I know that it's not always easy to explain the things...
>>
>> In my app, I have a
>>
>>        Gtk::TreeView m_treeview
>>
>> with these columns,
>>
>>        m_treeview.append_column (" Id. ", m_columns.v_tid);
>>        m_treeview.append_column_editable ("Sel.", m_columns.v_sel);
>>        m_treeview.append_column ("First", m_columns.v_fst);
>>        m_treeview.append_column ("Second", m_columns.v_sed);
>>        m_treeview.append_column ("Third", m_columns.v_thb);
>>        m_treeview.append_column ("Value", m_columns.v_val);
>>
>> The idea, like it's yet doing, is to limit the width of the first
>> columns, but the last one should take all the space available. That
>> I'm trying here, with these column cells, is to adjust the text along
>> of the *visible* free space... and cut lines when longer.
>>
>> Maybe, because this TreeView is inserted in a Gtk::ScrolledWindow, to
>> set this width becomes more difficult... and here a scroll bar
>> appears, just that I'm trying to avoid. I'd like to see only the
>> vertical one.
>>
>> Moreover, when the Main Window resize, the ScrolledWindow resize too,
>> and the text should refit.
>>
>> Is there a way to manage it ?
>>
>> Glus
>> _______________________________________________
>> gtkmm-list mailing list
>> gtkmm-list gnome org
>> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>


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