Hi Bernd,
On Fri, 08 Dec 2006 14:20:15 +0100
Bernd Holzm=FCller <ber...@ic...> wrote:
> I would like to use the function
>=20
> treeCtrlHitTest :: TreeCtrl a -> Point -> Ptr CInt -> IO TreeItem
>=20
> but I cannot find out from the wxHaskell documentation how to create /=20
> use the Ptr argument, which stands for an "out" parameter.
You can create a pointer using functions from Foreign.Marshal.Alloc,
and read/write it using functions from Foreign.Marshal.Storable.
For example, using alloca and peek, you can write a simple wrapper around
treeCtrlHitTest, which returns a pair instead of requiring a Ptr.
myHitTest :: TreeCtrl a -> Point -> IO (TreeItem, CInt)
myHitTest w point =3D alloca $ \ptr -> do
r <- treeCtrlHitTest w point ptr
flags <- peek ptr
return (r, flags)
Regards,
Takano Akio
|