nspopbutton short title possible?

  • Hi again,

    Is it not possible somehow to have the title in an nspopbutton to show a shortened version of one of the menu items?  So for example if I have a menu item with the title "Advanced Mode" when choosing it I would like to set the title that shows on the button to "Advanced" but leave the menu item unchanged.  Currently it will add a new menu item named "Advanced."  I have done this before with segmented control but it would be easier to use a popup button if possible.  Thanks,

    rc
  • On 19/06/2012, at 2:24 PM, Rick C. wrote:

    > Hi again,
    >
    > Is it not possible somehow to have the title in an nspopbutton to show a shortened version of one of the menu items?  So for example if I have a menu item with the title "Advanced Mode" when choosing it I would like to set the title that shows on the button to "Advanced" but leave the menu item unchanged.  Currently it will add a new menu item named "Advanced."  I have done this before with segmented control but it would be easier to use a popup button if possible.  Thanks,

    When you select your advanced mode within the controller, just set the -title: of the popup button to what you want. This will replace the title which is automatically assigned from the menu item.

    --Graham
  • That's what I'm doing and it does change the title, but when I do it will create a new menu item with the new name that I assigned.  It also says this in the docs.  But there must be a way right am I missing something?

    On Jun 19, 2012, at 12:46 PM, Graham Cox wrote:

    >
    > On 19/06/2012, at 2:24 PM, Rick C. wrote:
    >
    >> Hi again,
    >>
    >> Is it not possible somehow to have the title in an nspopbutton to show a shortened version of one of the menu items?  So for example if I have a menu item with the title "Advanced Mode" when choosing it I would like to set the title that shows on the button to "Advanced" but leave the menu item unchanged.  Currently it will add a new menu item named "Advanced."  I have done this before with segmented control but it would be easier to use a popup button if possible.  Thanks,
    >
    >
    > When you select your advanced mode within the controller, just set the -title: of the popup button to what you want. This will replace the title which is automatically assigned from the menu item.
    >
    > --Graham
    >
    >
  • Take a look at -[NSPopUpButtonCell setUsesItemFromMenu:].

    --Kyle Sluder

    On Jun 18, 2012, at 10:20 PM, "Rick C." <rickcorteza...> wrote:

    > That's what I'm doing and it does change the title, but when I do it will create a new menu item with the new name that I assigned.  It also says this in the docs.  But there must be a way right am I missing something?
    >
    >
    > On Jun 19, 2012, at 12:46 PM, Graham Cox wrote:
    >
    >>
    >> On 19/06/2012, at 2:24 PM, Rick C. wrote:
    >>
    >>> Hi again,
    >>>
    >>> Is it not possible somehow to have the title in an nspopbutton to show a shortened version of one of the menu items?  So for example if I have a menu item with the title "Advanced Mode" when choosing it I would like to set the title that shows on the button to "Advanced" but leave the menu item unchanged.  Currently it will add a new menu item named "Advanced."  I have done this before with segmented control but it would be easier to use a popup button if possible.  Thanks,
    >>
    >>
    >> When you select your advanced mode within the controller, just set the -title: of the popup button to what you want. This will replace the title which is automatically assigned from the menu item.
    >>
    >> --Graham
    >>
    >>
    >
  • Yeah that's what I was missing thanks for the time!

    On Jun 19, 2012, at 1:44 PM, Kyle Sluder wrote:

    > Take a look at -[NSPopUpButtonCell setUsesItemFromMenu:].
    >
    > --Kyle Sluder
    >
    > On Jun 18, 2012, at 10:20 PM, "Rick C." <rickcorteza...> wrote:
    >
    >> That's what I'm doing and it does change the title, but when I do it will create a new menu item with the new name that I assigned.  It also says this in the docs.  But there must be a way right am I missing something?
    >>
    >>
    >> On Jun 19, 2012, at 12:46 PM, Graham Cox wrote:
    >>
    >>>
    >>> On 19/06/2012, at 2:24 PM, Rick C. wrote:
    >>>
    >>>> Hi again,
    >>>>
    >>>> Is it not possible somehow to have the title in an nspopbutton to show a shortened version of one of the menu items?  So for example if I have a menu item with the title "Advanced Mode" when choosing it I would like to set the title that shows on the button to "Advanced" but leave the menu item unchanged.  Currently it will add a new menu item named "Advanced."  I have done this before with segmented control but it would be easier to use a popup button if possible.  Thanks,
    >>>
    >>>
    >>> When you select your advanced mode within the controller, just set the -title: of the popup button to what you want. This will replace the title which is automatically assigned from the menu item.
    >>>
    >>> --Graham
    >>>
    >>>
    >>
  • On 19/06/2012, at 3:20 PM, Rick C. wrote:

    > That's what I'm doing and it does change the title, but when I do it will create a new menu item with the new name that I assigned.

    So it does - that's unexpected. In fact, that's really a strange design choice right there... but I guess it's been that way a long time so we can hardly complain. Glad you found a solution.

    --Graham
  • Yeah it's even here:

    If the receiver displays a pop-up menu, this method changes the current item to be the item with the specified title, adding a new item by that name if one does not already exist.

    But when setUsesItemFromMenu: is set to NO I can make my own item so it works.  The last I did this was with a segmented control and I remember setLabel: seemed to work just fine so this caught me by surprise too.  But all is well now and thanks for the help!

    rc

    On Jun 20, 2012, at 11:22 AM, Graham Cox wrote:

    >
    > On 19/06/2012, at 3:20 PM, Rick C. wrote:
    >
    >> That's what I'm doing and it does change the title, but when I do it will create a new menu item with the new name that I assigned.
    >
    >
    >
    > So it does - that's unexpected. In fact, that's really a strange design choice right there... but I guess it's been that way a long time so we can hardly complain. Glad you found a solution.
    >
    > --Graham
    >
    >
previous month june 2012 next month
MTWTFSS
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30  
Go to today