How to create a slightly more advanced table dialog than MyriadTables allows

Hi Everyone,

I have been bounding all over the web to try and fix suggestions that Chat-GPT has given me on how to do the following:
Create a window with a 4 column table. The first 2 columns do not need to be editable. It would be nice if all 4 columns could auto adjust their width to match the data that is entered in them. Column 3 should be checkboxes with the ability to turn all the checkboxes on and off from the header. Column 4 should be editable text for 2 digit numbers, so it does not need to be a wide column. There should also either be a way to zero out all the data in the 4th column from the header, or a 3rd button should be added to the window to zero out the column.

Obviously I can get about 90% of the way there with Myriad Tables, but there is no way that I have found to make it so I could check all the checkboxes AND zero out all the data on the 4th column. To do that with Myriad Tables I would need to have a 4th button, and as far as I can tell, MT only allows for 3 total buttons (OK, Canel and 1 extra button).

I have been approaching this as I would need to write the table 100% from scratch using ASObjC, which if I were to think about it really really hard, I could probably write my complete knowledge of on the head of a pin! So as I have stated at the beginning, I turned to Chat-GPT and have gotten nothing that comes close to what I need, before it starts outputting code that won’t run (if I am lucky enough to compile it in the first place).

I can post the code that I have written for MT if people want to see that, or I can post the unworking code that Chat-GPT has given me. Not sure what is more helpful.
but so far have come up empty. I can post the non-working Chat-GPT code if you would like, but I was hoping there was a

I think what you want here is Shane Stanley’s Dialog Toolkit Plus to work with Myriad Tables.

And in Myriad Tables you want to use the accessory view feature. It gets complicated but there are good examples as to what you can do.

Basically Dialog Toolkit Plus can be used to learn to write accessory views, and then those can be added to Myriad Tables. If you look through all the sample scripts that came with Myriad Tables you’ll find a few using the Accessory View feature. Including one that dynamically changes things the way you want.

Here’s one on the Script Debugger Forum (which I also reccommend and where you’ll find Shane very active)

I’ve got another script that shows how to build all the accessory views. I’ll see if I can find it.

Here it is:

use AppleScript version "2.4"
use scripting additions
use framework "Foundation"
use framework "Carbon"
use script "Dialog Toolkit Plus" version "1.1.2"
use script "Myriad Tables Lib" version "1.0.12"
use script "PrefsStorageLib" version "1.1.0"
use script "FileManagerLib" version "2.3.5"

property theAccessoryView : missing value
property accessoryViewResults : missing value

property theTop : 0
property theTableData : {}
property selectedViews : {}
property lastPosition : {}
property whichViews : {}
property viewPath : {}
set theTableData to {¬
   {"create image view", 40}, ¬
   {"create label", 17}, ¬
   {"create field", 23}, ¬
   {"create side labeled field", 22}, ¬
   {"create top labeled field", 47}, ¬
   {"create checkbox", 18}, ¬
   {"create labeled checkbox", 18}, ¬
   {"create matrix", 58}, ¬
   {"create labeled matrix", 58}, ¬
   {"create path control", 26}, ¬
   {"create labeled path control", 42}, ¬
   {"create popup", 26}, ¬
   {"create labeled popup", 26}, ¬
   {"create secure field", 22}, ¬
   {"create rule", 1} ¬
      }
PersistentVariables()

repeat
   set accessoryView to AssembleAccessoryViews(whichViews)
   set whichViews to DisplayTheTable(theTableData, theAccessoryView)
   StorePersistentValues()
end repeat

on DisplayTheTable(theTableData, the accessoryView)
   local tableResult
   if accessoryViewResults is not {} then
      set middleButtonName to "Display Results"
   else
      set middleButtonName to missing value
   end if
   set tablePrompt to ("Select the Accessory Views you want to see" & return & "Last top: " & theTop as text)
   set theTable to make new table with data theTableData ¬
      empty selection allowed true ¬
      with title ("Accessory View Demo") ¬
      with prompt tablePrompt ¬
      multiple selections allowed true ¬
      can add and delete true ¬
      editable columns {} ¬
      column headings {"Accessory View", "View Height"} ¬
      row numbering false ¬
      initially selected rows selectedViews ¬
      with double click means OK
   
   modify table theTable ¬
      OK button name ("Continue") ¬
      OK button is default true ¬
      extra button name middleButtonName ¬
      accessory view theAccessoryView ¬
      initial position lastPosition
   set theTop to 0
   set theAccessoryView to missing value -- to avoid error messages when saving
   set tableResult to display table theTable ¬
      with extended results
   tell tableResult
      set selectedValues to its values selected
      set selectedViews to its rows selected
      set lastPosition to items 1 thru 2 of its final position
      set whichButton to its button number
   end tell
   
   if accessoryViewResults is not {} and whichButton is 2 then
      set controlResults to {}
      
      repeat with thisAccessoryView in accessoryViewResults
         set {viewType, aControl} to thisAccessoryView as item
         if (aControl's isKindOfClass:(current application's NSTextField)) as boolean then
            
            set end of controlResults to {viewType, viewType & "'s stringValue()", aControl's stringValue() as text}
         else if (aControl's isKindOfClass:(current application's NSPopUpButton)) as boolean then
            set end of controlResults to {viewType, viewType & "'s titleOfSelectedItem()", aControl's titleOfSelectedItem() as text}
         else if (aControl's isKindOfClass:(current application's NSButton)) as boolean then
            set thisResult to aControl's state() as boolean
            if thisResult then
               set thisResult to "true" as text
            else
               set thisResult to "false" as text
            end if
            set end of controlResults to {viewType, viewType & "'s  state()", thisResult}
            
         else if (aControl's isKindOfClass:(current application's NSPathControl)) as boolean then
            set end of controlResults to {viewType, viewType & "'s  |URL|()'s |path|()", aControl's |URL|()'s |path|() as text}
         else if (aControl's isKindOfClass:(current application's NSMatrix)) as boolean then
            set end of controlResults to {viewType, viewType & "'s  title()", aControl's selectedCell()'s title() as text}
         else if (aControl's isKindOfClass:(current application's NSImageView)) as boolean then
            set end of controlResults to {viewType, viewType & "'s image()'s |name|()", aControl's image()'s |name|() as text}
         else -- NSBox 
            set end of controlResults to missing value
         end if
      end repeat
      
      --DisplayTableWithData
      set tableData to controlResults
      set tableTitle to ("Accessory View Results")
      set tablePrompt to ("These are the values of the accessory views shown")
      set multipleLinesAllowed to true --trueOrFalse ¬
      set multipleSelectionsAllowed to true --trueOrFalse
      set emptySelectionAllowed to true --trueOrFalse
      set canAddAndDelete to false --trueOrFalse
      set rowNumbering to true --trueOrFalse
      set editableColumns to {}
      set columnHeadings to {"View Variable", "View Ref", "TextValue"}
      set initiallySelectedRows to {}
      set doubleClickable to true --trueOrFalse
      
      try
         
         set tableResult to display table with data tableData ¬
            with title tableTitle ¬
            with prompt tablePrompt ¬
            multiple lines allowed multipleLinesAllowed ¬
            multiple selections allowed multipleSelectionsAllowed ¬
            empty selection allowed emptySelectionAllowed ¬
            can add and delete canAddAndDelete ¬
            row numbering rowNumbering ¬
            editable columns editableColumns ¬
            column headings columnHeadings ¬
            initially selected rows initiallySelectedRows ¬
            double click means OK doubleClickable
      on error errMsg number errNum
         errMsg
      end try
      
      set buttonNumber to button number of tableResult
      set finalPosition to final position of tableResult
      set selectedRows to rows selected of tableResult
      set timedOut to timed out of tableResult
      set valuesReturned to values returned of tableResult
      set resultsSelected to values selected of tableResult
   end if
   
   
   return selectedValues
end DisplayTheTable

on AssembleAccessoryViews(whichViews)
   local viewsList, accViewControls, AccViewLeft, AccViewBottom, AccViewWidth, AccViewTop, spacer
   local theLeft
   set accessoryViewResults to {}
   set viewsList to {}
   repeat with thisView in whichViews
      set the end of viewsList to item 1 of thisView as text
   end repeat
   set accViewControls to {}
   set AccViewLeft to 1
   set AccViewBottom to 1
   set AccViewWidth to 300
   set AccViewTop to 250
   
   set theBottom to AccViewBottom
   set theLeft to AccViewLeft
   set spacer to 1
   set maxWidth to AccViewWidth
   
   --create rule 
   if "create rule" is in viewsList then
      set {rule1, theTop} to create rule theBottom ¬
         left inset theLeft ¬
         rule width maxWidth
      set the end of accViewControls to rule1
      set theBottom to theTop + spacer
   end if
   
   --create field
   if "create field" is in viewsList then
      
      set enteredText to "Entered Text"
      set defaultText to "Default Text"
      set theWidth to maxWidth
      set extraHeight to spacer
      set acceptsTabs to true
      set fieldLeft to theLeft
      set {theField, theTop} to create field enteredText ¬
         placeholder text defaultText ¬
         left inset fieldLeft ¬
         bottom theBottom ¬
         field width theWidth ¬
         extra height extraHeight ¬
         with accepts linebreak and tab
      set theBottom to theTop + spacer
      set the end of accViewControls to theField
      set the end of accessoryViewResults to {"theField", theField}
      
   end if
   
   --create image view
   if "create image view" is in viewsList then
      set posixPath to POSIX path of viewPath
      set viewWidth to 40
      set viewHeight to 40
      set imageScale to scale to fit
      --   scales:    scale down proportionally, scale to fit, scale none, scale proportionally}
      set imageAlignment to bottom left aligned
      --   imageAlignments:   center aligned, top aligned, top left aligned, top right aligned
      --               left aligned, bottom left aligned, bottom right aligned, right aligned, bottom aligned
      
      set {theImage, theTop} to create image view posixPath ¬
         left inset theLeft ¬
         bottom theBottom ¬
         view width viewWidth ¬
         view height viewHeight ¬
         scale image imageScale ¬
         align image imageAlignment
      set theBottom to theTop + spacer
      set the end of accViewControls to theImage
      set the end of accessoryViewResults to {"theImage", theImage}
      
   end if
   
   --create label 
   if "create label" is in viewsList then
      set maxWidth to 280
      set wrapsBool to false
      set boldType to true
      set labelString to "LabelString:"
      set LabelLeft to 0
      set alignment to left aligned
      --    alignments:    left aligned, right aligned or center aligned
      set controlSize to regular size
      --   control sizes:   regular size,  mini size, small size,large size 
      
      set labelWidth to max width for labels {labelString} ¬
         control size controlSize ¬
         bold type boldType
      set labelDepth to max depth for label labelString ¬
         max width labelWidth ¬
         control size controlSize ¬
         bold type boldType
      
      set {theLabel, theTop} to create label labelString ¬
         left inset LabelLeft ¬
         bottom theBottom ¬
         max width maxWidth ¬
         aligns alignment ¬
         multiline wrapsBool ¬
         control size controlSize ¬
         bold type boldType
      set theBottom to theTop + spacer
      set the end of accViewControls to theLabel
   end if
   
   --create labeled matrix
   if "create labeled matrix" is in viewsList then
      -- makes label and matrix; if matrixLeft is less than leftInset, the label will start at leftInset, with the matrix following;
      -- if matrixLeft is more than leftInset, the matrix will start at matrixLeft, and the label will will appear to its left
      set radioButtonNames to {"Button 1", "Button two", "Button button button"}
      set radioButtonWidth to max width for labels radioButtonNames
      
      set labelText to "Matrix Label"
      set matrixLabelWidth to (max width for labels {labelText}) + theLeft + 10
      
      set {labeledMatrix, matrixLabel, theTop, matrixLeft} to ¬
         create labeled matrix radioButtonNames ¬
            left inset theLeft ¬
            bottom theBottom ¬
            max width maxWidth ¬
            arranged vertically true ¬
            matrix left matrixLabelWidth ¬
            label text labelText ¬
            initial choice (some item of radioButtonNames)
      set theBottom to theTop + spacer
      set the end of accViewControls to labeledMatrix
      set the end of accViewControls to matrixLabel
      set the end of accessoryViewResults to {"labeledMatrix", labeledMatrix}
      
   end if
   
   --create labeled path control 
   if "create labeled path control" is in viewsList then
      set labelText to "Path control label"
      set pathControlLabelWidth to max width for labels {labelText}
      set myPath to POSIX path of (path to me)
      
      set {labeledPathControl, pathControlLabel, theTop} to create labeled path control myPath ¬
         left inset theLeft ¬
         bottom theBottom ¬
         control width maxWidth ¬
         pops up (some item of {true, false}) ¬
         label text labelText
      
      set theBottom to theTop + spacer
      set the end of accViewControls to labeledPathControl
      set the end of accViewControls to pathControlLabel
      set the end of accessoryViewResults to {"labeledPathControl", labeledPathControl}
   end if
   
   --create create labeled popup
   if "create labeled popup" is in viewsList then
      set checkBoxLabelText to "Text for Checkbox"
      set checkboxLeft to (max width for labels {checkBoxLabelText}) + theLeft
      set ceckboxLabel to "Label for checkbox"
      set checkBoxWidth to (max width for labels {ceckboxLabel}) + checkboxLeft
      if checkBoxWidth > maxWidth then set checkBoxWidth to maxWidth
      
      set popUpLabelText to "Popup label"
      set popUpLabelRight to (max width for labels {checkBoxLabelText}) + theLeft
      
      set popupList to {"Fred", "Frieda", "George", "Georgina", "A much longer item"}
      set popupWidth to (max width for labels popupList) + 45
      
      set {theLabeledPopup, thePopupLabel, theTop, theWidth} to ¬
         create labeled popup popupList ¬
            left inset theLeft ¬
            bottom theBottom ¬
            popup width popupWidth ¬
            max width maxWidth ¬
            label text popUpLabelText ¬
            popup left popUpLabelRight ¬
            initial choice last item of popupList
      
      set theBottom to theTop + spacer
      set the end of accViewControls to thePopupLabel
      set the end of accViewControls to theLabeledPopup
      set the end of accessoryViewResults to {"theLabeledPopup", theLabeledPopup}
   end if
   
   --create matrix
   if "create matrix" is in viewsList then
      set radioButtonNames to {"Button 1", "Button two", "Button button button"}
      
      set {theMatrix, theTop} to create matrix radioButtonNames ¬
         left inset theLeft ¬
         bottom theBottom ¬
         max width maxWidth ¬
         arranged vertically true ¬
         initial choice some item of radioButtonNames
      set theBottom to theTop + spacer
      set the end of accViewControls to theMatrix
      set the end of accessoryViewResults to {"theMatrix", theMatrix}
   end if
   
   --create path control  
   if "create path control" is in viewsList then
      set myPath to POSIX path of (path to me)
      
      set {thePathControl, theTop} to create path control myPath ¬
         left inset theLeft ¬
         bottom theBottom ¬
         control width maxWidth ¬
         with pops up
      set theBottom to theTop + spacer
      set the end of accViewControls to thePathControl
      set the end of accessoryViewResults to {"thePathControl", thePathControl}
   end if
   
   --create popup 
   if "create popup" is in viewsList then
      set popupList to {"Fred", "Frieda", "George", "Georgina"}
      set {thePopup, theTop} to create popup popupList ¬
         left inset theLeft ¬
         bottom theBottom ¬
         popup width maxWidth ¬
         initial choice (some item of popupList)
      set theBottom to theTop + spacer
      set the end of accViewControls to thePopup
      set the end of accessoryViewResults to {"thePopup", thePopup}
   end if
   
   --create checkbox  
   if "create checkbox" is in viewsList then
      set checkBoxTitle to "Check Box Title"
      set {theCheckbox, theTop} to create checkbox checkBoxTitle ¬
         left inset theLeft ¬
         bottom theBottom ¬
         max width maxWidth ¬
         with initial state
      set theBottom to theTop + spacer
      set the end of accViewControls to theCheckbox
      set the end of accessoryViewResults to {"theCheckbox", theCheckbox}
   end if
   
   --create labeled checkbox
   
   if "create labeled checkbox" is in viewsList then
      -- makes label and checkbox; if checkboxLeft is less than leftInset, the label will start at leftInset, with the checkbox following;
      -- if checkboxLeft is more than leftInset, the checkbox will start at checkboxLeft, and the label will will appear to its left
      set checkBoxLabelText to "Text for Checkbox"
      set checkboxLeft to (max width for labels {checkBoxLabelText}) + theLeft
      set ceckboxLabel to "Label for checkbox"
      set checkBoxWidth to (max width for labels {ceckboxLabel}) + checkboxLeft
      if checkBoxWidth > maxWidth then set checkBoxWidth to maxWidth
      set checkboxLeft to theLeft
      set {theLabeledCheckBox, theCheckBoxLabel, theTop, theWidth} to ¬
         create labeled checkbox ceckboxLabel ¬
            left inset theLeft ¬
            bottom theBottom ¬
            max width checkBoxWidth ¬
            label text checkBoxLabelText ¬
            checkbox left checkboxLeft ¬
            without initial state
      set theBottom to theTop + spacer
      set the end of accViewControls to theCheckBoxLabel
      set the end of accViewControls to theLabeledCheckBox
      set the end of accessoryViewResults to {"theLabeledCheckBox", theLabeledCheckBox}
   end if
   
   --create secure field 
   if "create secure field" is in viewsList then
      set secureFieldText to "Secure Field"
      set secureFieldPlaceHolder to "Secure Placeholder"
      
      set {theSecureField, theTop} to create secure field secureFieldText ¬
         placeholder text secureFieldPlaceHolder ¬
         left inset theLeft ¬
         bottom theBottom ¬
         field width maxWidth
      set theBottom to theTop + spacer
      set the end of accViewControls to theSecureField
      set the end of accessoryViewResults to {"theSecureField", theSecureField}
   end if
   
   --create side labeled field 
   if "create side labeled field" is in viewsList then
      set labelText to "field label"
      set labelWidth to (max width for labels {labelText}) + 5
      set fieldContents to "Side label field contents"
      set placeHolderText to "Side label field placeholder"
      set fieldWidth to max width for labels {placeHolderText, fieldContents}
      set totalWidth to theLeft + labelWidth + fieldWidth
      if totalWidth > maxWidth then set totalWidth to maxWidth
      set {theSideLabeledField, theFieldLabel, theTop, theWidth} ¬
         to create side labeled field fieldContents ¬
         placeholder text placeHolderText ¬
         left inset theLeft ¬
         bottom theBottom ¬
         total width totalWidth ¬
         accepts linebreak and tab true ¬
         label text labelText ¬
         field left theLeft + labelWidth
      
      set theBottom to theTop + spacer
      set the end of accViewControls to theFieldLabel
      set the end of accViewControls to theSideLabeledField
      set the end of accessoryViewResults to {"theSideLabeledField", theSideLabeledField}
   end if
   
   --create top labeled field 
   if "create top labeled field" is in viewsList then
      set labelText to "field label"
      set labelWidth to max width for labels {labelText}
      set fieldContents to "Top label field contents"
      set placeHolderText to "top label field placeholder"
      
      set {theTopLabeledField, theFieldLabel, theTop} to create top labeled field fieldContents ¬
         placeholder text placeHolderText ¬
         left inset theLeft ¬
         bottom theBottom ¬
         field width maxWidth ¬
         extra height spacer ¬
         accepts linebreak and tab true ¬
         label text labelText
      
      set theBottom to theTop + spacer
      set the end of accViewControls to theTopLabeledField
      set the end of accViewControls to theFieldLabel
      set the end of accessoryViewResults to {"theTopLabeledField", theTopLabeledField}
      
   end if
   
   if theTop > 200 then return missing value
   
   set AccViewTop to theTop
   
   my AssembleAccessoryViewsMainThread:{accViewControls, AccViewLeft, AccViewBottom, AccViewWidth, AccViewTop}
end AssembleAccessoryViews

on AssembleAccessoryViewsMainThread:theArg
   set {accViewControls, theLeft, theBottom, theWidth, theTop} to theArg
   set my theAccessoryView to current application's NSView's alloc()'s initWithFrame:{{theLeft, theBottom}, {theWidth, theTop - theBottom}}
   repeat with aControl in accViewControls
      (theAccessoryView's addSubview:aControl)
   end repeat
   
end AssembleAccessoryViewsMainThread:

on PersistentVariables()
   set newView to false
   prepare storage for (path to me) default values {selectedViews:{}, lastPosition:{}, whichViews:{}, viewPath:{}}
   
   set my selectedViews to value for key "selectedViews"
   set my lastPosition to value for key "lastPosition"
   set my whichViews to value for key "whichViews"
   set my viewPath to value for key "viewPath"
   
   if selectedViews = {} then
      set selectedViews to {1, 2, 3}
      assign value selectedViews to key "selectedViews"
   end if
   
   if lastPosition = {} then
      set lastPosition to {30, 30}
      assign value lastPosition to key "lastPosition"
   end if
   
   if whichViews = {} then
      set whichViews to items 1 thru 3 of theTableData
      assign value whichViews to key "whichViews"
   end if
   
   if viewPath = {} then
      set newView to true
   else
      try
         if not (exists object viewPath) then set newView to true
      on error
         set newView to true
      end try
   end if
   
   if newView then
      set viewPath to choose file with prompt ("Select an image for image view") ¬
         of type {"jpg", "jpeg", "tif", "tiff"} ¬
         invisibles false ¬
         multiple selections allowed false ¬
         without showing package contents
      set viewPath to POSIX path of viewPath
      assign value viewPath to key "viewPath"
   end if
end PersistentVariables

on StorePersistentValues()
   assign value selectedViews to key "selectedViews"
   assign value lastPosition to key "lastPosition"
   assign value whichViews to key "whichViews"
   assign value viewPath to key "viewPath"
end StorePersistentValues

on RetreiveStoredValues()
   set my selectedViews to value for key "selectedViews"
   set my lastPosition to value for key "lastPosition"
   set my whichViews to value for key "whichViews"
   set my viewPath to value for key "viewPath"
end RetreiveStoredValues

Thanks for the tip. I had already found the accessory view in Myriad Tables (Sorry I didn’t mention that in my OP), and unfortunately, it doesn’t really do what I would like it to do, mostly because it does not act like a button.
I know from the examples that clicking the checkbox will pop up another alert, but I have not figured out how to leverage that action into zeroing out the 4th column of data.

So here is my code as it stands right now.

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
use framework "Foundation"
use framework "AppKit"
use script "Myriad Tables Lib" version "1.0.9"

property theCheckbox : missing value
property thePopup : missing value
property theAccessoryView : missing value

set bobB to "Apple, Orange"
set carB to "Peach, Plum, Apple"
set chrisT to "Orange, Pineable, Mango, Cherry, Black Berry, Passion Fruit, Apple, Grape, Kiwi, Nectarine, Peach, Plum"
set danB to "Nectarine, Cherry, Apple"
set jamesB to "Orange, Pineable, Mango"
set johnS to "Kiwi, Apple, Grape"
set rayC to "Apple, Orange, Passion Fruit"
set rudyC to "Grape, Orange"
set shanS to "Orange"
set xC to "Apple"
-- This table has a column of combo boxes

set theData to {{"Chris Tierney", chrisT, true, "1"}, {"Bob Black", bobB, true, "1"}, {"Carmen Brown", carB, true, "1"}, {"Dan Brown", danB, true, "1"}, {"Ray Coz", rayC, true, "1"}, {"James Brown", jamesB, true, "1"}, ¬
	{"John Smith", johnS, true, "1"}, {"Rudy Cox", rudyC, true, "1"}, {"Shannon Smith", shanS, true, "1"}, {"Xavier Crux", xC, true, "1"}}
set checkUncheck to "Uncheck"
repeat
	if current application's NSThread's isMainThread() as boolean then
		my createCheckBoxMainThread:{"Zero Label Count", "checkboxClicked:"}
		my buildAccessoryViewMainThread:{theCheckbox}
	else
		my performSelectorOnMainThread:"createCheckBoxMainThread:" withObject:{"Zero Label Count", "checkboxClicked:"} waitUntilDone:true
		my performSelectorOnMainThread:"buildAccessoryViewMainThread:" withObject:{theCheckbox} waitUntilDone:true
	end if
	set myTable to make new table with data theData editable columns {3, 4} column headings {"Person", "Fruit", "", "# of Labels"} with prompt "Print Labels For:" with title "Label Printing Options" with empty selection allowed
	modify table myTable extra button name checkUncheck accessory view theAccessoryView
	set theAccessoryView to missing value
	set theResult to display table myTable
	set theState to theCheckbox's state() as boolean
	set theCheckbox to missing value -- to avoid error messages when saving
	
	if button number of theResult is 2 then
		if theState is true then
			set theData to {{"Chris Tierney", chrisT, true, "0"}, {"Bob Black", bobB, true, "0"}, {"Carmen Brown", carB, true, "0"}, {"Dan Brown", danB, true, "0"}, {"Ray Coz", rayC, true, "0"}, {"James Brown", jamesB, true, "0"}, ¬
				{"John Smith", johnS, true, "0"}, {"Rudy Cox", rudyC, true, "0"}, {"Shannon Smith", shanS, true, "0"}, {"Xavier Crux", xC, true, "0"}}
		end if
		set trueFalse to item 3 of item 1 of theData
		if trueFalse is true then
			repeat with i from 1 to (count theData)
				set item 3 of item i of theData to false
			end repeat
			set checkUncheck to "Check"
		else
			repeat with i from 1 to (count theData)
				set item 3 of item i of theData to true
			end repeat
			set checkUncheck to "Uncheck"
		end if
	else
		if button number of theResult is 1 then
			return
		end if
	end if
	
end repeat
on createCheckBoxMainThread:theArg
	set {theTitle, theAction} to theArg as list
	-- build a checkbox
	set my theCheckbox to current application's NSButton's alloc()'s initWithFrame:{{10, 10}, {150, 18}}
	tell theCheckbox
		its setButtonType:(current application's NSSwitchButton)
		its setTitle:theTitle
		its setTarget:me
		its setAction:theAction -- a handler in this script
	end tell
end createCheckBoxMainThread:

on buildAccessoryViewMainThread:theControls
	set my theAccessoryView to current application's NSView's alloc()'s initWithFrame:{{0, 0}, {160, 60}}
	repeat with aControl in theControls
		(theAccessoryView's addSubview:aControl)
	end repeat
end buildAccessoryViewMainThread:

-- this is called when the checkbox is clicked
on checkboxClicked:sender
	-- how to make this change all the values in column 4 to 0's and then show the dialog again?
end checkboxClicked: