Re: A numbered column in a Gtk::TreeStore

On Tue, 2005-03-29 at 11:07 +0900, Vadim Berezniker wrote:
> Bryan Forbes wrote:
> >	I'm working on audio support in Coaster and I have a Gtk::ListView to
> >view a Gtk::TreeStore of tracks for an audio disc the user is creating.
> >I need a column for the track number that automatically updates with the
> >correct track number.
> >
> >  
> >
> See
> In the callback you can call gtk_tree_model_get_path to get the path,
> and then call gtk_tree_path_get_indices on the path to determine the
> index of the row.
> Then you can use that to set the text to be displayed by the column
> renderer.

Another possibility:

- Store the sequence in the model and in your document.
- Keep the treemodel sorted.
- When you move rows up or down, just swap the sequence number instead
of the iters.
- Show the sequence number in the view.

Murray Cumming
murrayc murrayc com

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