Re: Cannot get hidden NSTextView to show (SOLVED)
Re: Cannot get hidden NSTextView to show (SOLVED)
- Subject: Re: Cannot get hidden NSTextView to show (SOLVED)
- From: Sam Stigler <email@hidden>
- Date: Sun, 20 May 2007 03:58:59 +1000
Just answered my own question right after I posted this; it turns out
I also have to hide and show the text view's scroll view as well.
Sam
On May 20, 2007, at 3:50 AM, Sam Stigler wrote:
Hi,
I'm trying to implement an expanding window for the first time,
and I've finally been able to get most of the elements working
(save for the flipped coordinates, but I'm willing to forget about
those for now.) The one thing that's really bothering me is one
NSTextView: I have it hidden (using setHidden:YES) while the
window is in its normal state, and and I want-- I need-- it to be
visible when the window is expanded. However, when I call -
setHidden on it nothing happens. It's working for all of the
NSTextFields and NSButtons in the window, does anyone know why it
might not be working for the NSTextView? I'm fairly certain this
isn't an autoresizing problem, because the text view's positioning
is fine when I uncheck the "hidden" box in IB. Bug?
Here is the code I'm using for my toggle method: (prePrintView is
the NSTextView.)
- (IBAction)toggleTextPreviewView:(id)sender
{
oldFrame = [mainWindow frame];
int heightDifference = 513-99;
if ([sender state] == NSOnState) // expand the window
{
//Since window will be getting taller, and the origin is at the
lower-left corner, will need to add 1 to the origin y for every 1
added to the height.
[fontButton setHidden:NO];
[mainWindow setFrame:NSMakeRect(oldFrame.origin.x,
(oldFrame.origin.y+heightDifference),oldFrame.size.width,513)
display:YES animate:YES];
[prePrintView setHidden:NO];
oldFrame = [mainWindow frame];
}
else // bring the window back to its original size.
{
[fontButton setHidden:YES];
[prePrintView setHidden:YES];
[mainWindow setFrame:NSMakeRect
(oldFrame.origin.x,oldFrame.origin.y,oldFrame.size.width,118)
display:YES animate:YES];
}
}
Thanks,
Sam
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
40mac.com
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden