Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Forcing an NSComboBox to show its list?

Forcing an NSComboBox to show its list?
Thread Tools
Forum Regular
Join Date: Apr 1999
Location: London, UK
Status: Offline
Reply With Quote
Jun 25, 2004, 09:12 AM
 
Hi,

Does anyone know if it's possible to force an NSComboBox to show its list programmatically, i.e. not waiting for the user to click the arrow button or press the down arrow key? I basically want it to behave like the URL field in web browsers.

I cannot find any method that looks like it will to that. Will I need to use a custom control for this?

Thanks
Amar
     
Mac Enthusiast
Join Date: Nov 2001
Status: Offline
Reply With Quote
Jun 26, 2004, 12:47 AM
 
I've tried to do this before as well. There seems to be no public method. I had a look at the class-dumped AppKit headers and found private methods that could be called but for me that's rather unsatisfactory. Take a look at

http://www.collaboration-world.com/c...viewcvs-markup

which may do what you want.
     
asagoo  (op)
Forum Regular
Join Date: Apr 1999
Location: London, UK
Status: Offline
Reply With Quote
Jun 27, 2004, 11:09 AM
 
Brilliant, thanks! That works rather well.

One thing, though: Is it possible to make the drop-down list follow the window continuously as it's being moved around?
I've tried updating its position from within the windowDidMove method, but that only seems to get called after the mouse rests.

Thanks
Amar
     
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
Jun 27, 2004, 03:42 PM
 
It'd probably be easier and safer to just implement your own drop-down: that's the way our URL-field and form autocomplete works in OmniWeb, and it looks like Safari's work that way as well.

Just create a borderless window with an NSTableView in it, and position/show it when the user starts typing. To make it follow the parent window around, use the new NSWindow parent/child APIs introduced in 10.3.
Rick Roe
icons.cx | weblog
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Jun 27, 2004, 04:01 PM
 
Originally posted by asagoo:
One thing, though: Is it possible to make the drop-down list follow the window continuously as it's being moved around?
I've tried updating its position from within the windowDidMove method, but that only seems to get called after the mouse rests.
-[NSWindow addChildWindow:ordered:]
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 06:37 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2