English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
lablgtk GTree problem
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-03-06 (00:22)
From: Ewen Maclean <E.Maclean@e...>
Subject: lablgtk GTree problem

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