• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: question regarding getting data from NSComoBox
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: question regarding getting data from NSComoBox


  • Subject: Re: question regarding getting data from NSComoBox
  • From: Lon Giese <email@hidden>
  • Date: Wed, 17 May 2006 17:49:19 -0700

Hi, Your example seems pretty simple... have you stepped through it with a debugger.. can you see where he path is not being built right?

The only other BIG suggestion I can make without additional information is to use NSString's " Working with paths" methods... instead of the normal string method. " Working with paths" methods guarantee that no matter what file system is in use it always uses the correct path separators.... I use it all the time it is really nice not to worry about the separators.... Maybe this is the problem....


On May 17, 2006, at 10:25 AM, Alan Smith wrote:

Hi everyone,
I need to get the NSString value from two NSComboBoxes. I've tried
using type-casting but it doesn't wrok.

- (NSString*)fullStoragePath
{
   NSString *importType = [@"/"
stringByAppendingString:(NSString*)[gameMenu
objectValueOfSelectedItem]];
   importType = [importType stringByAppendingString:@" "];
   importType = [importType
stringByAppendingString:(NSString*)[importMenu
objectValueOfSelectedItem]];
   importType = [importType stringByAppendingString:@"s"];
   return [textPaths storageFor:importType];
}

gameMenu and importMenu are the two comboboxes. They each have a
string in them, and in the awakeFromNib I used selectItemAtIndex on
them both.

'[textPaths storageFor:importType]'
TextPaths is a custom class with the method 'storageFor:' It takes
input and appends that on to ~/Application Support/EV Manager/ after
expanding the tilde. Then it returns the new string.

I shall demonstrate:

gameMenu = @"Plugin"
importMenu = @"EV Nova"

importType:
line 1: @"/EV Nova"
line 2: @"/EV Nova "
line 3: @"/EV Nova Plugin"
line 4: @"/EVNova Plugins"
line 5: @"/Users/alan/Library/Application Support/EV Manager/EV Nova Plugins"


Now, I know that folder exists becuase I can see it in the Finder.
Also, something that suggests that it's not the folder or the path, is
that if I hard code the path it works fine, but I don't want to do
that. I test the path with fileExistsAtPath of NSFileManager.

So, my guess is that my type-casting is not working the way I want.
What can I do?

Thanks, Alan Smith
-- // Quotes from yours truly -------------------------
"You don't forget, you just don't remember."
"Maturity resides in the mind."
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden


This email sent to email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >question regarding getting data from NSComoBox (From: "Alan Smith" <email@hidden>)

  • Prev by Date: Re: Protected Audio/Video
  • Next by Date: Re: Making newly inserted row visible in NSTableView
  • Previous by thread: question regarding getting data from NSComoBox
  • Next by thread: Protected Audio/Video
  • Index(es):
    • Date
    • Thread