Re: NSComboBox
> 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
>> 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
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: 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
Re: NSComboBox
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
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
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
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
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
> 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
> 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
NSComboBox
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? BTW our current Carbon app does something similar with a text field and popup. The design came from from an article in Dev Connect by Bruce Tognazzini back in the late 80s. He called it a "disambiguating field". I'm surprised NSComboBox doesn't just have a Boolean to do what we want. Thanks, Casey McDermott Turtle Creek Software http://www.turtlesoft.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