Placing line numbers in an nstextview
Placing line numbers in an nstextview
- Subject: Placing line numbers in an nstextview
- From: johness does <email@hidden>
- Date: Thu, 10 Jul 2003 13:00:06 -0700 (PDT)
Ok, so I'm trying to make a gutter for my textview
(you know, like the one in project builder, that has
the line numbers). I considered two options on how to
do this, one: encapsulating the nsscrollview that
holds the nstextview in question withing a seperate
view. This view would then show the number to the
side. My second option, and the one I chose becuase I
feel it is best, both in implementation and design, is
to subclass nstextview.
What I have done so far is to, in the initWithFrame:
(I create all my text view programmatically so it is
fine to put code here), simply move the origin of the
textContainer to the right a few pixels.
This has the desired affect of making the text appear
more to the right. The problem is, I am not sure
where to go fom here. I know I need to make a custom
drawRect: but I am a little stumped. It would appear
that since the text is being drawn more to the right,
the view is being clipped and thus not allowing me to
draw anything to the left. Also, white is still drawn
in the little left margin. What is the best/most
efficient way to continue?
P.S. I made some other changes to the NSTextView
subclass that warranted a subclass so keeping the code
in the subclass would be better (as opposed to the
ecnapsulating view idea).
Any help is greatly appreciated.
Francisco Tolmasky
http://users.adelphia.net/~ftolmasky
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.