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

i.yalovecky

macrumors member
Original poster
Feb 24, 2010
67
0
How i can handle "prefernces" mainmenu action? In which controller must handle this event? And who must create preference window? Thanks.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
Any object in the responder chain can handle it. I normally add my app delegate to the responder chain and deal with it there. As to who creates the window: your app somewhere. Where is up to you (I normally create a NSWindowController subclass called PreferencesController)
 

i.yalovecky

macrumors member
Original poster
Feb 24, 2010
67
0
Any object in the responder chain can handle it. I normally add my app delegate to the responder chain and deal with it there. As to who creates the window: your app somewhere. Where is up to you (I normally create a NSWindowController subclass called PreferencesController)

Thanks, i trying to do this^ but then i add ibaction to Applicationcontroller and then right-click on it in IfaceBuilder it doesn`t show this function to me^ also when i drag action line from menu item to this object or to first responder it also show only showWindow action^ but not my showPreferences.
And the same problem with PreferncesController and his xib. I set file owner to PreferencesController and can't get access to my actions and outlets(.

And yet one. This project was started by other man. In mainmenu xib showed many contrlloer every of them highlighted by blue-bounded-rect then i draging on them action line from menu item, but my controller - PreferencesController not. Why?
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
I don't think you understand how the responder chain works: go and read the documentation. You don't need to connect it in IB: it sends a message and as long as an instance in the responder chain can handle that it will (in chain order).
 

i.yalovecky

macrumors member
Original poster
Feb 24, 2010
67
0
And the same problem with PreferncesController and his xib. I set file owner to PreferencesController and can't get access to my actions and outlets(.

And yet one. This project was started by other man. In mainmenu xib showed many contrlloer every of them highlighted by blue-bounded-rect then i draging on them action line from menu item, but my controller - PreferencesController not. Why?

What i do wrong what after xib and controller class creation, name of controller class didn't appeared in dropdown list named class in Object Identity in Interface Builder?
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
What i do wrong what after xib and controller class creation, name of controller class didn't appeared in dropdown list named class in Object Identity in Interface Builder?

I have no idea. You are either not reading what I type or intentionally ignoring it. Either way it's not helping you so stop, read what I've typed and do what I say.

You do not need to connect anything in Interface Builder. The menu item will send message via the responder chain. If the first responder does not handle it then it gets passed to the next responder and so on. So you simply need to ensure that whatever object you want to handle the message is in the responder chain.

As I said I use the object that I set as the application delegate for this.

I suggest you stop writing code/messing around in Interface Builder and read the [http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/EventOverview/EventArchitecture/EventArchitecture.html#//apple_ref/doc/uid/10000060i-CH3-SW2]documentation[/url].
 

i.yalovecky

macrumors member
Original poster
Feb 24, 2010
67
0
I have no idea. You are either not reading what I type or intentionally ignoring it. Either way it's not helping you so stop, read what I've typed and do what I say.

You do not need to connect anything in Interface Builder. The menu item will send message via the responder chain. If the first responder does not handle it then it gets passed to the next responder and so on. So you simply need to ensure that whatever object you want to handle the message is in the responder chain.

As I said I use the object that I set as the application delegate for this.

I suggest you stop writing code/messing around in Interface Builder and read the http://developer.apple.com/mac/libr...re.html#//apple_ref/doc/uid/10000060i-CH3-SW2

Wow, thanks, i read it yesterday)))) I'm already have solved problem with handling menu item, but fir this i in IBuilder add new action for FirstResponder.
But back to xib and controller, do i really need to use responders chain? isn't it not enough just to connect buttons right to controller methods? And even if i will do it somehow with responder chain problem with not appearing class name in Class combobox will care me. I can set there NSViewController and then link _view to my view, but i want to use other member of my controller class.

And great thanks man for your answers. England forever!!!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.