Re: Re: Re: scroll a tree view to sepcific row



On 16 August 2017 at 08:43, Klaus Rudolph <lts-rudolph gmx de> wrote:
    Gtk::TreePath p1("8:");
    m_TreeView.scroll_to_row( p1, 0);

compiles but did nothing. Is my syntax for the string invalid or must it be converted before?

The syntax is invalid, AFAICT. The same page explains:

" Now 'Songs' is the first child (from the root) and thus its tree path is just "0". 'Videos' is the second child from the root, and its tree path is "1" "

 
And as shown in my now fixed first example code snippet, ist it possible to get the iterator direct from the model without manually coding the iterating loop over all the children?

I guess you missed my other reply:

"Besides, although you could add the missing increment, there's no need; if you know you have enough rows, you can just index into children using operator[]."

.children() returns a vector. A vector has operator[] (or even .at() if you want to enforce bounds-checking, e.g. if the index comes from uncontrollable user input)




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