I’m working on an app that allows the user to add tags to selected records. To facilitate this, I will show all existing tags as entries in a combobox. The user can then select among the existing tags or create a new one by typing in the box. To facilitate selecting among the tags, I want to put a checkbox next to each entry in the tag list, and only the checked tags would be added to the records.
The checkbox doesn’t have to be anything fancy. In fact, a two-column table in the combobox would be fine. Each row in the table would be a tag, and the first column would be for checking the tag, with the second column displaying the tag itself.
Does anyone have suggestions on how to implement this?
A combobox is a type of text field – it’s just for entering text. You can’t add checkboxes to one.
OK, thanks.
But the kind of application I’m describing – a list of items with adjacent checkboxes – is very, very common. Think shopping lists, to-do lists, or any other kind of selection from a list.
Is there any way in ApplescriptObjC & XCode to implement such lists without reinventing the entire wheel?
Right – that’s a table view.
Ah, but AFAIK unlike a table view, a combobox allows the user to add entries to the table.
Is there a way to make an ordinary table do this?
Sure. You can use a button to add an entry.
A combobox is not a table.
Forgive me as I have never done this before. I am having trouble envisioning how to use this approach to make a user-friendly, reasonably elegant form for adding tags to records. Let’s assume the user has several hundred tags, each one taking up one row in our table. I see the following as issues:
-
Obviously we don’t want a table several hundred lines long on the form. At a minimum, we want to show perhaps 5-10 rows and allow the user to scroll through the tags and pick the ones to use.
-
It would be even better for the user to be able to enter some text and have the app search for the tag(s) with the same initial letters. As I understand it, combo boxes can do this.
-
The table itself needs at least two columns, one for the user to select tags or not, and one to have the text (name) of the tag itself. For example, |(checkbox)| “AppleScipt” |. Ideally, Column 1 (for the checkbox) would have an actual, 1-click control to indicate use this tag or not. I suppose one could say any character in Column 1 counts as a check, but I’d much rather see a check mark appearing on the screen.
-
There needs to be an easy way for the user to add tags to the list. Combo boxes do this automatically. I suppose I could add a text box and allow the user to input comma-delimited tags, with the newly added tags being added to the larger list.
-
It would be really nice to have a text field above the table so that as the user checks tags on or off the list, the text field displays a string of text indicating what tag fields are being used.
When you say adding tags to records, how are the records presented?
The app will copy email messages from Apple’s Mail app to Evernote. So the email messages are the records. In Mail the user selects the messages to copy, and in my app the user selects various options, including what, if any, tags to add to the messages.
OK, well one possibility is to use a combobox, but each time the user hits return, you add the contents of the combobox into another text field, followed by some delimiter.
Another method is to use a token field, which is also a type of text field. But it’s fairly complex to use.
It often helps if you can find something that does what you want in another app.
Your suggestion to use a combobox & text field seems workable. But what happens if a user has a change of mind and decides not to use a tag?
Do they edit the text field manually?
Yes. I don’t see any way around that.