Re: [gtk-list] GtkList, dragging a row to a new position.



Steve Ramsay <ramsay@universal.ca> wrote:

> Is it possable to select a row in a GtkList and drag it to a new
> position within the list?  And if so does anyone have a sample or
> some pointers on how to go about doing this?


GTK+ can handle that all by itself, if you activate it:

		gtk_clist_set_reorderable(clist, true);


However, if you want to do something when the rows are moved around
(like updating data structures depending on the order of the GTK+
list), you need to connect to the row_move signal:

	gtk_signal_connect_after(GTK_OBJECT(clist), "row_move",
				 GTK_SIGNAL_FUNC(RowMove), user_data);

and have a call-back function:

void RowMove(GtkCList* clist, int from, int to)
{
	// The CList had a row moved from line "from" into line "to"


        // ...Do something...
}


Good luck!

-- 
Regards, Anders



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