Re: Clist->set_reorderable

From: Date: Thu, 29 Jan 2004 05:06:07 +0000
Subject: Re: Clist->set_reorderable
References: 1  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-4372@lists.php.net to get a copy of this message
nathan@the-ring.homelinux.net wrote:
Hi, i'm trying to find how to enable reorderable columns in clist, i thought that set_reorderable will do the job, but it still doesn't work under linux or windows. Is someone know a way to do this?
This does it for me. Attach this function to the click_column signal of the clist widget you need to be able to sort. It works ascending and descending
    function column_clicked($clist, $column){
        $current_sort_type = $clist->get_data('sort_type');
        $current_sort_column = $clist->get_data('sort_column');
            if ($current_sort_column == $column){
                if ($current_sort_type==GTK_SORT_ASCENDING){
                $sort_type = GTK_SORT_DESCENDING;
                }
                else {
                $sort_type = GTK_SORT_ASCENDING;
                }
            }
            else {
                $sort_type = GTK_SORT_ASCENDING;
            }
        $clist->set_sort_column($column);
        $clist->set_sort_type($sort_type);
        $clist->sort();
        $clist->set_data('sort_column', $column);
        $clist->set_data('sort_type', $sort_type);
    }
Rgards Mike

« previous php.gtk.general (#4372) next »