Discussion:
NSPrintPagesPerSheet
Denise Eatherly
2005-02-18 02:53:17 UTC
Permalink
Hi,

I'd like to give my users a little help at times by setting up
NSPrintInfo to print 2-up documents or 4-up documents.
NSPrintPagesPerSheet seemed obvious but it has been deprecated. I
don't see a replacement, but I may be just overlooking something - does
anyone know a good alternative?

Thanks,
Denise
Denise Eatherly
2005-02-18 19:24:06 UTC
Permalink
Hi,

I'm trying to replace the submenu of a menu item, but instead, an
additional menu item appears on the menu bar every time the method
below is called. I've studied the docs and the menu madness example,
but I'm clearly missing something important. I may ultimately use the
delegate methods, but I don't see why this isn't working. Any help
would be very much appreciated.


- ( void )refreshMenu;
{
NSMenuItem *listMenu = [ [ NSApp mainMenu ] itemAtIndex:2 ]; //
this item was created in the nib
NSMenu *newMenu = [ [ NSMenu allocWithZone:[ NSMenu menuZone ] ]
initWithTitle:[ listMenu title ] ];
[ [ NSApp mainMenu] setSubmenu:newMenu forItem:listMenu ]; // same
result as setSubmenu
// [ listMenu setSubmenu:newMenu ];
[ newMenu release ];

NSEnumerator *listEnumerator = [ thingList objectEnumerator ]; //
thingList has an array of titles
NSString *aList = nil;

while ( aList = [ listEnumerator nextObject ] )
{
NSMenuItem *menuForAList = [ [ NSMenuItem alloc ]
initWithTitle:aList action:@selector( showList: ) keyEquivalent:@"" ];
[ newMenu addItem:menuForAList ];
}
}



Thanks,
Denise
Matt Neuburg
2005-02-21 00:47:45 UTC
Permalink
On Fri, 18 Feb 2005 12:24:06 -0700, Denise Eatherly
Post by Denise Eatherly
I'm trying to replace the submenu of a menu item, but instead, an
additional menu item appears on the menu bar every time the method
below is called. I've studied the docs and the menu madness example,
but I'm clearly missing something important. I may ultimately use the
delegate methods, but I don't see why this isn't working. Any help
would be very much appreciated.
NSMenuItem *listMenu = [ [ NSApp mainMenu ] itemAtIndex:2 ]; //
this item was created in the nib
NSMenu *newMenu = [ [ NSMenu allocWithZone:[ NSMenu menuZone ] ]
initWithTitle:[ listMenu title ] ];
[ [ NSApp mainMenu] setSubmenu:newMenu forItem:listMenu ]; // same
result as setSubmenu
// [ listMenu setSubmenu:newMenu ];
listMenu already has a menu. So, to replace the menu items of that menu,
just remove them all:

if ([listMenu hasSubmenu]) {
int ii,uu = [[listMenu submenu] numberOfItems];
for (ii = uu - 1; ii >= 0; ii--)
[[listMenu submenu] removeItemAtIndex: ii];
}

Now just start adding new ones. m.
--
matt neuburg, phd = ***@tidbits.com, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide
<http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt>
easyfan
2011-09-14 03:27:45 UTC
Permalink
Post by Denise Eatherly
Hi,
I'd like to give my users a little help at times by setting up
NSPrintInfo to print 2-up documents or 4-up documents.
NSPrintPagesPerSheet seemed obvious but it has been deprecated. I
don't see a replacement, but I may be just overlooking something - does
anyone know a good alternative?
Thanks,
Denise
Hi, Denise:

I also met the issue here. Do you have any progress on it?

Thanks a lot!
Christiaan Hofman
2011-09-14 10:06:49 UTC
Permalink
Post by easyfan
Post by Denise Eatherly
Hi,
I'd like to give my users a little help at times by setting up
NSPrintInfo to print 2-up documents or 4-up documents.
NSPrintPagesPerSheet seemed obvious but it has been deprecated. I
don't see a replacement, but I may be just overlooking something - does
anyone know a good alternative?
Thanks,
Denise
I also met the issue here. Do you have any progress on it?
Thanks a lot!
NSPrintPagesAcross and NSPrintPagesDown?

Christiaan
fan Zheng
2011-09-15 01:39:15 UTC
Permalink
Yeah, you are right.

I have notice that 2 keys, but seems those key change wont lead the preview
refresh in Mac 10.5.8. In 10.6 later, it works O.K.

Thank you in advance.
Post by Christiaan Hofman
Post by easyfan
Post by Denise Eatherly
Hi,
I'd like to give my users a little help at times by setting up
NSPrintInfo to print 2-up documents or 4-up documents.
NSPrintPagesPerSheet seemed obvious but it has been deprecated. I
don't see a replacement, but I may be just overlooking something - does
anyone know a good alternative?
Thanks,
Denise
I also met the issue here. Do you have any progress on it?
Thanks a lot!
NSPrintPagesAcross and NSPrintPagesDown?
Christiaan
Loading...