RE: NSTextView setRulerVisible: weirdness
RE: NSTextView setRulerVisible: weirdness
- Subject: RE: NSTextView setRulerVisible: weirdness
- From: Keith Blount <email@hidden>
- Date: Sun, 12 Jun 2005 10:05:18 -0700 (PDT)
Hello,
I seem to have fixed this problem, though I'm not
quite sure why. If I call [[textView window]
makeFirstResponder:textView] before calling
-setRulerVisible:, everything works fine, whether I
call -setRulerVisible before or after loading the text
and notes, and there is no delay in showing the ruler.
I'm not quite sure why I have to do this to prevent
such odd behaviour - especially seeing as my custom
view is set to initialFirstResponder in IB, and my
custom view just passes on first responder status to
the text view in -becomeFirstResponder - but at least
things seem to be working without a problem now.
Thanks anyway,
Keith
--- ORIGINAL MESSAGE ---
FROM : Keith Blount
DATE : Sun Jun 12 11:10:19 2005
Hello,
I am seeing some strange effects when calling
setRulerVisible:YES on an NSTextView. My text view is
contained inside a container view that places a margin
view (NSView subclass) on the left of the text view.
The container view works out all resizing so that it
is big enough to contain both the margin and the text
view, and it is the container view that is set as the
document view of the text view.
The margin view just displays notes that are
associated with the text. The notes are stored as a
custom attribute in the text storage
(KBNoteAttributeName associated with a string).
In my document, in windowControllerDidLoadNib:, I
first load the text using readRTFDFromFile: and then I
set up the notes from an array, cycling through the
array and applying note attributes to the text.
If I call setRulerVisible:YES on the text view before
I load the text and apply the notes, everything works
fine, except that the ruler doesn't show any tabs or
the alignment buttons until all the notes have been
applied, so there's a two second pause.
However, if I call setRulerVisible:YES on the text
view *after* loading the text and applying the notes,
my view loads with the ruler visible, but it is not
sized or drawn properly. The text and margin view are
visible, but their container view hasn't done any
resizing or drawing, as though its subviews have
loaded but it hasn't done anything else...
A workaround that works is this:
[textView setRulerVisible:YES];
[textView setRulerVisible:NO];
[self loadTextAndNotes];
[textView setRulerVisible:YES];
By quickly setting the ruler visible and hiding at
again before loading text and notes, then doing the
loading, then setting the ruler visible again,
everything seems to load fine - the ruler is visible
with no pause at the same time as the text and notes.
This seems a very strange thing to have to do, though.
Does anybody have any idea what is going on here?
Many thanks for any help in advance,
Keith
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden