[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Jonathan Roewen <jonathan.roewen@g...> |
| Subject: | [Caml-list] Creating recursive values |
Hi, The title might not be quite correct, but I don't really know how to describe it. Anyways, I'm trying to create a value which references another value that has to reference the original value. let make_window origin bounds title = let (x,y) = origin and (w,h) = bounds in let window = GroupedGraphic ( x, y, [ InteractiveGraphic ( [(Up,Graphic (Rectangle (0,0,w+8,h+8), control_brush, control_pen))], [(MouseDrag, on_drag)] (* Where trouble begins =( *) ); Graphic (Rectangle (4,4,w,h), white_brush, control_pen); ] ) and on_drag () = match window with | GroupedGraphic (x,y,lst) -> GroupedGraphic (x+mouse.x,y+mouse.y,lst); redraw_gui () in window I don't really want to have to deconstruct the window, and reconstruct it again. I tried to make a start on that, and it was very messy. There _has_ to be a better way to solve this recursive problem. Regards, Jonathan Roewen