• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Hiding an NSTextField
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Hiding an NSTextField


  • Subject: Re: Hiding an NSTextField
  • From: Olaf van Oudenallen <email@hidden>
  • Date: Mon, 28 Apr 2003 10:21:25 +0200

What I did:
- retain the NSTextField
- remind its position
- remove it from its View
and later
- add the NSTextField to the View
- release the NSTextField

If you want I can lookup the code

Olaf

It really depends on the interface. I accomplished
something similar by creating a NSTabView with no tabs
so I could programatically go from one tab to the
other. Then I put the controls on the tabs so I could
'hide and show' them.

Maybe not the most elegant method, but it works.

Just adding my 2 cents,

Ted


--- Oleg Svirgstin <email@hidden> wrote:
Hi all,

I would do it like this:

1) subclass NSTextField
2) add to it a BOOL variable "hide" (set it to "NO"
in "initWithFrame",
though it seems that a BOOL instance variable is set
to NO == 0 by default)
3) override its drawRect to something like

-(void)drawRect:(NSRect)bounds
{
if(hideMe)
{
//if textured window, fill the frame with
some degree of gray (???)
//else fill the frame with window background
color

//NSWindow has some flags for this that I
don't remember from the
top of my head

}
else
{
[super drawRect:bounds];
}
}

4) add to it a setHide:(BOOL)flag and -(BOOL)hide
methods
5) import it in the nibs that will make use of such
deviated controls and
then use Custom Class tab to make a control to
follow this behavior.

By the way, does anybody know a better way to
imitate filling a shape with
the textured window background?

I don't think constraining us from doing "stupid
things" with the interface
is a good idea.


Regards
Oleg


> From: publiclook <email@hidden>
> Date: Sun, 27 Apr 2003 12:00:04 -0400
> To: Eric Czarny <email@hidden>
> Cc: email@hidden
> Subject: OT: Re: Hiding an NSTextField
>
> Why do so many people in this forum want to hide
controls ?
>
> To answer the question, there are no single method
solutions for hiding
> controls, and if you ask me that is a good thing.
>
> On Sunday, April 27, 2003, at 02:20 AM, Eric
Czarny wrote:
>
>> I am trying to cause an existing text field to
hide in a certain event
>> and display the contents behind it, which method
should I invoke to go
>> about hiding the text field?
>>
>> Best Regards,
>> Eric Czarny
>>
>> http://www.laterus.net
> >> _______________________________________________

--
O. van Oudenallen, mailto: email@hidden
Administratiekantoor Tersteeg Van Oudenallen
Grift 11 - 1423 DH Uithoorn - The Netherlands
Phone: +31(297)531929 Fax: +31(297)523826
_______________________________________________
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.

References: 
 >Re: Hiding an NSTextField (From: Theodore Petrosky <email@hidden>)

  • Prev by Date: Converting NSPasteboard to NSData
  • Next by Date: Re: File Detection
  • Previous by thread: Re: Big grinding memory leak?
  • Next by thread: Re: OT: Re: Hiding an NSTextField
  • Index(es):
    • Date
    • Thread