From: Joe J. <dar...@gm...> - 2006-11-11 07:15:07
|
First, understand that I am a complete newbie to Haskell and HOC so please forgive me if this seems rather basic. I have checked the users archive and was unable to find an answer to this. I am trying to create a custom NSView subclass that, specifically one that overrides drawRect. What I am having a problem with is understanding how to override this function and how to actually get some custom drawing done. Actually, I;m not even sure if my class is being instantiated. I slapped a view into the ExpressionParser window, gave it a custom class with the same name as my class (which would normally be all I would need to do in Cocoa). Here is what I have for my view so far: {-# OPTIONS -fglasgow-exts -fth #-} module EPView where import Cocoa $(declareClass "EPView" "NSView") $(exportClass "EPView" "ev_" [ {- Outlet "expressionEntry" [t| NSTextField () |] , Outlet "evaluation" [t| NSTextField () |] ,-} InstanceMethod 'drawRect ] ) obj #. var = obj # getIVar var ev_drawRect rect self = do putStrLn "Hello World" The putStrLn is there just to get something into that method. I think it is doing something (as I see traces of Hell World in the console log, though not consistent). What I am trying to do is to get something to draw (right now nothing more complex then filling in the rect that is passed in with a blackColor from NSColor. Can anyone provide some pointers (or some code) for this problem? Thanx, joe |