Re: NSView setVisible: method -- NOT
Re: NSView setVisible: method -- NOT
- Subject: Re: NSView setVisible: method -- NOT
- From: Henry McGilton <email@hidden>
- Date: Sun, 30 Mar 2003 23:01:23 -0800
On Sunday, March 30, 2003, at 09:32 PM, Daryn wrote:
Visibility in Cocoa can effectively be controlled via [view
removeFromSuperview] and [superview addSubview:view].
On Sunday, March 30, 2003, at 08:50 PM, Jeffrey Mattox wrote:
How come AppleScript has a "visible" property for a view that can be
set true/false, but there are no setVisible:(BOOL)flag or isVisible
methods in Cocoa for NSView?
If I do this in AS:
set visible of text field "test" to false
(which set's the NSTextFiled's view to invisible), how do I set it
true in Cocoa?
Jeff
_______________________________________________
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.
Daryn
The original poster's question is ambiguous. He asks how to make
a view invisible, and states that there are no methods on NSView
to do this. That statement is correct.
He then goes on to use a specific example of sending
a set visible false message to an NSTextField. You could likely
make an NSTextField invisible by setDrawsBackground: NO, setting
its text to an empty string, and turning off its border. You
do not need a specific setVisible: method in NSTextField to
render it invisible.
Next, removeFromSuperview and addSubview are sledgehammer
approaches to the problem. First of all, when you removeFromSuperview,
the removed view also gets released, so now you end up in a memory
management issue. Maybe AppleScript actually does this, and
maybe not.
Given you need to subclass NSView to do any useful drawing, I
would just add a setVisible: method to my subclass, and then
my drawRect method would add the simple test:
if (!visible) {
return;
}
Best Wishes,
........ Henry
===============================+============================
Henry McGilton | Trilithon Software
Boulevardier, Java Composer | Seroia Research
-------------------------------+----------------------------
mailto:email@hidden |
http://www.trilithon.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.