Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Toolbar item setImage order matters

#75

Setting the image of a toolbaritem after setting the window toolbar doesn't work.

Does not work:

[item setLabel: 'Een'];
[item setEnabled: YES];
[toolbarItems addObject: item];
[toolbar setDelegate: self];
[toolbar setDisplayMode: CPToolbarDisplayModeIconAndLabel];
[toolbar setVisible: YES];
[theWindow setToolbar: toolbar];
[item setImage: image];

works:

[item setImage: image];
[item setLabel: 'Een'];
[item setEnabled: YES];
[toolbarItems addObject: item];
[toolbar setDelegate: self];
[toolbar setDisplayMode: CPToolbarDisplayModeIconAndLabel];
[toolbar setVisible: YES];
[theWindow setToolbar: toolbar];

Reported by Stephan Eggermont · September 26th, 2008 @ 10:20 AM

State: resolved
Milestone: none
Assigned to: nobody

Activity

  1. Francisco Tolmasky
    Francisco Tolmasky
    • State changed from new to invalid

    This is by design. The toolbar doesn't use the actual item you give it, but rather makes a copy of it because the item may show up several times (either because it is in more than one toolbar or because it shows up multiple times in the toolbar itself). Thus, the toolbar item has to be in the state you want it to be in by the time it gets copied, or further changes won't affect the item in the toolbar.

    October 2nd, 2008 @ 08:32 AM

  2. Stephan Eggermont
    Stephan Eggermont

    I'm not sure I get this. Why is this a good thing? If it is, the documentation for CPWindow setToolbar: should mention this.

    October 30th, 2008 @ 11:31 AM

  3. admin (at 280north)

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.