Tuesday, December 12, 2017

#1 2015-08-28 08:47:08 pm

Swampman
Member
Registered: 2014-06-13
Posts: 11

Combining Check and Combo boxes

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?

Offline

 

#2 2015-08-28 09:07:44 pm

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 5199

Re: Combining Check and Combo boxes

A combobox is a type of text field -- it's just for entering text. You can't add checkboxes to one.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/

Offline

 

#3 2015-08-31 12:01:01 pm

Swampman
Member
Registered: 2014-06-13
Posts: 11

Re: Combining Check and Combo boxes

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?

Offline

 

#4 2015-08-31 06:23:08 pm

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 5199

Re: Combining Check and Combo boxes

Swampman wrote:

But the kind of application I'm describing -- a list of items with adjacent checkboxes -- is very, very common.


Right -- that's a table view.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/

Offline

 

#5 2015-09-01 09:22:57 am

Swampman
Member
Registered: 2014-06-13
Posts: 11

Re: Combining Check and Combo boxes

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?

Offline

 

#6 2015-09-01 06:25:40 pm

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 5199

Re: Combining Check and Combo boxes

Swampman wrote:

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.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/

Offline

 

#7 2015-09-02 12:18:55 am

Swampman
Member
Registered: 2014-06-13
Posts: 11

Re: Combining Check and Combo boxes

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:

1. 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.

2. 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.

3. 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.

4. 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.

5. 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.


Filed under: Tables

Offline

 

#8 2015-09-02 02:24:36 am

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 5199

Re: Combining Check and Combo boxes

When you say adding tags to records, how are the records presented?


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/

Offline

 

#9 2015-09-02 07:32:50 am

Swampman
Member
Registered: 2014-06-13
Posts: 11

Re: Combining Check and Combo boxes

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.

Last edited by Swampman (2015-09-02 07:36:15 am)

Offline

 

#10 2015-09-02 08:01:22 am

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 5199

Re: Combining Check and Combo boxes

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.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/

Offline

 

#11 2015-09-02 02:21:35 pm

Swampman
Member
Registered: 2014-06-13
Posts: 11

Re: Combining Check and Combo boxes

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?

Offline

 

#12 2015-09-02 05:53:28 pm

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 5199

Re: Combining Check and Combo boxes

Yes. I don't see any way around that.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)