• 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
PROBLEMS POPULATING A POP-UP MENU IN A WINDOW
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PROBLEMS POPULATING A POP-UP MENU IN A WINDOW


  • Subject: PROBLEMS POPULATING A POP-UP MENU IN A WINDOW
  • From: email@hidden
  • Date: Tue, 3 Feb 2004 03:27:03 EST

Here is all of the code in case you wish to test the routine.

Someone game me a line to insert (see code) but it doesn't work, I also need
a way to set the selected item to "ActiveDevice".

In the header file "IBOutlet id populate;" is asigned and corresponds to the
pop-up menu.

_______________________________________________

static char* Copy_CFStringRefToCString(const CFStringRef pCFStringRef)
{
char* results = NULL;

if (NULL != pCFStringRef)
{
CFIndex length = sizeof(UniChar) * CFStringGetLength(pCFStringRef) + 1
;

results = (char*) NewPtrClear(length);
if
(!CFStringGetCString(pCFStringRef,results,length,kCFStringEncodingASCII))
{
if
(!CFStringGetCString(pCFStringRef,results,length,kCFStringEncodingUTF8))
{
DisposePtr(results);
results = NULL;
}
}
}
return results;
}

#define kAppCFStr CFSTR("com.LogiK.XSKeyEMU")
#define kKeyCFStr CFSTR("DeviceList")

- (void) Dump_DeviceList
{
CFArrayRef prefCFArrayRef = CFPreferencesCopyAppValue(kKeyCFStr,
kAppCFStr);
CFIndex countDeviceList,index;

if (NULL == prefCFArrayRef)
return;

countDeviceList = CFArrayGetCount(prefCFArrayRef);

printf("\nThe Device list is:\n");
for (index = 0;index < countDeviceList;index++)
{
CFArrayRef pairCFArrayRef;
CFStringRef myCFString;
char* myStrPtr;

pairCFArrayRef = CFArrayGetValueAtIndex(prefCFArrayRef,index);
if (NULL == pairCFArrayRef) break;

/* 0 is name, 1 is file, 2 is serial */
myCFString = CFArrayGetValueAtIndex(pairCFArrayRef,0);
myStrPtr = Copy_CFStringRefToCString(myCFString);

// Some one gave me this.

[ populate addItemWithTitle:(NSString *)myCFString
atIndex:(int)index];

// unfortunately it doesn't work

printf("\t%ld\t\"%s\"\n",index,myStrPtr);// print list to console
DisposePtr(myStrPtr);

}
CFRelease(prefCFArrayRef);
return;
}

_______________________________________________

As previously stated, this doesn't work and I have been able to locate any
code that does work so does anyone have any working code that does this?

Dale
_______________________________________________
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: PROBLEMS POPULATING A POP-UP MENU IN A WINDOW
      • From: Daniel Todd Currie <email@hidden>
  • Prev by Date: problems populating a pop-up menu on a window
  • Next by Date: Re: Packager
  • Previous by thread: problems populating a pop-up menu on a window
  • Next by thread: Re: PROBLEMS POPULATING A POP-UP MENU IN A WINDOW
  • Index(es):
    • Date
    • Thread