"create field" control question – wrapping not aligned to control


#1

Sorry, I have another question. Wrapping in a field control can sometimes be outside the right hand border of the control. I’ve noticed the problem occurs when the field control inset is an appreciable proportion of the accessory view width, as in this example:

use AppleScript version "2.4"
use scripting additions
use script "DialogToolkitPlus" version "1.0.1"
set accViewWidth to 500
set accViewInset to 80 -- <== From 46 or so upwards, the wrapping goes outside the control
set {theButtons, minWidth} to create buttons {"Cancel", "Process"} button keys {"c", "p"} default button 2 cancel button 1
set {theField, theTop} to create field "Text goes here" placeholder text "Paste URL here" left inset accViewInset bottom 20 field width accViewWidth extra height 35
set {button_returned, controls_results} to display enhanced window "Test field" button list theButtons acc view width accViewWidth acc view height theTop acc view controls {theField}

The amount of text that goes outside the control varies with the proportion of the control’s left inset parameter to the accessory width. There’s also a relationship between those two and the control’s width which affects how much text is outside the control. So, if the field control’s width is reduced and other parameters unchanged, the amount of text outside the control is reduced.

Is there a way to fix this ?


(Shane Stanley) #2

Change that to:

set {theField, theTop} to create field "Text goes here" placeholder text "Paste URL here" left inset accViewInset bottom 20 field width accViewWidth - accViewInset extra height 35

#3

Shane, again, many thanks. I think I can see now that I was trying to create a control that was wider than the accessory. On first principles that might cause issues.

If I remember correctly, when I did the same thing in VBA, it would show the control spearing off to the right making clear the goof. AS is much gentler and correct but, maybe a little subtle for me.

Cheers.