Skip to content

dos_htmldialog

Dale Fugier edited this page Jul 1, 2026 · 1 revision

Creates a dialog box that displays HTML. An HTML dialog box can be used as an alternative to a DCL dialog box.

Syntax

(dos_htmldialog filename [arguments [options [modeless]]])

Parameters

filename

The filename containing the HTML dialog box to display. If a full path is not specified, the function will search the AutoCAD search path for the file.

arguments

The argument or arguments to pass to the HTML dialog box. The data passed in is converted to a SAFEARRAY, and it is placed in the window object's window.dialogArguments property.

Note, AutoCAD does not allow ActiveX objects to be passed as parameters to ObjectARX-defined LISP functions. So to ensure that HTML dialogs have AutoCAD functionality, the AutoCAD object (returned in LISP by the vlax-get-Acad-Object function,is passed to your dialog automatically. This object will always be the first element of the SAFEARRAY placed in the window object's window.dialogArguments property.

options

A string specifying the window ornaments for the dialog box. Use one or more of the following semicolon-delimited values:

Value Description
Value Description
dialogHeight:sHeight Sets the height of the dialog window.
dialogLeft:sXPos Sets the left position of the dialog window relative to the upper-left corner of the desktop.
dialogTop:sYPos Sets the top position of the dialog window relative to the upper-left corner of the desktop.
dialogWidth:sWidth Sets the width of the dialog window.
center:{ yes | no | 1 | 0 | on | off } Specifies whether to center the dialog window within the desktop. The default is yes.
dialogHide:{ yes | no | 1 | 0 | on | off } Specifies whether the dialog window is hidden when printing or using print preview. This feature is only available when a dialog box is opened from a trusted application. The default is no.
edge:{ sunken | raised } Specifies the edge style of the dialog window. The default is raised.
help:{ yes | no | 1 | 0 | on | off } Specifies whether the dialog window displays the context-sensitive Help icon. The default is yes.
resizable:{ yes | no | 1 | 0 | on | off } Specifies whether the dialog window has fixed dimensions. The default is no.
scroll:{ yes | no | 1 | 0 | on | off } Specifies whether the dialog window displays scrollbars. The default is yes.
status:{ yes | no | 1 | 0 | on | off } Specifies whether the dialog window displays a status bar. The default is yes for untrusted dialog windows and no for trusted dialog windows.
unadorned:{ yes | no | 1 | 0 | on | off } Specifies whether the dialog window displays the border window chrome. This feature is only available when a dialog box is opened from a trusted application. The default is no.

height

An optional dialog box height.

modeless

If omitted or nil , a modal dialog will be displayed. A modal dialog box retains the input focus while open. The user cannot switch windows until the dialog box is closed.

If T, a modeless dialog box will be displayed.

Returns

If a model dialog is displayed, then if successful, the return value of the method will be dependent on the developer's implementation of the custom HTML dialog page. In most cases the developer will set the windows.returnValue property before closing the dialog box. This property will then be converted from either a VARIANT or a SAFEARRAY and returned to LISP. Note, although it is possible to create multi-dimensional SAFEARRAY objects, this function will only accept a single VARIANT or a 1-dimensional SAFEARRAY as a return value.

If a modeless dialog is displayed, then Tindicating success.

In both cases, nil is returned on error.

Notes

You can also eliminate scroll bars on dialog boxes by setting the scroll attribute to false in the body element for the dialog window, or call the modal dialog box from a trusted application.

You can set the default font settings the same way you set Cascading Style Sheets (CSS) attributes (for example, "font:3;font-size:4"). To define multiple font values, use multiple font attributes.

The default unit of measure for dialogHeight and dialogWidth in Internet Explorer 4.0 is the pixel; in Internet Explorer 5 it is the "em". The value can be an integer or floating-point number, followed by an absolute units designator (cm, mm, in, pt, or pc) or a relative units designator (em, ex, or px). For consistent results, specify the dialogHeight and dialogWidth in pixels when designing modal dialog boxes.

Although a user can manually adjust the height of a dialog box to a smaller value - provided the dialog box is resizable - the minimum dialogHeight you can specify is 100 pixels.

To override center, even though the default for center is yes, you can specify either dialogLeft and/or dialogTop.

To enable visual styles for your dialog, add the following META tag to the

section of your HTML file:
<META HTTP-EQUIV="MSThemeCompatible" CONTENT="yes">

Unlike a modal dialog, where the script code is halted until the dialog is dismissed, when a modeless dialog is displayed, the script code will continue.

Internet Explorer (IE) 7 is the default rendering mode for embedded IE controls (for compatibility reasons). You can use the FEATURE_BROWSER_EMULATION registry key to change this if you want. To run in IE11 Standards Mode, add the following new value into the registry:

[HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE]
\Software
\Microsoft
\Internet Explorer
\Main
\FeatureControl
\FEATURE_BROWSER_EMULATION
Name: "acad.exe"
Type: REG_DWORD
Value: 11000 (decimal) or 0x2af8 (hex)

Example 1

Command: (vl-load-com)
Command: (dos_htmldialog "renamelayer.htm" (getvar "clayer") "center:1")
"Plumbing"

<HTML id=RenameLayerDialog style="width: 22em; height: 12em">
<HEAD>
<TITLE>Rename Layer</TITLE>
<SCRIPT LANGUAGE="VBScript">

<!--
Sub OnInitDialog()
Dim sArgs
sArgs = window.dialogArguments
If Not IsNull(sArgs) Then
txtOldName.value = CStr(sArgs(1))
End If
End Sub

Sub OnOk()
Dim sResult
sResult = txtNewName.value
window.returnValue = sResult
window.close
End Sub

Sub OnCancel()
window.returnValue = ""
window.close
End Sub
-->

</SCRIPT>
</HEAD>
<BODY ONLOAD="OnInitDialog()" STYLE="font-family: Arial, sans-serif">
<H3>
<FONT FACE="Verdana,Arial,Times New I2">Enter new layer name</FONT></H3>
<P>
<TABLE CELLPADDING="1" CELLSPACING="2" BORDER="0">
<TR>
<TD VALIGN=CENTER>
<P>
<FONT FACE="Verdana,Arial,Times New I2">Old layer name:</FONT></TD>
<TD VALIGN=CENTER>
<P>
<INPUT TYPE=TEXT NAME="txtOldName" SIZE="25" MAXLENGTH="256"></TD>
</TR>
<TR>
<TD VALIGN=CENTER>
<P>
<FONT FACE="Verdana,Arial,Times New I2">New layer name:</FONT></TD>
<TD VALIGN=CENTER>
<P>
<INPUT TYPE=TEXT NAME="txtNewName" SIZE="25" MAXLENGTH="256"></TD>
</TR>
<TR>
<TD VALIGN=CENTER><DIV ALIGN=RIGHT>
<P ALIGN=RIGHT>
<INPUT TYPE=SUBMIT VALUE="OK" ID="cmdOK" CLASS="button" ONCLICK="OnOk()" STYLE="width: 5em"></TD>
<TD VALIGN=CENTER><CENTER>
<P ALIGN=CENTER>
<INPUT TYPE=SUBMIT VALUE="Cancel" ID="cmdCancel" CLASS="button" ONCLICK="OnCancel()" STYLE="width: 5em"></TD>
</TR>
</TABLE>
</P>
</BODY>
</HTML>

Example 2

Command: (dos_htmldialog "testargs.htm" (list 1 2 (list "a" "b") (list 3 4.5 6 7.8)))
nil

<HTML>
<HEAD>
<TITLE>DOSLib TestArgs</TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE="VBScript">
<!--
Dim args
args = window.dialogArguments
Call DumpArguments(args)
Sub DumpArguments(val)
Dim item
If IsEmpty(val) Then
Call document.writeln("Empty<br>")
ElseIf IsNull(val) Then
Call document.writeln("Null<br>")
ElseIf IsArray(val) Then
document.writeln("*Begin Array*<br>")
For Each item In val
Call DumpArguments(item)
Next
document.writeln("*End Array*<br>")
ElseIf IsObject(val) Then
Call document.writeln("Object = " & TypeName(val) & "<br>")
Else
Call document.writeln(TypeName(val) & " = " & CStr(val) & "<br>")
End If
End Sub
-->
</SCRIPT>
</BODY>
</HTML>

Clone this wiki locally