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




Steve Ramsay <ramsay@universal.ca> writes:

> Anders Melchiorsen wrote:
> > 
> > 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);
> 
> Thanks for the suggestion.  I've taken a look at the CList, and it looks
> like it almost does what I need.  I have a feeling it can do what I
> need, but can't seem to get it working.  The items I want to put in the
> list are what are no longer working.  I want to be able to put into each
> row a GtkHBox, with the contents of the box being two toggle buttons and
> a label.  The CList docs seem to imply that a cell can contain a widget,
> but all I have been able to find is the gtk_clist_set_column_widget
> funtion, which doens't let me set different widget per row.

You can't currently put widgets inside CList, despite what might
be implied by the docs. 

One approach to your problem is to implement your toggle buttons
yourself. (I don't think the standard toggle buttons look very
good in a list anyways). You can do this by catching button presses
on the CList and using them to toggle a pixmap.

For examples of this, see gnorpm, or, 

 eider/eider/modules/CheckList.py

in GNOME CVS. 

(http://cvs.gnome.org/lxr/source/eider/eider/modules/CheckList.py)

The latter is in python, but it should be pretty straightforward to
translate into C and does it very thoroughly, including responding to
theme changes properly, etc.

Regards,
                                        Owen




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