selector comparision

Daniel Luis dos Santos <[email protected]>
Newsgroups gmane.comp.python.pyobjc.devel
Message-ID <[email protected]>
Hello, 

I am following the apple docs on how to enable menu items according to state in my application :
The doc is at : http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/MenuList/Articles/EnablingMenuItems.html%23//apple_ref/doc/uid/20000261-BAJBFGED

I am trying to do something similar to the example code of the method 

	- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)anItem

but in python. The class that holds the actions to the menu items has that method implemented as the docs indicate.
To avoid hardcoding the methodNames in the code I want to compare the result of the action() method to the selector of each method. My code is :

	def validateUserInterfaceItem_(self, anItem):
		
		theAction = anItem.action()
		if (theAction == self.saveAction_):
			return NO
		return YES

Somewhere in the same class I have the method :

	@IBAction
	def saveAction_(self, sender):
		... rest of method definition

To have the selector defined for the above method I also put immediately after the method declaration :

	saveAction_ = objc.selector(saveAction_, signature="v@:@")

The problem is that the comparison of the result of anItem.action() does not equals the selector for the method.
If I print both to the terminal using :

		print theAction
		print self.saveAction_

I get  :

		saveAction:
		<selector saveAction: of <menubaractions: 0x1010ee000>>

The output does not match. It seems like the representation is different. How do I compare both these values successfully ?


Many thanks
Regards

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd

_______________________________________________
Pyobjc-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyobjc-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.