Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Soulstorm

macrumors 68000
Original poster
Feb 1, 2005
1,887
1
I am building a program, and I want to do the following:

When a user presses a specific button, I want to display some names in a window containing a table view. The user must select one of these names, and he/she must press ok. Then the value selected will be returned, and I must do something with it (which is irrelevant).

What I don't know is how can I lock the rest of the user interface when displaying this panel. By the time the panel is displayed, I want force the user to make a choice! I don't want the user to be able to tackle with the rest of the user interface until he makes a choice.

How do I do that? Is there any way that can be done using something else (sheets?)?
 
Take a piece of paper and draw out the UI you want. Make different versions of it to flesh out the ideas first.

For example have one larger window with the name-selection at the top and the rest of the UI "hidden" by shrinking the height of the window. When a selection is made expand the window to show the rest of the UI (Like System Preferences).

Or make one with a sheet blocking the UI.

Or make something else.

Make a flow diagram showing the basic steps and see if it makes sense. Then build up a UI and try it out in IB.

You'd be surprised how many "professionals" draw things out on paper first and make many different test versions of a UI before getting it just right.
 
You can run any NSWindow as modal via this NSApplication method. Once it's modal you need to have some method that will be called via a UI action that will stop the modal session. Once this is done it's up to you how you get the value back. You could set a variable in the NSWindowController sublcass that owns the modal window as an example.
 
Once it's modal you need to have some method that will be called via a UI action that will stop the modal session. Once this is done it's up to you how you get the value back. You could set a variable in the NSWindowController sublcass that owns the modal window as an example.

Hm... That was the answer I was looking for.... Maybe! I will try that and I will post back with the results. Thank you both for your answers.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.