Script dialog default button is affected by button text line position

<resources>
	<resource name="dlgInfo" type="dialog">
		<dialog fontsize="8" height="101" lang="english" resize="yes" title="Directory Opus" width="338">
			<control halign="left" height="8" name="static" title="Topic" type="static" valign="top" width="280" x="30" y="10" />
			<control halign="left" height="49" name="static2" title="Notes" type="static" valign="top" width="280" x="30" y="22" />
			<control halign="center" height="14" image="yes" name="static3" title="Icon" type="static" valign="top" width="14" x="8" y="7" />
			<control close="3" height="14" name="btn4" resize="xy" title="&amp;4" type="button" width="50" x="116" y="80" />
			<control close="2" default="yes" height="14" name="btnYes" resize="xy" title="&amp;Yes" type="button" width="50" x="170" y="80" />
			<control close="1" height="14" name="btnNo" resize="xy" title="&amp;No" type="button" width="50" x="224" y="80" />
			<control close="0" height="14" name="btnCancel" resize="xy" title="&amp;Cancel" type="button" width="50" x="278" y="80" />
		</dialog>
	</resource>
</resources>

If I put this line before other button text.

<control close="2" default="yes" height="14" name="btnYes" resize="xy" title="&amp;Yes" type="button" width="50" x="170" y="80" />

This button becomes the default button:

<resources>
	<resource name="dlgInfo" type="dialog">
		<dialog fontsize="8" height="101" lang="english" resize="yes" title="Directory Opus" width="338">
			<control halign="left" height="8" name="static" title="Topic" type="static" valign="top" width="280" x="30" y="10" />
			<control halign="left" height="49" name="static2" title="Notes" type="static" valign="top" width="280" x="30" y="22" />
			<control halign="center" height="14" image="yes" name="static3" title="Icon" type="static" valign="top" width="14" x="8" y="7" />
			<control close="2" default="yes" height="14" name="btnYes" resize="xy" title="&amp;Yes" type="button" width="50" x="170" y="80" />
			<control close="3" height="14" name="btn4" resize="xy" title="&amp;4" type="button" width="50" x="116" y="80" />
			<control close="1" height="14" name="btnNo" resize="xy" title="&amp;No" type="button" width="50" x="224" y="80" />
			<control close="0" height="14" name="btnCancel" resize="xy" title="&amp;Cancel" type="button" width="50" x="278" y="80" />
		</dialog>
	</resource>
</resources>

It's no big deal, just reporting.

1 Like

The button with default="yes" should be the default button, as in the one that will be activated if you push return when no other button has focus.

If you mean "the button that has focus when the dialog opens", that's a different concept.

1 Like

as implemented it's a very confusing distinction in concepts, I guess in this case the initial_focus should become a separate property so that this difference is explicit and clear

Blame Microsoft. We didn't invent the terminology or behavior of dialogs in Windows, and it'd add to the confusion if we started using non-standard terms for things. :slight_smile:

1 Like