Discussion:
How to insert CFString into LPopUpButton
(too old to reply)
Neel
2006-05-09 09:54:08 UTC
Permalink
Hi there,

I am localizing my application, and searching how to put/insert
CFString in PopUpButton.
Here is the snippet of the code.

else if ( (l_popUpList = dynamic_cast<LPopupButton *>(pane) ) != NULL)
{
Str255 l_pData;
l_popUpList->GetMenuItemText(l_popUpList->GetValue(), l_pData);
MapIDToUnicode(&l_pData, &dst);
if( NULL != (cfS =
CFStringCreateWithPascalString(kCFAllocatorDefault, dst,
kCFStringEncodingUTF8)))
{
// This method does change but not each and every items inside the
popup
l_popUpList->SetCFDescriptor( cfS );
// ?????? Here want to use something like
InsertMenuItem(...)
CFRelease(cfS);
l_popUpList->Refresh();
}
}

Appreciate with your advice!

Thanks!
Neel
Neel
2006-05-09 10:43:06 UTC
Permalink
This statement set the title for LPopUpButton,

l_popUpList->SetCFDescriptor( cfS );

but i want to set each items inside the popup button ...

Please suggest.
David Phillip Oster
2006-05-09 13:49:55 UTC
Permalink
Post by Neel
This statement set the title for LPopUpButton,
l_popUpList->SetCFDescriptor( cfS );
but i want to set each items inside the popup button ...
Please suggest.
LPopUpButton inherits from LMenuController, so you can say:

MenuRef mr = l_popUpList->GetMacMenuH();

Once you've got that, you can use:
SetMenuItemTextWithCFString(mr, i, cf), defined in Menus.h
Neel
2006-05-10 07:58:25 UTC
Permalink
Thanks a lot for your reply.

Loading...