Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Apr 28, 2011, 02:42 AM   #1
sivaprakash
macrumors member
 
Join Date: Mar 2011
Location: Chennai, India
NSPanel

Hi

I am using NSPanel in my application to build Modal Dialogue, but I am wondering whenever I want to handle some events it always goes to parent class but not Panel's class. I have created a Class and refereed from .NIB Object Interface.

Can you please tell how can handle Panel's control's events in Panel class itself.

Thanks
Siva
sivaprakash is offline   0 Reply With Quote
Old Apr 28, 2011, 03:20 AM   #2
jiminaus
macrumors 65816
 
Join Date: Dec 2010
Location: Sydney
Normally Cocoa is not programmed directly in terms of events, but instead in terms of actions sent to targets.

For example, instead of trying to code for the mouse down event on a button, you'd normally set the button's action and target so the button sends a particular action message to a particular target object when it's clicked.

Or maybe I'm being too literal with the terminology you're using in your question.

Can you tell us more about what your trying to do?
jiminaus is offline   0 Reply With Quote
Old Apr 29, 2011, 12:47 AM   #3
sivaprakash
Thread Starter
macrumors member
 
Join Date: Mar 2011
Location: Chennai, India
Hi

What I am trying to do is, When user clicks Login button there should be a window (Panel) comes out till the user respond to that Panel he/she should not be allowed to access other part of application.

But when ever I add panel to NIB the action target always goes to parent window's ".m" file not Panel's class. Can you please explain me how to direct the control to Panel's class rather parent's.

Thanks
Siva
sivaprakash is offline   0 Reply With Quote
Old Apr 29, 2011, 03:52 AM   #4
jiminaus
macrumors 65816
 
Join Date: Dec 2010
Location: Sydney
Have a look at the attached project. It shows 2 windows, a PanelTest window and an "Other Window" window. You might need to Cmd+` to see both windows after running in XCode.

You'll notice that you can click the Click Me button in the other window. When you do you'll see a message in the debugger console.

If you click the Login button in the PanelTest window, a login sheet will show. While the login sheet is showing, you can't click the Click Me button in the other window.

If you untick the Sheet checkbox, the login button will show a separate modal window, as opposed to a sheet.

The guts of all this is in LoginPanelController.

Note: This is an abuse of the term Panel. The login window is not an NSPanel. It's an NSWindow. Panels are used to implement secondary windows, like the Library window in Interface Builder in XCode 3 (not like the one in XCode 4).
Attached Files
File Type: zip PanelTest.zip (34.1 KB, 26 views)
jiminaus is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Forum Jump

All times are GMT -5. The time now is 08:23 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC