caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Ewen Maclean" <E.Maclean@ed.ac.uk>
To: caml-list@inria.fr
Subject: lablgtk GTree problem
Date: Tue, 6 Mar 2007 00:22:28 +0000	[thread overview]
Message-ID: <d0fbb16b0703051622w13f2885eh5e4a9b277b8468fa@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1305 bytes --]

Hello,

I have tried looking for this information on the web but unfortunately have
not been successful and any help would be greatly appreciated. I'm using a
GTree.list_store as a model for a GTree.view. Everything is working fine and
the documentation has really helped. The problem I have is that I am
attributing a double-click event to each item in the GTree.list_store:

gtreeview#connect#row_activated ~callback:(fun m n -> on_row_activated
greetreeview nps m n)

which calls the function on_row_activated:

let on_row_activated (view:GTree.view) nps path column =
  let model = view#model in
  let row = model#get_iter path in
  let name = model#get ~row ~column:str_col in
  uprint ("Double-clicked row contains name " ^ name) ()

what I want is to work out is the integer index of row in the path. I read
somewhere that I could use path#get_indices to return an array of integers
which would tell me, but it tells me that path has no method get_indices.
The point is that the row of the double clicked object is the index of the
element I want from the list nps. I know that I can return a row_reference,
but it would be really useful to get the index as an integer from the path.

Any help would be much appreciated.

Many thanks in advance and apologies if this is a very simple problem

Ewen

[-- Attachment #2: Type: text/html, Size: 1414 bytes --]

             reply	other threads:[~2007-03-06  0:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-06  0:22 Ewen Maclean [this message]
2007-03-06  0:31 ` [Caml-list] " Jacques Garrigue

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d0fbb16b0703051622w13f2885eh5e4a9b277b8468fa@mail.gmail.com \
    --to=e.maclean@ed.ac.uk \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).