Re: NSComboBox

2018-07-28 Thread Uli Kusterer
On 26. Jul 2018, at 02:50, Casey McDermott  wrote:
> Sometimes one has no idea what's in the list, so it really helps to be able 
> to scroll.
> A popup is probably better for that, but not when in hands-on-keyboard mode.

 You're aware that popups support type-selection, arrow keys etc.? In fact, all 
menus on OS X have supported that for quite a while now.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox

2018-07-27 Thread Clark Cox
In UIs like this that I have made in the past I use a popover or a custom 
pop-up. I.e. something like:

   ++
   |  Field |
   ++---+
^
+---+---+
| Filter Field  |
+---+
|   |
|  Item 1   |
|  Item 2   |
|  Item 3   |
|  ...  |
|  Item n   |
|   |
+---+

- The user tabs-into (or clicks) the field, and a popover is displayed, and the 
filter field is made first responder.
- As the user types (into the now active filter field), the table below it is 
filtered down to matching items
- The user can then either click on the appropriate option, or if there is only 
one, just hit enter

You can see a similar UI if, in Xcode, you click the navigation pop up at the 
top of a source file and start typing.


> On Jul 25, 2018, at 17:50, Casey McDermott  wrote:
> 
>>> Or does the user need to scan the list of near-matches for some reason?
> 
> Yes, exactly.  When you have 20K customer records, you don't remember how
> each was entered, or how spelled.  You may need to type a letter or 2 and then
> scroll the list.  It may take a few tries: Smith Company?  Smyth Company?
> The Smith Company?  Josephine Smith & Co?
> 
> Our customer database has dozens of duplicate names, so they might be entered 
> as
> Smith Company NY and Smith Company CA.
> 
> Sometimes one has no idea what's in the list, so it really helps to be able 
> to scroll.
> A popup is probably better for that, but not when in hands-on-keyboard mode.
> 
> NSComboBox is so close.  That one sentence in the docs is so tantalizing!
> 
> Thanks,
> 
> Casey McDermott
> 
> Turtle Creek Software 
> http://www.turtlesoft.com 
> 607 220-4514
> 
> ----
> On Wed, 7/25/18, Quincey Morris  wrote:
> 
> Subject: Re: NSComboBox
> To: "Casey McDermott" 
> Cc: "Cocoa-Dev List" 
> Date: Wednesday, July 25, 2018, 7:55 PM
> 
> On Jul 25, 2018, at 15:40 , Casey
> McDermott 
> wrote:
>> 
>> I forgot to mention
> that the lists may contain 10,000s of items. Maybe 100,000s.
> 
>> Typing to select from NSPopUpButton
> works OK for short lists.  I just made a test 
>> popup with 300 items and it's already
> awkward.  10K would be absurd.
>> 
>> These are business records, and users may
> data enter hundreds a day.  They want 
>> 
> to tab, type a few letters to select a customer, tab to the
> next field, type a bit to
>> select an
> inventory item, etc.  Type a customer that doesn't
> exist and it should beep 
>> and ignore
> the keystrokes.  If they need to enter a new customer,
> it's a right-click, 
>> then a panel
> to enter more than just the name.
>> 
>> Our current interface does use popup
> buttons for some things, but people complain
>> about them.  They don't want to take
> hands off keyboard.  We plan to convert those 
>> to combo boxes so it can be completely
> mouseless.
> 
> If
> that’s your use case, there’s something else gong on at
> the heart of this.
> 
> What
> value — if there are tens of thousands of items — is
> there in popping anything up at all, whether it’s a
> combo-box-style popup or a menu-style popup? It seems that
> you should just validate the text field every stroke, and
> provide the rest of the field as soon as what is typed
> becomes unique. Or does the user need to scan the list of
> near-matches for some reason?
> 
> Another approach to this might be to be
> something like autocomplete, but where you don’t start
> offering autocompletions until enough text has been entered
> to limit the possibilities to a manageable number of
> choices. Text fields have built-in support for autocomplete,
> although IIRC it gets a bit harder if the completions are
> context sensitive — if typing more characters changes the
> list of possibilities, rather than just limiting it.
> (Xcode’s autocompletions are content sensitive in this
> sense, but Xcode has its own implementation unrelated to
> NSTextField’s.)
> 
> Or, use a
> table view next to the text field, and programmatically
> scroll to the area of the list that matches what the user
> has typed so far. NSTableView is essentially optimized for
> displaying small fragments of huge lists, so it might be
> better than trying to stuff all those entries in a combo

Re: NSComboBox

2018-07-26 Thread Alastair Houghton
On 26 Jul 2018, at 01:18, Casey McDermott  wrote:
> 
> We have a 1/2 decent version working right now based on NSTextField. It shows 
> a scrolling table
> with a NSWindowController, and selects from the table (and beeps if not 
> there). It also
> has a NSPopUpButton on the side to use as an additional option (handy for 
> short lists
> or if the user is already mousing).  Basically, that is the same approach we 
> use/used in the 
> C++ version (PowerPlant, Carbon).
> 
> But, getting all the details to work just right has been extremely difficult. 
>  NSComboBox
> is so close, and so much less futzing.  Also, the combo box in Windows 
> MFC 
> does exactly what we need, and it would be nice if both platforms looked the 
> same.
> 
> One big beef I have is that it's not possible to step into Cocoa source, 
> unlike PowerPlant
> or MFC.  It makes it much harder to understand what's going on inside Cocoa.

To be fair, in the case of MFC some of it (like the combobox) relies on 
underlying Windows controls that you also don’t have the source for.

NSComboBox is pretty unusual in a Mac application; you don’t see many of them 
about, and I think that’s because there are often better options (particularly 
in cases like yours where you say there may be thousands of possible choices), 
not to mention the fact that historically the NSComboBox looked rather ugly 
compared to other Aqua controls. You might also consider using something like 
NSTokenField (check out the To and Cc fields in Apple Mail for an idea of what 
that might look like).

Someone suggested looking at the Cocotron source; that isn’t a bad idea — 
though Cocotron’s implementations are sometimes rather simpler than the ones in 
the Cocoa framework — and you could also look at GNUStep’s sources to see how 
it does things. Neither, of course, guarantees that Apple/NeXT chose the same 
approach, although in many cases the API itself does dictate some of the 
details of how it works under the covers; if you want to know how it really 
works, grab yourself a copy of Hopper > (or IDA, or even just do it the old fashioned way 
using otool) and disassemble the relevant framework.

Kind regards,

Alastair.

--
http://alastairs-place.net

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox

2018-07-25 Thread Richard Charles


> On Jul 25, 2018, at 6:18 PM, Casey McDermott  wrote:
> 
> One big beef I have is that it's not possible to step into Cocoa source, 
> unlike PowerPlant
> or MFC.  It makes it much harder to understand what's going on inside Cocoa.

Check out the Cocotron source. Sometimes you can gain insight into what going 
on by looking there.

--Richard Charles

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox

2018-07-25 Thread Casey McDermott
>> Or does the user need to scan the list of near-matches for some reason?

Yes, exactly.  When you have 20K customer records, you don't remember how
each was entered, or how spelled.  You may need to type a letter or 2 and then
scroll the list.  It may take a few tries: Smith Company?  Smyth Company?
The Smith Company?  Josephine Smith & Co?

Our customer database has dozens of duplicate names, so they might be entered as
Smith Company NY and Smith Company CA.

Sometimes one has no idea what's in the list, so it really helps to be able to 
scroll.
A popup is probably better for that, but not when in hands-on-keyboard mode.

NSComboBox is so close.  That one sentence in the docs is so tantalizing!

Thanks,

Casey McDermott

Turtle Creek Software 
http://www.turtlesoft.com 
607 220-4514


On Wed, 7/25/18, Quincey Morris  wrote:

 Subject: Re: NSComboBox
 To: "Casey McDermott" 
 Cc: "Cocoa-Dev List" 
 Date: Wednesday, July 25, 2018, 7:55 PM
 
 On Jul 25, 2018, at 15:40 , Casey
 McDermott 
 wrote:
 > 
 > I forgot to mention
 that the lists may contain 10,000s of items. Maybe 100,000s.
 
 > Typing to select from NSPopUpButton
 works OK for short lists.  I just made a test 
 > popup with 300 items and it's already
 awkward.  10K would be absurd.
 > 
 > These are business records, and users may
 data enter hundreds a day.  They want 
 >
 to tab, type a few letters to select a customer, tab to the
 next field, type a bit to
 > select an
 inventory item, etc.  Type a customer that doesn't
 exist and it should beep 
 > and ignore
 the keystrokes.  If they need to enter a new customer,
 it's a right-click, 
 > then a panel
 to enter more than just the name.
 > 
 > Our current interface does use popup
 buttons for some things, but people complain
 > about them.  They don't want to take
 hands off keyboard.  We plan to convert those 
 > to combo boxes so it can be completely
 mouseless.
 
 If
 that’s your use case, there’s something else gong on at
 the heart of this.
 
 What
 value — if there are tens of thousands of items — is
 there in popping anything up at all, whether it’s a
 combo-box-style popup or a menu-style popup? It seems that
 you should just validate the text field every stroke, and
 provide the rest of the field as soon as what is typed
 becomes unique. Or does the user need to scan the list of
 near-matches for some reason?
 
 Another approach to this might be to be
 something like autocomplete, but where you don’t start
 offering autocompletions until enough text has been entered
 to limit the possibilities to a manageable number of
 choices. Text fields have built-in support for autocomplete,
 although IIRC it gets a bit harder if the completions are
 context sensitive — if typing more characters changes the
 list of possibilities, rather than just limiting it.
 (Xcode’s autocompletions are content sensitive in this
 sense, but Xcode has its own implementation unrelated to
 NSTextField’s.)
 
 Or, use a
 table view next to the text field, and programmatically
 scroll to the area of the list that matches what the user
 has typed so far. NSTableView is essentially optimized for
 displaying small fragments of huge lists, so it might be
 better than trying to stuff all those entries in a combo
 box.
 
 
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox

2018-07-25 Thread Casey McDermott
We have a 1/2 decent version working right now based on NSTextField. It shows a 
scrolling table
with a NSWindowController, and selects from the table (and beeps if not there). 
It also
has a NSPopUpButton on the side to use as an additional option (handy for short 
lists
or if the user is already mousing).  Basically, that is the same approach we 
use/used in the 
C++ version (PowerPlant, Carbon).

But, getting all the details to work just right has been extremely difficult.  
NSComboBox
is so close, and so much less futzing.  Also, the combo box in Windows MFC 
does exactly what we need, and it would be nice if both platforms looked the 
same.

One big beef I have is that it's not possible to step into Cocoa source, unlike 
PowerPlant
or MFC.  It makes it much harder to understand what's going on inside Cocoa.

Thanks,

Casey McDermott

Turtle Creek Software 
http://www.turtlesoft.com 
607 220-4514


On Wed, 7/25/18, Sandor Szatmari  wrote:

 Subject: Re: NSComboBox
 To: "Keary Suska" 
 Cc: "Casey McDermott" , "Cocoa-Dev (Apple)" 

 Date: Wednesday, July 25, 2018, 7:40 PM
 
 I have done stuff like this just
 using NSTextField.  You can connect delegate methods to
 supply the array of suitable strings to select from that
 match the ‘prefix’ the user types in.  For every
 character the user types I recalculate the array of
 completions.  You can filter a very long list of
 completions very quickly.  I don’t have the code in front
 of me but I can post something tomorrow if this sounds like
 an avenue you haven’t considered yet.
 
 I think it was a combination of:
 
 -controlTextDidChange:
 
 -(NSArray *)control:(NSControl
 *)control textView:(NSTextView *)textView
 completions:(NSArray *)words
 forPartialWordRange:(NSRange)charRange
 indexOfSelectedItem:(NSInteger *)index
 
 I found that the non obvious part was setting
 the pointer ‘index’ to -1 or something like that to
 indicate that no selection was made yet.  This caused the
 entire list of possible completions to be presented. Then
 everything worked as expected.  If you know the index of
 the string you want to autocomplete to you set ‘index’
 to that, well…, index.
 
 Sandor
 
 > On
 Jul 25, 2018, at 18:56, Keary Suska 
 wrote:
 > 
 > NSComboBox
 is just a suped-up NSTextField, so you can some sort of
 validation so you can prevent the user from exiting the
 field if they don’t enter an acceptable value. The most
 basic approach is delegation and doing the check in 
 -control:textShouldEndEditing:
 > 
 > HTH,
 > 
 > Keary Suska
 >
 Esoteritech, Inc.
 > "Demystifying
 technology for your home or business"
 > 
 >> On Jul 25, 2018,
 at 4:40 PM, Casey McDermott 
 wrote:
 >> 
 >> I
 forgot to mention that the lists may contain 10,000s of
 items. Maybe 100,000s. 
 >> Typing to
 select from NSPopUpButton works OK for short lists.  I just
 made a test 
 >> popup with 300 items
 and it's already awkward.  10K would be absurd.
 >> 
 >> These are
 business records, and users may data enter hundreds a day. 
 They want 
 >> to tab, type a few
 letters to select a customer, tab to the next field, type a
 bit to
 >> select an inventory item,
 etc.  Type a customer that doesn't exist and it should
 beep 
 >> and ignore the keystrokes. 
 If they need to enter a new customer, it's a
 right-click, 
 >> then a panel to enter
 more than just the name.
 >> 
 >> Our current interface does use popup
 buttons for some things, but people complain
 >> about them.  They don't want to
 take hands off keyboard.  We plan to convert those 
 >> to combo boxes so it can be completely
 mouseless.
 >> 
 >> That "disambiguating field"
 article by Tog may be on one of the developer CDs.  
 >> I can't find it online. It
 explained this use case very well, and interface to solve
 it. 
 >> It was a major reason why we
 switched from Excel templates to a C++ app.
 >> NSComboBox is close, but we need it
 confined to existing items.
 >> 
 >> Thanks,
 >> 
 >> Casey McDermott
 >> 
 >> Turtle Creek
 Software 
 >> http://www.turtlesoft.com 
 >> 607 220-4514
 >>
 
 >>
 
 >> On Wed, 7/25/18, Jens Alfke 
 wrote:
 >> 
 >>
 Subject: Re: NSComboBox
 >> To:
 "Casey McDermott" 
 >> Cc: cocoa-dev@lists.apple.com
 >> Date: Wednesday, July 25, 2018, 2:51
 PM
 >> 
 >> 
 >> 
 >> On
 >> Jul 25, 2018, at 10:45 AM, Casey
 McDermott 
 >> wrote:
 >> The
 >> goal is to auto-fill an account from
 what they type, and
 >> ignore typing
 if not a match.
 >> 
 >> That sounds like the regular
 behavior
 >> of NSPopUpButton

Re: NSComboBox

2018-07-25 Thread Quincey Morris
On Jul 25, 2018, at 15:40 , Casey McDermott  wrote:
> 
> I forgot to mention that the lists may contain 10,000s of items. Maybe 
> 100,000s. 
> Typing to select from NSPopUpButton works OK for short lists.  I just made a 
> test 
> popup with 300 items and it's already awkward.  10K would be absurd.
> 
> These are business records, and users may data enter hundreds a day.  They 
> want 
> to tab, type a few letters to select a customer, tab to the next field, type 
> a bit to
> select an inventory item, etc.  Type a customer that doesn't exist and it 
> should beep 
> and ignore the keystrokes.  If they need to enter a new customer, it's a 
> right-click, 
> then a panel to enter more than just the name.
> 
> Our current interface does use popup buttons for some things, but people 
> complain
> about them.  They don't want to take hands off keyboard.  We plan to convert 
> those 
> to combo boxes so it can be completely mouseless.

If that’s your use case, there’s something else gong on at the heart of this.

What value — if there are tens of thousands of items — is there in popping 
anything up at all, whether it’s a combo-box-style popup or a menu-style popup? 
It seems that you should just validate the text field every stroke, and provide 
the rest of the field as soon as what is typed becomes unique. Or does the user 
need to scan the list of near-matches for some reason?

Another approach to this might be to be something like autocomplete, but where 
you don’t start offering autocompletions until enough text has been entered to 
limit the possibilities to a manageable number of choices. Text fields have 
built-in support for autocomplete, although IIRC it gets a bit harder if the 
completions are context sensitive — if typing more characters changes the list 
of possibilities, rather than just limiting it. (Xcode’s autocompletions are 
content sensitive in this sense, but Xcode has its own implementation unrelated 
to NSTextField’s.)

Or, use a table view next to the text field, and programmatically scroll to the 
area of the list that matches what the user has typed so far. NSTableView is 
essentially optimized for displaying small fragments of huge lists, so it might 
be better than trying to stuff all those entries in a combo box.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox

2018-07-25 Thread Sandor Szatmari
I have done stuff like this just using NSTextField.  You can connect delegate 
methods to supply the array of suitable strings to select from that match the 
‘prefix’ the user types in.  For every character the user types I recalculate 
the array of completions.  You can filter a very long list of completions very 
quickly.  I don’t have the code in front of me but I can post something 
tomorrow if this sounds like an avenue you haven’t considered yet.

I think it was a combination of:

-controlTextDidChange:

-(NSArray *)control:(NSControl *)control textView:(NSTextView *)textView 
completions:(NSArray *)words forPartialWordRange:(NSRange)charRange 
indexOfSelectedItem:(NSInteger *)index

I found that the non obvious part was setting the pointer ‘index’ to -1 or 
something like that to indicate that no selection was made yet.  This caused 
the entire list of possible completions to be presented. Then everything worked 
as expected.  If you know the index of the string you want to autocomplete to 
you set ‘index’ to that, well…, index.

Sandor

> On Jul 25, 2018, at 18:56, Keary Suska  wrote:
> 
> NSComboBox is just a suped-up NSTextField, so you can some sort of validation 
> so you can prevent the user from exiting the field if they don’t enter an 
> acceptable value. The most basic approach is delegation and doing the check 
> in  -control:textShouldEndEditing:
> 
> HTH,
> 
> Keary Suska
> Esoteritech, Inc.
> "Demystifying technology for your home or business"
> 
>> On Jul 25, 2018, at 4:40 PM, Casey McDermott  wrote:
>> 
>> I forgot to mention that the lists may contain 10,000s of items. Maybe 
>> 100,000s. 
>> Typing to select from NSPopUpButton works OK for short lists.  I just made a 
>> test 
>> popup with 300 items and it's already awkward.  10K would be absurd.
>> 
>> These are business records, and users may data enter hundreds a day.  They 
>> want 
>> to tab, type a few letters to select a customer, tab to the next field, type 
>> a bit to
>> select an inventory item, etc.  Type a customer that doesn't exist and it 
>> should beep 
>> and ignore the keystrokes.  If they need to enter a new customer, it's a 
>> right-click, 
>> then a panel to enter more than just the name.
>> 
>> Our current interface does use popup buttons for some things, but people 
>> complain
>> about them.  They don't want to take hands off keyboard.  We plan to convert 
>> those 
>> to combo boxes so it can be completely mouseless.
>> 
>> That "disambiguating field" article by Tog may be on one of the developer 
>> CDs.  
>> I can't find it online. It explained this use case very well, and interface 
>> to solve it. 
>> It was a major reason why we switched from Excel templates to a C++ app.
>> NSComboBox is close, but we need it confined to existing items.
>> 
>> Thanks,
>> 
>> Casey McDermott
>> 
>> Turtle Creek Software 
>> http://www.turtlesoft.com 
>> 607 220-4514
>> 
>> 
>> On Wed, 7/25/18, Jens Alfke  wrote:
>> 
>> Subject: Re: NSComboBox
>> To: "Casey McDermott" 
>> Cc: cocoa-dev@lists.apple.com
>> Date: Wednesday, July 25, 2018, 2:51 PM
>> 
>> 
>> 
>> On
>> Jul 25, 2018, at 10:45 AM, Casey McDermott 
>> wrote:
>> The
>> goal is to auto-fill an account from what they type, and
>> ignore typing if not a match.
>> 
>> That sounds like the regular behavior
>> of NSPopUpButton: after clicking to pop up the menu, you can
>> type-select items from it. 
>> (Although it doesn't ignore
>> mismatches, it just selects the closest item.)
>> —Jens
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/cocoa-dev%40esoteritech.com
>> 
>> This email sent to cocoa-...@esoteritech.com
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/admin.szatmari.net%40gmail.com
> 
> This email sent to admin.szatmari@gmail.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox

2018-07-25 Thread Keary Suska
NSComboBox is just a suped-up NSTextField, so you can some sort of validation 
so you can prevent the user from exiting the field if they don’t enter an 
acceptable value. The most basic approach is delegation and doing the check in  
-control:textShouldEndEditing:

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

> On Jul 25, 2018, at 4:40 PM, Casey McDermott  wrote:
> 
> I forgot to mention that the lists may contain 10,000s of items. Maybe 
> 100,000s. 
> Typing to select from NSPopUpButton works OK for short lists.  I just made a 
> test 
> popup with 300 items and it's already awkward.  10K would be absurd.
> 
> These are business records, and users may data enter hundreds a day.  They 
> want 
> to tab, type a few letters to select a customer, tab to the next field, type 
> a bit to
> select an inventory item, etc.  Type a customer that doesn't exist and it 
> should beep 
> and ignore the keystrokes.  If they need to enter a new customer, it's a 
> right-click, 
> then a panel to enter more than just the name.
> 
> Our current interface does use popup buttons for some things, but people 
> complain
> about them.  They don't want to take hands off keyboard.  We plan to convert 
> those 
> to combo boxes so it can be completely mouseless.
> 
> That "disambiguating field" article by Tog may be on one of the developer 
> CDs.  
> I can't find it online. It explained this use case very well, and interface 
> to solve it. 
> It was a major reason why we switched from Excel templates to a C++ app.
> NSComboBox is close, but we need it confined to existing items.
> 
> Thanks,
> 
> Casey McDermott
> 
> Turtle Creek Software 
> http://www.turtlesoft.com 
> 607 220-4514
> 
> 
> On Wed, 7/25/18, Jens Alfke  wrote:
> 
> Subject: Re: NSComboBox
> To: "Casey McDermott" 
> Cc: cocoa-dev@lists.apple.com
> Date: Wednesday, July 25, 2018, 2:51 PM
> 
> 
> 
> On
> Jul 25, 2018, at 10:45 AM, Casey McDermott 
> wrote:
> The
> goal is to auto-fill an account from what they type, and
> ignore typing if not a match.
> 
> That sounds like the regular behavior
> of NSPopUpButton: after clicking to pop up the menu, you can
> type-select items from it. 
> (Although it doesn't ignore
> mismatches, it just selects the closest item.)
> —Jens
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/cocoa-dev%40esoteritech.com
> 
> This email sent to cocoa-...@esoteritech.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox

2018-07-25 Thread Casey McDermott
I forgot to mention that the lists may contain 10,000s of items. Maybe 
100,000s. 
Typing to select from NSPopUpButton works OK for short lists.  I just made a 
test 
popup with 300 items and it's already awkward.  10K would be absurd.

These are business records, and users may data enter hundreds a day.  They want 
to tab, type a few letters to select a customer, tab to the next field, type a 
bit to
select an inventory item, etc.  Type a customer that doesn't exist and it 
should beep 
and ignore the keystrokes.  If they need to enter a new customer, it's a 
right-click, 
then a panel to enter more than just the name.

Our current interface does use popup buttons for some things, but people 
complain
about them.  They don't want to take hands off keyboard.  We plan to convert 
those 
to combo boxes so it can be completely mouseless.

That "disambiguating field" article by Tog may be on one of the developer CDs.  
I can't find it online. It explained this use case very well, and interface to 
solve it. 
It was a major reason why we switched from Excel templates to a C++ app.
NSComboBox is close, but we need it confined to existing items.

Thanks,

Casey McDermott

Turtle Creek Software 
http://www.turtlesoft.com 
607 220-4514


On Wed, 7/25/18, Jens Alfke  wrote:

 Subject: Re: NSComboBox
 To: "Casey McDermott" 
 Cc: cocoa-dev@lists.apple.com
 Date: Wednesday, July 25, 2018, 2:51 PM
 
 
 
 On
 Jul 25, 2018, at 10:45 AM, Casey McDermott 
 wrote:
 The
 goal is to auto-fill an account from what they type, and
 ignore typing if not a match.
 
 That sounds like the regular behavior
 of NSPopUpButton: after clicking to pop up the menu, you can
 type-select items from it. 
 (Although it doesn't ignore
 mismatches, it just selects the closest item.)
 —Jens
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox

2018-07-25 Thread Rob Petrovec
I was going to suggest the same thing.  NSPopUpButton should do what you want.

—Rob


> On Jul 25, 2018, at 12:51 PM, Jens Alfke  wrote:
> 
> 
> 
>> On Jul 25, 2018, at 10:45 AM, Casey McDermott  wrote:
>> 
>> The goal is to auto-fill an account from what they type, and ignore typing 
>> if not a match.
> 
> That sounds like the regular behavior of NSPopUpButton: after clicking to pop 
> up the menu, you can type-select items from it. 
> 
> (Although it doesn't ignore mismatches, it just selects the closest item.)
> 
> —Jens
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/petrock%40mac.com
> 
> This email sent to petr...@mac.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox

2018-07-25 Thread Jens Alfke


> On Jul 25, 2018, at 10:45 AM, Casey McDermott  wrote:
> 
> The goal is to auto-fill an account from what they type, and ignore typing if 
> not a match.

That sounds like the regular behavior of NSPopUpButton: after clicking to pop 
up the menu, you can type-select items from it. 

(Although it doesn't ignore mismatches, it just selects the closest item.)

—Jens
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox

2018-07-25 Thread John Harte


> On Jul 25, 2018, at 12:45 PM, Casey McDermott  wrote:
> 
> Apple's instructions for combo boxes say:  "Note that while you can construct 
> your NSComboBox
> so that users are restricted to only selecting items from the combo box’s 
> pop-up list,
> this isn’t the combo box’s normal behavior."
> 
> For our use, we definitely want to restrict NSComboBox to only accept items 
> in the list.
> For accounting, we can't create new accounts on the fly from just a name, 
> especially if users make a typo.
> The goal is to auto-fill an account from what they type, and ignore typing if 
> not a match.
> 
> We searched sample projects, the archives here, and StackOverflow.  No 
> instructions on how to
> restrict it.  Has anyone here ever done it?
> 

I switched Behavior for Text Field in the Attributes Inspector from Editable to 
Selectable and it works, I can select from the list but I can’t type in text.

Hope that helps,
John


signature.asc
Description: Message signed with OpenPGP
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox -comboBox:completedString: not called

2018-03-13 Thread Greg Weston

> So, to answer my own question, I can "get this to work" using a custom 
> NSComboBoxCell 
> subclass, implementing -completedString.
> 
> Having seen this in action I must confess this is a Bad Idea™.

You’re describing long-standing documented behavior and the correct approach to 
achieve the alternative behavior you want. Where’s the Bad Idea?
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox -comboBox:completedString: not called

2018-03-13 Thread Markus Spoettl

On 3/13/18 09:42, Markus Spoettl wrote:
I have trouble with NSComboBox in that the data source method -comboBox:completedString: 
is not getting called. The combo box in question uses bindings for "Value" and "Content 
Values", so I have no other data source methods implemented and -usesDataSource is NO 
(when that is turned to YES, the combo box looses its content).


What I really want is implement case insensitive completion, I don't insist on using the 
data source if there's another way to do that.


So, to answer my own question, I can "get this to work" using a custom NSComboBoxCell 
subclass, implementing -completedString.


Having seen this in action I must confess this is a Bad Idea™.

Regards
Markus

--
__
Markus Spoettl
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox in the tab ring

2014-10-29 Thread Luther Baker
Yep - I ended up going with a Pop Up Button for the reason's you've both
mentioned.

Thanks for replying with a bit of explanation and suggestions!
-Luther


On Wed, Oct 29, 2014 at 3:16 PM, Graham Cox  wrote:

>
> On 19 Oct 2014, at 3:14 pm, Luther Baker  wrote:
>
> > I don't want to allow the user to type randomly into the text
> > field
>
>
> It *is* a text field. Sounds like what you really want is a pop-up menu
> button.
>
> --Graham
>
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSComboBox in the tab ring

2014-10-29 Thread Graham Cox

On 19 Oct 2014, at 3:14 pm, Luther Baker  wrote:

> I don't want to allow the user to type randomly into the text
> field


It *is* a text field. Sounds like what you really want is a pop-up menu button.

--Graham



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSComboBox in the tab ring

2014-10-29 Thread Fritz Anderson
On 18 Oct 2014, at 11:14 PM, Luther Baker  wrote:
> 
> Is it possible to keep an NSComboBox in the tabbing ring if I set its
> "Behavior" to "Selectable". Tabbing reaches the control if the textfield is
> editable but I don't want to allow the user to type randomly into the text
> field ... but unfortunately, once I remove its editability, the tabbing
> cycle skips the control.

An NSComboBox is an instance of a subclass of NSTextField. Use as a free-form 
text-entry control, _assisted by_ suggested completions, is the essence of the 
class. Text fields are either editable or not. One might wish NSComboBox were a 
different object, but it isn’t.

The text field delegate methods let you constrain the user’s input on-the-fly, 
and there are additional delegate methods and notifications for combo boxes; 
see if you can get what you want that way. Maybe CocoaPods has something, it’s 
a commonly-desired feature.

— F


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSComboBox and sorted list

2014-04-26 Thread Frédéric Testuz
Le 18 avr. 2014 à 13:32, Frédéric Testuz  a écrit :
> 
> I have a typical CoreData application which display my entities in an 
> NSTableView with an NSArrayController and a panel to edit the selected item.
> 
> I have an entity Book with a NSString attribute type displayed in an 
> NSComboBox. I want the drop down list of the combo box to display the 
> previously chosen types. I have an NSArrayController bind with the Book 
> entity and the managed object context.
> 
> I can make it works by binding the NSComboBox :
> Content (or Content Values) -> 
> bookarraycontroller.arrangedobjec...@distinctunionofobjects.type
> Value -> BookArrayController.selection.type
> 
> Until this point all is well, but I want the list to be sorted. So I think I 
> have to add a NSArrayController which will maintain the sorted list of types. 
> I try this :
> 
> TypeListArrayController :
> Content Array -> 
> bookarraycontroller.arrangedobjec...@distinctunionofobjects.type
> 
> NSComboBox :
> Content -> TypeListArrayController.arrangedObjects
> Value -> BookArrayController.selection.type
> 
> But with this setting, when I open my document (when the window is displayed) 
> it takes a long time. More than 10min when at first it takes 1s. I 
> check by stopping in the debugger, the stack frame is more than 38000 with 
> huge recursivity.
> 
> Is there a solution with NSArrayController and binding or I have to implement 
> a data source for the combo box manually ?

After trying some things I have it working by manually implementing the data 
source and observing my BookArrayController for change of the type property.

For information, in my second test, if dont bind the combo box to the array 
controller, there is no delay. So the recursive problem appears with the 
interaction of the bindings between NSComboBox<->TypeListArrayController and 
TypeListArrayController<->BookArrayController



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSComboBox and Multiple Selection

2013-02-12 Thread Keary Suska
On Feb 12, 2013, at 1:07 AM, livinginlosange...@mac.com wrote:

> I have an NSCombox bound to an NSArrayController's "name" attribute. If I 
> choose multiple items and click on the pop up button in the NSComboxBox, the 
> NSComboBox clears the name value for all of the different items' name 
> attribute. This is less than ideal. I don't necessarily wish for the the 
> value to be cleared when I click on the pop up button. The NSComboBox does 
> not do this if I select items that share the same name attribute. In that 
> case, the NSComboBox selects the name in the pop up window. What I would 
> prefer is that the NSComboBox exhibit the same behavior as when I tab into 
> the control when I have multiple values selected. Does any one have an idea?

Look at the "value" binding options to disallow editing multiple values 
selection. The archives contain a more detailed conversation about why 
NSComboBox does this.

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox, binding, multiple selection, multiple values == trouble

2013-01-23 Thread Markus Spoettl

On 1/23/13 10:25 PM, Keary Suska wrote:

This works reasonably well but I wonder how others have fixed this problem.
I feel returning NSMultipleValuesMarker is a hack which works only because
NSComboBox thinks it's a legitimate return value (or doesn't care). The
fact that I can't clear properties for multiple selections is a side effect
I can live with.


This actually works? I wouldn't think so--I would expect that all of the
field values get set to the string value of NSMultipleValuesMarker, which is
really what the code looks like it should be doing. If there are indeed some
internals that are ignoring the marker, they are undocumented (AFAIK) and
shouldn't be relied upon.


Yes, it works. My theory is that the NSArrayController, which is actually 
updating the model via its selection proxy, does the right thing when it gets a 
NSMultipleValuesMarker back as object value.



Any better fixes for this?


If you are really dedicated to using NSCombobox, I would avoid bindings and
instead handle it manually, using target-action. This way, when your
controller receives the action you can check for a multiple selection and
ignore it if so.


Yes, that may be an option, though not a very convenient one. Getting rid of 
NSComboBox altogether may be more attractive.


Regards
Markus
--
__
Markus Spoettl

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox, binding, multiple selection, multiple values == trouble

2013-01-23 Thread Keary Suska
On Jan 23, 2013, at 10:28 AM, Markus Spoettl wrote:

>  in my app, I can edit a selection of model objects in a window which that 
> consists of NSTextFields and NSComboBoxes to edit model properties, all via 
> binding to an NSArrayController's selection proxy.
> 
> When I'm editing a multi-selection that has property values are different for 
> individual model objects in the selection, I get an undesired behavior from 
> NSComboBox:
> 
> When I tab over an NSComboBox which displays the multiple-values placeholder, 
> upon exiting the combo box, the corresponding property for all selected 
> objects is nil'd. (BAD)
> 
> When I do the same (tabbing over) with an NSTextField, the values of the 
> individual objects' properties are unchanged. (GOOD).

I had a similar issue and I don't think it has anything to do with the binding. 
It seems to be that NSCombobox always sets the value as displayed when the 
field is exited regardless of whether the contents have been edited or not. So, 
if the contents are nil, it will set the value(s) to nil on exit. This may be 
an acceptable outcome when editing a single value, so it is probably 
overlooked. In my case it was unnecessarily dirtying the document edited state. 
My solution was to scrap comboboxes and instead use regular NSTextFields with 
autocompletion support provided by a formatter. It proved to be actually better 
in my situation--more intuitive to the user. Of course, these were fields whose 
possible contents are already known by the user, such as a name prefix (Mr Ms 
etc)

> Since I have no control over how NSComboBox implements its bindings and I 
> therefore can't fix the handling of multi-valued selections, I fixed this by 
> subclassing NSComboBox and implementing -objectValue by returning the 
> NSMultipleValuesMarker object as I see fit.
> 
> - (id)objectValue
> {
>id result = [super objectValue];
>if (returnMultiValuesMarkerForEmptyObjectValue) {
>if ([result isEqualTo:@""])  {
>result = NSMultipleValuesMarker;
>}
>}
>return result;
> }
> 
> The private returnMultiValuesMarkerForEmptyObjectValue ivar is set to YES 
> externally by my editor controller which knows that a multiple selection is 
> being edited.
> 
> This works reasonably well but I wonder how others have fixed this problem. I 
> feel returning NSMultipleValuesMarker is a hack which works only because 
> NSComboBox thinks it's a legitimate return value (or doesn't care). The fact 
> that I can't clear properties for multiple selections is a side effect I can 
> live with.

This actually works? I wouldn't think so--I would expect that all of the field 
values get set to the string value of NSMultipleValuesMarker, which is really 
what the code looks like it should be doing. If there are indeed some internals 
that are ignoring the marker, they are undocumented (AFAIK) and shouldn't be 
relied upon.

> Any better fixes for this?

If you are really dedicated to using NSCombobox, I would avoid bindings and 
instead handle it manually, using target-action. This way, when your controller 
receives the action you can check for a multiple selection and ignore it if so.

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox, binding, multiple selection, multiple values == trouble

2013-01-23 Thread Markus Spoettl

On 1/23/13 9:51 PM, Quincey Morris wrote:

When I'm editing a multi-selection that has property values are different for
individual model objects in the selection, I get an undesired behavior from
NSComboBox:

When I tab over an NSComboBox which displays the multiple-values placeholder,
upon exiting the combo box, the corresponding property for all selected
objects is nil'd. (BAD)


Does the "Allows Editing Multiple Values Selection" binding option, if
unchecked, prevent the problem?


No.

"Allows Editing Multiple Values Selection" ON or OFF doesn't change the behavior 
(clearing multi-value content on exit). "Conditionally Sets Editable" ON makes 
it non-editable for multi-value content if "Allows Editing Multiple Values 
Selection" is OFF, which is not what I want.


Regards
Markus
--
__
Markus Spoettl
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox, binding, multiple selection, multiple values == trouble

2013-01-23 Thread Quincey Morris
On Jan 23, 2013, at 09:28 , Markus Spoettl  wrote:

>  in my app, I can edit a selection of model objects in a window which that 
> consists of NSTextFields and NSComboBoxes to edit model properties, all via 
> binding to an NSArrayController's selection proxy.
> 
> When I'm editing a multi-selection that has property values are different for 
> individual model objects in the selection, I get an undesired behavior from 
> NSComboBox:
> 
> When I tab over an NSComboBox which displays the multiple-values placeholder, 
> upon exiting the combo box, the corresponding property for all selected 
> objects is nil'd. (BAD)

Does the "Allows Editing Multiple Values Selection" binding option, if 
unchecked, prevent the problem?


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox with NSNumberFormatter DataSource works but not Content binding

2012-09-13 Thread Quincey Morris
On Sep 4, 2012, at 23:12 , Luke Evans  wrote:

> I understand that I must present NSDecimalNumber objects for list content and 
> I'd prefer to use bindings for this,

Why must you use NSDecimalNumber instead of NSNumber?

> so I create a simple NSArray of NSDecimalNumber values and provide this as 
> the Content binding.  I get a drop down list with no visible values.

The "content" binding is documented to require a NSArrayController.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox

2012-04-24 Thread koko
I changed to NSPopUpButton and use:

[self addItemWithTitle:@"Title"];
[[self lastItem] setImage:image];

Easy, works great.

Are you saying I could have made these calls on an instance of NSComboBox?

I do not see addItem, lastItem or setImage in NSComboBox.

How would I use 'the menu portion' of NSComboBox?


-koko


On Apr 24, 2012, at 7:35 PM, Erik Stainsby wrote:

> The menu portion of a combo box is just that an NSMenu so you ought to be 
> able to everything you can with  a regular menu item.
> 
> Erik
> 
> 
> On 2012-04-23, at 5:53 PM, koko wrote:
> 
>> I have been spelunking all afternoon with mixed results.  Some say I can put 
>> an image and text in an NSComboBoxCell.
>> 
>> Can this be done … put an image and text in an NSComboBoxCell?
>> 
>> I can find no examples and would appreciate one if possible.
>> 
>> -koko
>> 
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/erik.stainsby%40roaringsky.ca
>> 
>> This email sent to erik.stain...@roaringsky.ca
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/koko%40highrolls.net
> 
> This email sent to k...@highrolls.net

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSComboBox

2012-04-24 Thread Erik Stainsby
The menu portion of a combo box is just that an NSMenu so you ought to be able 
to everything you can with  a regular menu item.

Erik


On 2012-04-23, at 5:53 PM, koko wrote:

> I have been spelunking all afternoon with mixed results.  Some say I can put 
> an image and text in an NSComboBoxCell.
> 
> Can this be done … put an image and text in an NSComboBoxCell?
> 
> I can find no examples and would appreciate one if possible.
> 
> -koko
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/erik.stainsby%40roaringsky.ca
> 
> This email sent to erik.stain...@roaringsky.ca


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSComboBox in NSTableView behaving strangely

2011-07-06 Thread Devarshi Kulshreshtha
same problem exists in NSPopUpButtonCell, it is changing the value in list
which appears on clicking it, as shown -

Original list: http://dl.dropbox.com/u/259/unique%20data.png

Changed list: http://dl.dropbox.com/u/259/redundant%20data.png

Bindings used in case of NSPopUpButtonCell are:

TableColumn with NSPopUpButtonCell -

Value Selection : Selected Value bind to -> Transactions, Controller
Key -> arrangedObjects,
Model Key Path -> relatedEntity.name

NSPopUpButtonCell

Value Selection : Content Values Bind to: Entities, Controller Key ->
arrangedObjects,
Model Key Path -> name

Note: code can be found here -
http://dl.dropbox.com/u/259/TableWithComboBoxExperi.zip

On Wed, Jul 6, 2011 at 11:44 AM, Quincey Morris  wrote:

> On Jul 5, 2011, at 04:11, Devarshi Kulshreshtha wrote:
>
> > When I am selecting a value in dropdown list of combobox cell, it is
> > changing the value of previously selected value to newly selected value,
> as
> > shown in below figure(s) -
>
> A combo box is a kind of text field, not a kind of menu, so yes it's going
> to edit the property that it's bound to.
>
> Use a NSPopUpButton instead.
>
>
>


-- 
Thanks,

Devarshi
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox in NSTableView behaving strangely

2011-07-05 Thread Quincey Morris
On Jul 5, 2011, at 04:11, Devarshi Kulshreshtha wrote:

> When I am selecting a value in dropdown list of combobox cell, it is
> changing the value of previously selected value to newly selected value, as
> shown in below figure(s) -

A combo box is a kind of text field, not a kind of menu, so yes it's going to 
edit the property that it's bound to.

Use a NSPopUpButton instead.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox bound to NSMutableArray of NSMutableDictionary with NSArrayController?

2010-10-07 Thread Laurent Daudelin
On Oct 7, 2010, at 15:30, Quincey Morris wrote:

> On Oct 7, 2010, at 15:14, Laurent Daudelin wrote:
> 
>> I just want to have a pre-determined list of items but I'd like the user to 
>> have the ability to add new items. That's why I chose the NSComboBox but I 
>> see one problem with it. If the user adds one item, that's only a string and 
>> it won't be a dictionary. I might have to use a datasource instead.
> 
> You could certainly bind the combo box's "value" binding to a string property 
> in your data model, whose setter created a new dictionary when necessary. I'm 
> not certain, though, how you'd be sure the user typed a new "Name" for the 
> purpose of creating a new dictionary or just mistyped an existing one.
> 
> Alternatively, use a pop up menu instead, with a "New XXX..." entry as well 
> as the existing names. That's a more traditional way of doing it, which has 
> the benefit of discoverability for the creation function (unlike the combo 
> box solution).

Yeah, perhaps that's what I will do. Thanks, Quincey.

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://www.nemesys-soft.com/
Logiciels Nemesys Software  
laur...@nemesys-soft.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox bound to NSMutableArray of NSMutableDictionary with NSArrayController?

2010-10-07 Thread Quincey Morris
On Oct 7, 2010, at 15:14, Laurent Daudelin wrote:

>  I just want to have a pre-determined list of items but I'd like the user to 
> have the ability to add new items. That's why I chose the NSComboBox but I 
> see one problem with it. If the user adds one item, that's only a string and 
> it won't be a dictionary. I might have to use a datasource instead.

You could certainly bind the combo box's "value" binding to a string property 
in your data model, whose setter created a new dictionary when necessary. I'm 
not certain, though, how you'd be sure the user typed a new "Name" for the 
purpose of creating a new dictionary or just mistyped an existing one.

Alternatively, use a pop up menu instead, with a "New XXX..." entry as well as 
the existing names. That's a more traditional way of doing it, which has the 
benefit of discoverability for the creation function (unlike the combo box 
solution).


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox bound to NSMutableArray of NSMutableDictionary with NSArrayController?

2010-10-07 Thread Laurent Daudelin
Doesn't display anything means it doesn't show up anything from the array. I'll 
think about it. I just want to have a pre-determined list of items but I'd like 
the user to have the ability to add new items. That's why I chose the 
NSComboBox but I see one problem with it. If the user adds one item, that's 
only a string and it won't be a dictionary. I might have to use a datasource 
instead.

Thanks for the comments, Quincey.

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://www.nemesys-soft.com/
Logiciels Nemesys Software  
laur...@nemesys-soft.com

On Oct 7, 2010, at 13:05, Quincey Morris wrote:

> On Oct 7, 2010, at 12:32, Laurent Daudelin wrote:
> 
>> My NSMutableDictionary keys are Name and Service. I bound the 
>> NSArrayController to my NSMutableArray ivar. I then set my NSComboBox 
>> content to NSArrayController.arrangedObjects and NSComboBox content values 
>> to NSArrayController.arrangedObjects.Name but the NSComboBox doesn't display 
>> anything and I don't get any error in the console.
>> 
>> So, can I provide an array of NSMutableDictionary or does it have to be an 
>> array of NSString?
> 
> What does "doesn't display anything" mean? Are you saying that the text field 
> portion of the combo box has nothing in it, or that the popup list isn't 
> populated with anything, or both?
> 
> You need to find out whether the problem is in NSComboBox, the bindings, 
> NSArrayController or KVO compliance. The easiest way to solve this is to 
> break it down. Try (temporarily) creating a table view that display the 
> strings in NSArrayController.arrangedObjects.Name, for example. Or try 
> binding your array controller to a simple array of strings, leaving 
> contentValues unbound initially.
> 
> Incidentally, I just want to check that you're aware that a combo box isn't 
> going to function like a menu? It's not going to provide a way to *choose* 
> one of the dictionaries from your array.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox bound to NSMutableArray of NSMutableDictionary with NSArrayController?

2010-10-07 Thread Quincey Morris
On Oct 7, 2010, at 12:32, Laurent Daudelin wrote:

> My NSMutableDictionary keys are Name and Service. I bound the 
> NSArrayController to my NSMutableArray ivar. I then set my NSComboBox content 
> to NSArrayController.arrangedObjects and NSComboBox content values to 
> NSArrayController.arrangedObjects.Name but the NSComboBox doesn't display 
> anything and I don't get any error in the console.
> 
> So, can I provide an array of NSMutableDictionary or does it have to be an 
> array of NSString?

What does "doesn't display anything" mean? Are you saying that the text field 
portion of the combo box has nothing in it, or that the popup list isn't 
populated with anything, or both?

You need to find out whether the problem is in NSComboBox, the bindings, 
NSArrayController or KVO compliance. The easiest way to solve this is to break 
it down. Try (temporarily) creating a table view that display the strings in 
NSArrayController.arrangedObjects.Name, for example. Or try binding your array 
controller to a simple array of strings, leaving contentValues unbound 
initially.

Incidentally, I just want to check that you're aware that a combo box isn't 
going to function like a menu? It's not going to provide a way to *choose* one 
of the dictionaries from your array.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox problem in 10.6.2

2010-03-19 Thread Jim Correia
On Mar 19, 2010, at 3:21 PM, H. Miersch wrote:

> just had another surprise: i inserted NSLogs into the method that initializes 
> the array and into -numberOfItemsInComboBox, trying to see the contents of my 
> array and find out why -numberOfItemsInComboBox returns zero. the surprise 
> was that -numberOfItemsInComboBox is called BEFORE the method that 
> initializes the array. then i commented the line that sends 
> -selectItemAtIndex to the combobox, and the combobox worked normally. 
> 
> now the question is, why is -numberOfItemsInComboBox called first when the 
> first call in awakeFromNib is to the initialisation method? weird...
> 
> -awakeFromNib {
>   init array;
>   [combobox selectItemAtIndex:0];   // if this line is turned into a 
> comment, it works normally.
>   [combobox2 selectItemAtIndex:2];
>   [combobox3 selectItemAtIndex:0];
>   register for notifications from combobox;
> }

You are setting up your array in your -awakeFromNib.

You cannot control (or know) the order in which -awakeFromNib will be sent to 
objects in your nib. The combo box may be awoken long before you.

But more to the point, your contract with the combo box as its data source is 
that you will send it -noteNumberOfItemsChanged or -reloadData whenever you 
change the data in the data source.

You became the data source for the combo box during nib unarchiving, changed 
the number of items in the model after nib unarchiving, and didn’t inform the 
combo box about that change. Sending the combo box the appropriate method after 
initializing your data source should fix the problem.

Jim

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox problem in 10.6.2

2010-03-19 Thread Kyle Sluder
On Fri, Mar 19, 2010 at 12:21 PM, H. Miersch  wrote:
> just had another surprise: i inserted NSLogs into the method that initializes 
> the array and into -numberOfItemsInComboBox, trying to see the contents of my 
> array and find out why -numberOfItemsInComboBox returns zero. the surprise 
> was that -numberOfItemsInComboBox is called BEFORE the method that 
> initializes the array. then i commented the line that sends 
> -selectItemAtIndex to the combobox, and the combobox worked normally.

You would do yourself well to use the debugger rather than spam your
source code with NSLog statements.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox problem in 10.6.2

2010-03-19 Thread H. Miersch
just had another surprise: i inserted NSLogs into the method that initializes 
the array and into -numberOfItemsInComboBox, trying to see the contents of my 
array and find out why -numberOfItemsInComboBox returns zero. the surprise was 
that -numberOfItemsInComboBox is called BEFORE the method that initializes the 
array. then i commented the line that sends -selectItemAtIndex to the combobox, 
and the combobox worked normally. 

now the question is, why is -numberOfItemsInComboBox called first when the 
first call in awakeFromNib is to the initialisation method? weird...

-awakeFromNib {
init array;
[combobox selectItemAtIndex:0];   // if this line is turned into a 
comment, it works normally.
[combobox2 selectItemAtIndex:2];
[combobox3 selectItemAtIndex:0];
register for notifications from combobox;
}

not exactly objective-c, but i think you get the 
idea.___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox problem in 10.6.2

2010-03-19 Thread Bill Hernandez

On Mar 19, 2010, at 8:45 AM, H. Miersch wrote:

> My theory is that there's something wrong with the array. Either it isn't 
> initialized properly or the methods can't access it or something. Gonna try 
> self.symbols instead of symbols, see if that changes anything...

Another thing I forgot to ask : are you using C or Cocoa arrays ?

I kept running into some crashes, and traced them back to where I was using C 
arrays. I converted them to Cocoa arrays and everything got solved, the 
problems went away.

I don't know if this has anything to do with your problems, but it was just 
something I ran into.

Bill Hernandez
Plano, Texas___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox problem in 10.6.2

2010-03-19 Thread Bill Hernandez
H. Miersch wrote,

>> uncaught exception 'NSRangeException', reason: '*** -[NSCFArray 
>> objectAtIndex:]: index (-1 (or possibly larger)) beyond bounds (5)'

I was running into something similar this morning, and I traced it back to the 
fact that I had set the type of a variable to NSUInteger, and the return value, 
when I lloked up the class docs, was actually NSInteger.

Something like :

NSUInteger rowIndex = [tableView selectedRow];

forgot to include this earlier, should have been : 

NSInteger rowIndex = [tableView selectedRow];

and when I traced through using the debugger I found the mismatch.

I don't know if you might be having the same problem, but you might take a 
quick look...

Best of luck,

Bill Hernandez
Plano, Texas___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox problem in 10.6.2

2010-03-19 Thread Bill Hernandez

On Mar 19, 2010, at 7:31 AM, Jim Correia wrote:

>> uncaught exception 'NSRangeException', reason: '*** -[NSCFArray 
>> objectAtIndex:]: index (-1 (or possibly larger)) beyond bounds (5)'


I was running into something similar this morning, and I traced it back to the 
fact that I had set the type of a variable to NSUInteger, and the return value, 
when I lloked up the class docs, was actually NSInteger

Something like 

NSUInteger rowIndex = [tableView selectedRow];

and when I traced through using the debugger I found the mismatch.

 I don't know if you might be having the same problem, but you might take a 
quick look...

Best of luck,

Bill Hernandez
Plano, Texas___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox problem in 10.6.2

2010-03-19 Thread H. Miersch
Did you try sending -reloadData to the combo box after setting up  
the data source and before trying to access items in the combo box?


No, because I set up the data source in IB.
My theory is that there's something wrong with the array. Either it  
isn't initialized properly or the methods can't access it or  
something. Gonna try self.symbols instead of symbols, see if that  
changes anything...

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox problem in 10.6.2

2010-03-19 Thread Jeremy Pereira

On 19 Mar 2010, at 12:45, H. Miersch wrote:

>> 
>> It appears you are sending -selectItemAtIndex: to the combo box,
> 
> Correct. I tell it to select the first item (index 0). And when I put the 
> list if items in the nib file (no data source) it works.
> 
> But this morning I quickly inserted an nslog to find out how big the symbols 
> array is, and it reported zero. Now the question is, why does the count come 
> back as zero? Looks like I have some investigation to do. Good thing the 
> weekend is just around the corner...

Did you try sending -reloadData to the combo box after setting up the data 
source and before trying to access items in the combo box?  


> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/adc%40jeremyp.net
> 
> This email sent to a...@jeremyp.net

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox problem in 10.6.2

2010-03-19 Thread H. Miersch


It appears you are sending -selectItemAtIndex: to the combo box,


Correct. I tell it to select the first item (index 0). And when I put  
the list if items in the nib file (no data source) it works.


But this morning I quickly inserted an nslog to find out how big the  
symbols array is, and it reported zero. Now the question is, why does  
the count come back as zero? Looks like I have some investigation to  
do. Good thing the weekend is just around the corner...

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox problem in 10.6.2

2010-03-19 Thread Jim Correia
On Mar 18, 2010, at 3:38 PM, H. Miersch wrote:

> when i try to launch the app from within xcode, the console shows the 
> following:
> 
> 2010-03-18 19:26:28.515 StoX[63999:a0f] An uncaught exception was raised
> 2010-03-18 19:26:28.534 StoX[63999:a0f] *** -[NSCFArray objectAtIndex:]: 
> index (-1 (or possibly larger)) beyond bounds (5)
> 2010-03-18 19:26:28.596 StoX[63999:a0f] *** Terminating app due to uncaught 
> exception 'NSRangeException', reason: '*** -[NSCFArray objectAtIndex:]: index 
> (-1 (or possibly larger)) beyond bounds (5)'
> *** Call stack at first throw:
> (
>   0   CoreFoundation  0x7fff87ddb444 
> __exceptionPreprocess + 180
>   1   libobjc.A.dylib 0x7fff800470f3 
> objc_exception_throw + 45
>   2   CoreFoundation  0x7fff87ddb267 
> +[NSException raise:format:arguments:] + 103
>   3   CoreFoundation  0x7fff87ddb1f4 
> +[NSException raise:format:] + 148
>   4   Foundation  0x7fff8798e080 
> _NSArrayRaiseBoundException + 122
>   5   Foundation  0x7fff878f0b81 -[NSCFArray 
> objectAtIndex:] + 75
>   6   AppKit  0x7fff80ba2012 
> -[NSComboBoxCell selectItemAtIndex:] + 191
>   7   StoX0x00011693 
> -[AppController awakeFromNib] + 50

This is the interesting frame

>   8   CoreFoundation  0x7fff87d8a82d -[NSSet 
> makeObjectsPerformSelector:] + 205
>   9   AppKit  0x7fff8086c913 
> -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 1445
>   10  AppKit  0x7fff8086ab49 loadNib + 226
>   11  AppKit  0x7fff8086a059 
> +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 248
>   12  AppKit  0x7fff80869e91 
> +[NSBundle(NSNibLoading) loadNibNamed:owner:] + 326
>   13  AppKit  0x7fff80867413 
> NSApplicationMain + 279
>   14  StoX0x000115a8 start + 52
> )
> terminate called after throwing an instance of 'NSException'
> 
> i've checked that i'm using the types that the docs say i should be using, 
> but i don't understand why index comes back as -1. 
> 
> am i doing something wrong? should I be doing something i'm not doing? is the 
> documentation wrong? is there a bug somewhere?

Look at your code in awakeFromNib. It appears you are ending 
-selectItemAtIndex: to the combo box, and the index is out of bounds.

- Jim

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox problem in 10.6.2

2010-03-18 Thread Scott Anguish
what does the symbols array contain? are you sure it’s the length you think it 
is? and what is index? It says −1 or possibly larger.


On Mar 18, 2010, at 3:38 PM, H. Miersch wrote:

> hi.
> I have a window with 3 comboboxes. one of them uses a data source. the 
> problem is that it keeps throwing an exception, and i can't find out why. 
> I've put the following methods in my appcontroller:
> 
> -(NSInteger)numberOfItemsInComboBox:(NSComboBox *)aComboBox {
>   return (NSInteger)[symbols count];
> }
> 
> -(id)comboBox:(NSComboBox *)sender objectValueForItemAtIndex:(NSInteger)index 
> {
>   return [symbols objectAtIndex:index];
> }
> 
> symbols is an NSMutableArray which can contain any number of NSStrings (I 
> initialize it with 5 NSStrings)
> 
> when i try to launch the app from within xcode, the console shows the 
> following:
> 
> 2010-03-18 19:26:28.515 StoX[63999:a0f] An uncaught exception was raised
> 2010-03-18 19:26:28.534 StoX[63999:a0f] *** -[NSCFArray objectAtIndex:]: 
> index (-1 (or possibly larger)) beyond bounds (5)
> 2010-03-18 19:26:28.596 StoX[63999:a0f] *** Terminating app due to uncaught 
> exception 'NSRangeException', reason: '*** -[NSCFArray objectAtIndex:]: index 
> (-1 (or possibly larger)) beyond bounds (5)'
> *** Call stack at first throw:
> (
>   0   CoreFoundation  0x7fff87ddb444 
> __exceptionPreprocess + 180
>   1   libobjc.A.dylib 0x7fff800470f3 
> objc_exception_throw + 45
>   2   CoreFoundation  0x7fff87ddb267 
> +[NSException raise:format:arguments:] + 103
>   3   CoreFoundation  0x7fff87ddb1f4 
> +[NSException raise:format:] + 148
>   4   Foundation  0x7fff8798e080 
> _NSArrayRaiseBoundException + 122
>   5   Foundation  0x7fff878f0b81 -[NSCFArray 
> objectAtIndex:] + 75
>   6   AppKit  0x7fff80ba2012 
> -[NSComboBoxCell selectItemAtIndex:] + 191
>   7   StoX0x00011693 
> -[AppController awakeFromNib] + 50
>   8   CoreFoundation  0x7fff87d8a82d -[NSSet 
> makeObjectsPerformSelector:] + 205
>   9   AppKit  0x7fff8086c913 
> -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 1445
>   10  AppKit  0x7fff8086ab49 loadNib + 226
>   11  AppKit  0x7fff8086a059 
> +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 248
>   12  AppKit  0x7fff80869e91 
> +[NSBundle(NSNibLoading) loadNibNamed:owner:] + 326
>   13  AppKit  0x7fff80867413 
> NSApplicationMain + 279
>   14  StoX0x000115a8 start + 52
> )
> terminate called after throwing an instance of 'NSException'
> 
> i've checked that i'm using the types that the docs say i should be using, 
> but i don't understand why index comes back as -1. 
> 
> am i doing something wrong? should I be doing something i'm not doing? is the 
> documentation wrong? is there a bug 
> somewhere?___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/scott%40cocoadoc.com
> 
> This email sent to sc...@cocoadoc.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox Bindings

2009-02-26 Thread Jerry Krinock


On 2009 Feb 26, at 12:26, Walker Argendeli wrote:

*** -[NSCFString managedObjectContext]: unrecognized selector sent  
to instance 0x19a410


This log is telling you that Cocoa is getting a string returned when  
it expected a managed object.  Study the problem with this clue in mind.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox Bindings

2009-02-26 Thread Walker Argendeli
I bound NSComboBox's value to Item.arrangedObjects.kind, and the  
console logs this when I try to modify the kind in my app:
*** -[NSCFString managedObjectContext]: unrecognized selector sent to  
instance 0x19a410


One suggestion I've received is to subclass it.  Any further ideas?

FROM : Jerry Krinock
DATE : Thu Feb 26 14:25:18 2009

On 2009 Feb 25, at 17:08, Walker Argendeli wrote:

> With an NSPopUpButton, you can bind content to Kind.arrangedObjects,
> content values to Kind.arrangedObjects.title, and selected object to
> Item.kind.  I want the functionality of an NSComboBox, however,
> which only has content and content values.  There's no selected
> object.  What could I bind to to get this working?


Possibly the 'value' binding.

Also, add the Cocoa Bindings Reference to your bookmarks:

http://developer.apple.com/documentation/Cocoa/Reference/CocoaBindingsRef/BindingsText/NSComboBox.html#/
/apple_ref/doc/uid/NSComboBox-DontLinkElementID_779
- Walker Argendeli

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox Bindings

2009-02-26 Thread Jerry Krinock


On 2009 Feb 25, at 17:08, Walker Argendeli wrote:

With an NSPopUpButton, you can bind content to Kind.arrangedObjects,  
content values to Kind.arrangedObjects.title, and selected object to  
Item.kind.  I want the functionality of an NSComboBox, however,  
which only has content and content values.  There's no selected  
object.  What could I bind to to get this working?


Possibly the 'value' binding.

Also, add the Cocoa Bindings Reference to your bookmarks:

http://developer.apple.com/documentation/Cocoa/Reference/CocoaBindingsRef/BindingsText/NSComboBox.html#/ 
/apple_ref/doc/uid/NSComboBox-DontLinkElementID_779


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSComboBox list is incorrect size on first dropdown

2008-11-25 Thread Ken Ferry
I think you would like to hear that this delegate call can be forced  
to work, but wishing won't make it so.


There are any number if ways to do it earlier, most of which are only  
known to you since you know your app design. You could keep the combo  
box up to date, you could use a datasource and invalidate the combo  
box data when the data changes which would be cheap even if common,  
you could override a mouse down method, you could bind the combo box  
-- I don't know your app. Just not as late as this delegate method.


-Ken

On Nov 25, 2008, at 9:35 AM, Russ <[EMAIL PROTECTED]> wrote:

Ha ha, pretty funny. As if I even had a NIB. The items in the list  
are the names of objects the user has created, so it changes all the  
time, including with each undo and redo. So I load it when it pops  
up. Anything else?




- Original Message 
From: Ken Ferry <[EMAIL PROTECTED]>
To: Russ <[EMAIL PROTECTED]>
Sent: Tuesday, November 25, 2008 12:11:21 PM
Subject: Re: NSComboBox list is incorrect size on first dropdown

The workaround would be to do the work less lazily, like at - 
awakeFromNib time.


-Ken

On Nov 25, 2008, at 8:30 AM, Russ <[EMAIL PROTECTED]> wrote:

I'm assuming you have replicated this now with a test case? (in  
which case I'll skip assembling the  example).


Is there any workaround? Switching to data source maybe? This is a  
64-bit version of a commercial app being prepped, I'm hoping to get  
to beta very soon and maybe release before the end of this year. I  
don't want to have to place a Snow-only label on it, bad for my  
sales. If necessary I'll make it a known issue, but it's a little  
silly. Thanks.





- Original Message 
From: Ken Ferry <[EMAIL PROTECTED]>
To: Russ <[EMAIL PROTECTED]>
Cc: cocoa-dev@lists.apple.com
Sent: Tuesday, November 25, 2008 11:01:18 AM
Subject: Re: NSComboBox list is incorrect size on first dropdown

Um, nevermind, wrong OS for the fix.  Heh heh!

This will be fixed in 10.6.  In 10.5 and earlier, that's just too  
late, sorry!


-Ken

On Tue, Nov 25, 2008 at 7:54 AM, Ken Ferry <[EMAIL PROTECTED]>  
wrote:

I cannot reproduce this in a test app.  The behavior was changed for
10.5 - before that comboBoxWillPopUp was too late to modify anything
impacting the drop down position of the combo box.

What OS are you on?

If you could file a bug with a test app, that would be very helpful.

-Ken
Cocoa Frameworks

On Tue, Nov 25, 2008 at 7:31 AM, Russ <[EMAIL PROTECTED]> wrote:


I have an NSComboBox whose contents (internal list) gets loaded  
dynamically during the comboBoxWillPopUp notification. It is  
created with setNumberOfVisibleItems:9 and  
setHasVerticalScroller:YES. The first time the button is clicked,  
there is a removeAllItems and then the items are loaded in (over  
100 of them) but the drop-down list that appears is only a single  
item tall and the scrollbar area is present, but plain gray with  
no scrollbar. All the items are present --- you can click inside  
the dropdown and then drag up or down to scroll through the list  
--- but you wouldn't know this from the single-item-high dropdown  
and disabled scrollbar. If one of the items is selected, that is  
the one shown in the single-line-high dropdown area. I can read  
back numberOfVisibleItems and hasVerticalScroller and they are  
correct, but what appears does not reflect these values.


The SECOND time you click the button, the dropdown comes up the  
proper height and the scrollbar is present and active.


I've tried a bunch of things inside the notification routine to  
try to convince it to do the right thing during the first  
dropdown -- calling noteNumberOfItemsChanged, re-calling  
setNumberOfVisibleItems and setHasVerticalScroller but with no  
effect.


How can I convince NSComboBox to do the right thing? Thanks




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the  
list.

Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com

This email sent to [EMAIL PROTECTED]














___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: NSComboBox list is incorrect size on first dropdown

2008-11-25 Thread Ken Ferry
Um, nevermind, wrong OS for the fix.  Heh heh!

This will be fixed in 10.6.  In 10.5 and earlier, that's just too late, sorry!

-Ken

On Tue, Nov 25, 2008 at 7:54 AM, Ken Ferry <[EMAIL PROTECTED]> wrote:
> I cannot reproduce this in a test app.  The behavior was changed for
> 10.5 - before that comboBoxWillPopUp was too late to modify anything
> impacting the drop down position of the combo box.
>
> What OS are you on?
>
> If you could file a bug with a test app, that would be very helpful.
>
> -Ken
> Cocoa Frameworks
>
> On Tue, Nov 25, 2008 at 7:31 AM, Russ <[EMAIL PROTECTED]> wrote:
>>
>> I have an NSComboBox whose contents (internal list) gets loaded dynamically 
>> during the comboBoxWillPopUp notification. It is created with 
>> setNumberOfVisibleItems:9 and setHasVerticalScroller:YES. The first time the 
>> button is clicked, there is a removeAllItems and then the items are loaded 
>> in (over 100 of them) but the drop-down list that appears is only a single 
>> item tall and the scrollbar area is present, but plain gray with no 
>> scrollbar. All the items are present --- you can click inside the dropdown 
>> and then drag up or down to scroll through the list --- but you wouldn't 
>> know this from the single-item-high dropdown and disabled scrollbar. If one 
>> of the items is selected, that is the one shown in the single-line-high 
>> dropdown area. I can read back numberOfVisibleItems and hasVerticalScroller 
>> and they are correct, but what appears does not reflect these values.
>>
>> The SECOND time you click the button, the dropdown comes up the proper 
>> height and the scrollbar is present and active.
>>
>> I've tried a bunch of things inside the notification routine to try to 
>> convince it to do the right thing during the first dropdown -- calling 
>> noteNumberOfItemsChanged, re-calling setNumberOfVisibleItems and 
>> setHasVerticalScroller but with no effect.
>>
>> How can I convince NSComboBox to do the right thing? Thanks
>>
>>
>>
>>
>> ___
>>
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com
>>
>> This email sent to [EMAIL PROTECTED]
>>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: NSComboBox list is incorrect size on first dropdown

2008-11-25 Thread Ken Ferry
I cannot reproduce this in a test app.  The behavior was changed for
10.5 - before that comboBoxWillPopUp was too late to modify anything
impacting the drop down position of the combo box.

What OS are you on?

If you could file a bug with a test app, that would be very helpful.

-Ken
Cocoa Frameworks

On Tue, Nov 25, 2008 at 7:31 AM, Russ <[EMAIL PROTECTED]> wrote:
>
> I have an NSComboBox whose contents (internal list) gets loaded dynamically 
> during the comboBoxWillPopUp notification. It is created with 
> setNumberOfVisibleItems:9 and setHasVerticalScroller:YES. The first time the 
> button is clicked, there is a removeAllItems and then the items are loaded in 
> (over 100 of them) but the drop-down list that appears is only a single item 
> tall and the scrollbar area is present, but plain gray with no scrollbar. All 
> the items are present --- you can click inside the dropdown and then drag up 
> or down to scroll through the list --- but you wouldn't know this from the 
> single-item-high dropdown and disabled scrollbar. If one of the items is 
> selected, that is the one shown in the single-line-high dropdown area. I can 
> read back numberOfVisibleItems and hasVerticalScroller and they are correct, 
> but what appears does not reflect these values.
>
> The SECOND time you click the button, the dropdown comes up the proper height 
> and the scrollbar is present and active.
>
> I've tried a bunch of things inside the notification routine to try to 
> convince it to do the right thing during the first dropdown -- calling 
> noteNumberOfItemsChanged, re-calling setNumberOfVisibleItems and 
> setHasVerticalScroller but with no effect.
>
> How can I convince NSComboBox to do the right thing? Thanks
>
>
>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com
>
> This email sent to [EMAIL PROTECTED]
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: NSComboBox select change

2008-10-16 Thread I. Savant

On Oct 16, 2008, at 2:07 AM, Joseph Yu wrote:


When the combobox change the selection,I want to do something.

How to do this?

I didn't see any callback function.


  Have you searched/read the documentation? This is considered "Cocoa  
Fundamentals":


http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CommunicatingWithObjects/chapter_6_section_5.html

--
I.S.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: NSComboBox, bindings, and auto-complete, oh my!

2008-10-13 Thread Quincey Morris

On Oct 13, 2008, at 08:19, Randall Meadows wrote:

I'm helping someone with a problem concerning NSComboBox whose  
contents come from a binding to an NSArrayController, and is set to  
autocomplete.


The behavior: Window opens with combobox populated from its  
binding.  Let's say the contents are


Doe
Jones
Smith

and the textfield contains "Jones".  If we start typing "Smi" it  
correctly autocompletes to "Smith".  HOWEVER, it doesn't *select*  
the item "Smith", it *edits* the current selection to be "Smith", so  
that the list then ends up as


Doe
Smith
Smith

Currently, there is no custom code behind this, it's all set up via  
IB.  Do we need to implement a custom -completedString:, and a  
custom IB action that selects the list item that satisfies the  
completion?  Or what?


Your problem is that NSComboBox is a kind of text field, not a kind of  
menu. Thus, typing "Smith" (regardless of whether you type it all or  
let it autocomplete) changes the value of what the control is bound to  
(selection.lastName) from "Jones" to "Smith". The behavior is the same  
as if you had used a NSTextField instead of a NSComboBox.


You can get the effect you want by binding the combo box to a  
transient text property, and writing an IBAction to find the array  
item that matches what was typed (if any).



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]