Dialog Toolkit - Checkboxes behaving like text boxes

My applet has checkboxes by which the user indicates they wish to perform a function or change a setting. The checkboxes are created with Dialog Toolkit v1.1.3.

On my M1 Mac running macOS 13.3.1(a), one checkbox in one dialog, however, behaves like small text boxes. The same dialog on my old Mac Mini running macOS 10.13.6 has three checkboxes which behave like text boxes. Oddly, earlier today another checkbox had that behaviour but at present it does not. The text box behaviour occurs when running the applet within Script Debugger and as an exported run-only applet.

The behaviour is found by moving the mouse pointer over the checkboxes. The pointer changes to an “I” bar. Double-clicking in the checkbox seems to select its empty content and looks like this:

Checkbox

I can’t find anything in my applet which would make a checkbox behave like that. The code is in this form:

set theCheckBoxSaveSettingsLabel to localized string "Save current settings" from table "[My Applet]"
set {utilities_theCheckbox_Save_Settings, theTop} to create checkbox theCheckBoxSaveSettingsLabel left inset accViewInset bottom (theTop + 5) max width 200

All of the calls to “create checkbox” are in that form.

It does seem odd that more checkboxes are affected when running in macOS 10.13. Is there something which can prevent that behaviour ?

Thanks.

Has anyone seen this checkbox behaviour in DTP ? It’s still happening and I can’t find a solution.

Thanks.

this code runs as expected

use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use scripting additions
use script "Dialog Toolkit Plus" version "1.1.3"
set accViewWidth to 300
set {theButtons, minWidth} to create buttons {"Close", "More"} button keys {"", "2", "1", ""} default button 2 --cancel button 1
if minWidth > accViewWidth then set accViewWidth to minWidth -- make sure buttons fit
set accViewInset to 10
set theTop to 10
set theCheckBoxSaveSettingsLabel to localized string "Save current settings" from table "[My Applet]"
set {utilities_theCheckbox_Save_Settings, theTop} to create checkbox theCheckBoxSaveSettingsLabel left inset accViewInset bottom (theTop + 5) max width 200
set {buttonName, controlsResults} to display enhanced window "" acc view width accViewWidth acc view height theTop acc view controls {utilities_theCheckbox_Save_Settings} buttons theButtons initial position {0, 0} --with align cancel button
set {msng, scanSku, msng, msng} to controlsResults

running on a M1 under Ventura 13.4.

devRap, thanks. I’m running a (slightly) custom version of DTP and so I should do more testing to be sure I’ve not made a muck of it. I’ll report back my results.

Have done some more research and found:

  • The bug was introduced in a previous version of the applet – there was no change in the DTP code at that time.

  • The same checkboxes behave this way over all versions of my applet since then.

  • I can’t see how any of the changes in the applet’s code could do this.

  • The bug has survived two new versions of the custom DTP code.

  • The code used in my custom DTP library to create checkboxes is the same as in DTP 1.1.3.

  • The same checkboxes are affected in the development applet running in Script Debugger/Script Editor and in the run-only, signed and notarized version.

  • All the other checkboxes (38 of them across 3 dialogs) are unaffected in macOS 13.4.1.

  • In macOS 10.13.6 and 10.14.6, an additional (the same) checkbox in the same dialog is affected. This make little sense as all the code is the same.

  • Clicking on the checkbox title text toggles the tick. However, clicking in the checkbox does not toggle the tick while double clicking selects its contents. Thus the tick box can look like this:

    Screenshot 2023-06-22 at 2.12.13 pm

  • The code used to create the affected checkboxes is the same as all the others with variations in position and text content:

I can’t work out what code might cause this behaviour be it my AS code or the ASOC code in DTP.

Stumped.

What changes do the customizations to DTP make?

Have you tried it with the unaltered DTP?

Does it happen with other apps?

Does it happen with this app when run from Script Debugger?

Compared with DTP 1.1.3:

  • changed value for some properties to reduce button widths, squeeze buttons closer, reduce gaps etc.
  • display enhanced window returns final position of window {x,y}
  • display enhanced window returns button number as well as name
  • create labeled popup to better position the label
  • showTheWindowAndWaitMainThread – code to get window position
  • prepareEnhancedWindowMainThread added “5” to buttonLeft variable

No change to any code related to checkboxes.

Yes. The bug is still evident.

Don’t have any other apps which use DTP.

Yes. Also when run from Script Editor.

It seems that the bug started when I added some code to the handler which creates the dialog. The change was an additional checkbox that is shown conditionally. I’ve tested that handler with the new code commented out but the bug has remained - very odd.

So, I haven’t yet narrowed down exactly which change causes the bug. I’ve been hoping that someone would have an idea on how this could happen. How can a UI element behave like both a text label (which can be selected but not edited) and a check box at the same time ?

Given that NSSwitchButton is deprecated, would it help to change to NSButtonTypeSwitch (even if it is macOS 10.12+) ?