NSTextView Help ?
NSTextView Help ?
- Subject: NSTextView Help ?
- From: Circlaeys Eric <email@hidden>
- Date: Tue, 05 Mar 2002 10:42:19 +0100
Hi all,
I'm looking for help about a simple thing, let me try to explain the idea :
- I have got a TextView in a window all resizable.
- I have to write RTF inside this TextView.
- All works.
- BUT the idea is to resize automatically the window and by default the
TextView to show on the screen all the content of the RTF copied to avoid
the user play with scroll view.
- And this works but absolutely not correctly or not all the time, it
depends but why, how, what, ... I don't know ? Please would you help me ?
- I do a this :
{
...
/* Write the content of my new rtf inside the TextView */
[TextView selectAll:self];
[TextView replaceCharactersInRange:[TextView selectedRange]
withRTFD:RTFContent];
/* Refresh the display */
[TextView display];
/*
** Re-size the window if RTF Content in TextView heighter than the TextView
*/
if (NSHeight([TextView visibleRect]) < NSHeight([TextView frame]))
{
float heightChange = NSHeight([TextView frame]) -
NSHeight([TextView visibleRect]);
NSRect WindowFrame = [Window frame];
[Window setFrame:NSMakeRect(WindowFrame.origin.x,
WindowFrame.origin.y - heightChange,
WindowFrame.size.width,
WindowFrame.size.height + heightChange)
display:YES animate:YES];
}
...
}
And then this work when it wants, it depends, if it seems to have only a few
pixels, or when the police is bigger, ... It does nothing ! I do not
understand at all !
[TextView frame] seems to do not be the right way to have the correct frame
size of all the virtual content file in the scroll-view !
Is someone could help me on it !
Thank you very much.
Eric.
_______________________________________________
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.