ck_
ck_

Reputation: 3829

NSTextField inside NSMenu -- doesn't interact or look as expected

I'm attempting to create a log-in window inside an NSMenu (attached to the an NSStatusItem in the menu bar).

I have blank NSMenuItems in the menu. I then set the views of the menu items to NSTextFields.

It ends up looking like this:

enter image description here

The textfields also interact strangely. Clicking on them only gives them focus (so you can enter text) about 30% of the time.

So, I'm wondering:

-How do do I make these look better? How do I control the padding, etc?

-What's with the clicking behavior I described above? Typing only works 30% of the time.

-Are there any other apps that use such a statusbar item as a field? I'd like to take a look.

Upvotes: 0

Views: 945

Answers (1)

Anne
Anne

Reputation: 27073

To answer your actual question instead of discussing the UI design...

Alternative:
Consider using the MAAttachedWindow project from Matt Gemmel:
Download the use an MAAttachedWindow with an NSStatusItem example.

Link:
http://mattgemmell.com/source/index.html

Quickly created example: Screenshot Login Window

Used controls:
- NSTextField (Focus:None DrawsBackground:No TextColor:White)
- NSButton (Bezel:Recessed)
- NSLabel (TextColor:White)

Upvotes: 2

Related Questions