PDA

View Full Version : doubt on NSComboBox ?




rethish
Dec 9, 2008, 07:12 AM
Hai all,

In my application I need to perform different task , when each item in the combo box is clicked.

I tried ,but it didn't worked.

the code :

-(IBAction)comboselect:(id)sender
{


if([[combo1 itemObjectValueAtIndex:1] isEqualToString:@"A"] )
{

[txt uppercaseWord:sender];


}

else if([[combo1 itemObjectValueAtIndex:1] isEqualToString:@"a"])
{

[txt lowercaseWord:sender];

}


}


here txt is an instance of NSTextView .


the problem is that ,when i click each item of the combobox , only one task is repeated (in this case: uppercase ).

I think, its bcoz of the wrong syntax for selecting the item from the combobox.

please help to solve the problem

thankyou.



Sayer
Dec 9, 2008, 02:41 PM
Try compare: instead of isEqualToString:

rethish
Dec 10, 2008, 06:10 AM
thank you for the response.

I tried it , but i couldn't get it.


when I tried [[combo1 objectValueOfSelectedItem] isEqualToString:@"a"] instead of

[[combo1 itemObjectValueAtIndex:1] isEqualToString:@"a"] it worked.

thankyou.