Re: Gtk2::TreeView get_path_at_pos doesn't return array on Windows



Peter Juhasz wrote:
On Thu, Jul 16, 2009 at 11:22 AM, Dave
Howorth<dhoworth mrc-lmb cam ac uk> wrote:
Peter Juhasz wrote:
(I was instructed on Perlmonks to post this problem here.)

And it's best to keep all replies on-list as well :)

Yes, in fact I've found the get_cursor method because I needed it for
a different trick.

Simply put, I want to enable some rudimentary keyboard functionality
in my Gtk2::Ex::Simple::List.
The cells of this list are editable if the user double-clicks on them
but double-clicking on every cell, every time quickly becomes tedious.
So I want to set it up so that pressing Tab will set the focus on the
next cell and also open it for editing.

I can do this by hijacking the key-pressed-event of the list, getting
the coordinates of the current cell, calculating the coordinates of
the next cell, then finally setting the cursor on it with
set_cursor($new_path, $new_column, TRUE).

As a rule of thumb, I've found that it's not necessary to mess around
with co-ordinates. There's always some way to discover the appropriate
widget's identity but the 'fascination' in the game is discovering just
how in each case ;/

There is only one problem with this: I have to press Enter to get the
edited contents of the cell registered. If I just press Tab the cell
forgets what I've just written into it. How could I force the current
cell to update itself before I move the cursor to the next cell?

Running your example program, if I edit the text in a cell then move to
another cell with a cursor arrow, it saves the edit. If I use TAB it
saves the edit but doesn't move the cursor (probably need to set up tab
navigation?). I need to press enter or space to start to edit a cell. In
short, it doesn't behave exactly like yours.

I don't know much about this aspect but I think the behaviour is linked
to your platform and perhaps themes. Others will know more (hence
keeping it on the list). But be careful changing behaviour away from
whatever standard people expect.

I've tried to find answers in the documentation but frankly, I can't
find my way in the POD.

You'll probably find some old mails from me in the archive with a
similar issue :( The Perl POD generally doesn't repeat stuff that's
already in the C docs, to reduce the maintenance tuits needed. So you
definitely need to look at the C docs. I've also found it helpful to
look at the Python docs, since they include a bit more info sometimes
while the binding is similar to Perl. There are also various tutorials
about trees in particular and gtk in general. You should find links in
the archives of this list.

Cheers, Dave



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