Hi Bernd,

On Fri, 08 Dec 2006 14:20:15 +0100
Bernd Holzmüller <[EMAIL PROTECTED]> wrote:

> I would like to use the function
> 
> treeCtrlHitTest :: TreeCtrl a -> Point -> Ptr CInt -> IO TreeItem
> 
> but I cannot find out from the wxHaskell documentation how to create / 
> 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 = alloca $ \ptr -> do
  r <- treeCtrlHitTest w point ptr
  flags <- peek ptr
  return (r, flags)

Regards,
Takano Akio

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
wxhaskell-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wxhaskell-users

Reply via email to