caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Olivier Andrieu" <oandrieu@nerim.net>
To: gmalecha@rice.edu
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] LablGTK Reading Properties
Date: Wed, 6 Feb 2008 09:57:28 +0100	[thread overview]
Message-ID: <95513600802060057g1d866af1of277c8f086f6483b@mail.gmail.com> (raw)
In-Reply-To: <47A89124.1040304@rice.edu>

Hi,

On Feb 5, 2008 5:39 PM, Gregory Malecha <gmalecha@rice.edu> wrote:
> Hi,
>
> I've been working on some code with GnomeCanvas and I'm having
> difficulty reading properties off of objects. For example, I've created
> a polygon and I want to read the points from it, but I always get back
> None. Here's my current code:
>
> let points item =
>   let prop = {Gobject.name = "points";
>           Gobject.conv = GnomeCanvas.Conv.path_def} in
>   let x = Gobject.get prop item in
>   match x with
>     None -> print_string "NONE!\n"; [] (* I always end up in this case *)
>   | Some ary ->
>       print_string "SOME!\n";
>       let ary = GnomeCanvas.Conv.get_points ary in
>       Array.to_list ary

you're getting None because you're using the wrong conversion
function: this "points" property is basically a float array and here
you're using the path_def conversion which is for bpath (bezier path).

Your code should work with:
    let prop = {Gobject.name = "points"; conv = GnomeCanvas.Conv.points} in ...

-- 
  Olivier


  reply	other threads:[~2008-02-06  8:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-05 16:39 Gregory Malecha
2008-02-06  8:57 ` Olivier Andrieu [this message]
2008-02-06 17:06   ` [Caml-list] " Gregory Malecha
2008-02-06 19:07     ` Gregory Malecha
2008-02-06 22:12       ` Olivier Andrieu

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=95513600802060057g1d866af1of277c8f086f6483b@mail.gmail.com \
    --to=oandrieu@nerim.net \
    --cc=caml-list@yquem.inria.fr \
    --cc=gmalecha@rice.edu \
    /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).