Re: Re: GtkTreeView get selected row AND column AND start editing ;-)



Stefan Kost wrote:

Juan Pablo wrote:

Hi list!
I have a GtkTreeView and what I want to do is when the user is over an
editable cell, the editing begins automatically without having to press
enter. And the other thing that i want to do is that when the user is
over a cell on a certain column the cursor changes automatically to the
next (he cant edit that cell).

The GtkTreeView is a ticket editor, when the user is on the first
column, the editing should be started automatically so he puts a product
code, then when he press enter, the second column is filled with the
description of the product wich has that code and the third column
should get the focus, where, again without having to press enter, he
inputs the amount and then it jumps to the first column on the next row.

This is why i need to know the row and column, so in the cursor_changed
signal i can decide to emmit start_editing or to pass the focus some
where else.


you can use gtk_tree_view_set_cursor() and gtk_tree_view_get_cursor().
I store the row number in my model for easy reference.

GtkTreePath *path;
GtkTreeViewColumn *column;
glong column_ix,row_ix;

gtk_tree_view_get_cursor(treeview,&path,&column);
if(path && column) {
  GtkTreeIter iter;

  if(gtk_tree_model_get_iter(treestore),&iter,path)) {
    GList *columns=gtk_tree_view_get_columns(treeview);

    column_ix=g_list_index(columns,(gpointer)column)-1;
    g_list_free(columns);
    gtk_tree_model_get(treestore,&iter,TABLE_POS,&row_ix,-1);
  }
}
if(path) gtk_tree_path_free(path);

printf("cursor at col/row = %d,%d\n",column_ix,row_ix);

Thanks you!

Now I know where im standing, but im still cant start the editing
manually, it seems that i got to use the
gtk_cell_editable_start_editing () function (??) but i dont know how to
get a pointer to the cell at those coordinates.

This is what I want to do: if the colum_ix == some_number then start
editing, dont need to press enter.


Thanks you all.

Saludos, Juan Pablo.


If is any other way to do it, please! :D

Thanks all.


Saludos, Juan Pablo.

       



        
        
                
___________________________________________________________ 
1GB gratis, Antivirus y Antispam 
Correo Yahoo!, el mejor correo web del mundo 
http://correo.yahoo.com.ar 




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