InlineStyles Property

Property that allows you to get or set the styles for several dialog box elements: checkbox captions, control labels, and paragraph text.

object.InlineStyles(element_type) = new_style
existing_style
= object.InlineStyles(element_type)

Arguments

object

Required.  A variable containing a dialog object created by calling CreateObject or new ActiveXControl.

element_type

Required. The type of element to set a style for. Legal values are the following:

label

Sets the inline style for the labels that sit to the left of many dialog box controls.

checkbox

Sets the inline style for checkbox and radio button captions.

paragraph

Sets the inline style for text inserted using the AddText method.

 
 

new_style

Required. A string containing the new inline style for the dialog box element. This style should be in the format used for CSS styles in HTML pages.

existing_style

A variable to receive the existing inline style for the dialog box element.

Remarks
This is an advanced property not necessary for the normal operation of ScriptDialogs dialog boxes. Here's a complete list of the inline styles available:

Property

Supports

Background-color

background-color: red
border-color: #3333FF
border-color: rgb(0,255,0)

The three valid color formats are shown.

Border (shorthand)

border: 2px solid #FF0000
border: 1px solid green
border: 5px solid rgb(233,200,77)

Turns on all borders with the specified width and color.

border-style

border-style:solid
border-style:none

These are the only ways these statements are supported. Solid turns all borders on. None turns all borders off. Dotted, dashed, etc. styles not supported.

Border-top..left (shorthand)

border-top:3px solid red
border-left: 1px solid green
border-bottom: 2pt solid rgb(0,255,127)
border-right: 1.5em solid #999999

Turns on the specified border only. Borders CAN be different widths. Borders cannot really be different colors, so last color specified "wins." Specify a width of 0px or a style of "none" instead of "solid" to turn a border off. Widths can be specified in points (pt) and ems (em) as well.

Border-top..left-style

border-top-style:solid
border-left-style: solid
border-bottom-style: solid
border-right-style:solid

Only "solid" and "none" supported.

Border-top..left-width

border-top-width:1px
border-left-width:2px
border-bottom-width:3px
border-right-width:19px

Can specify 0px to turn off a border. Widths can be specified in points (pt) and ems (em) as well.

border-color

border-color: red
border-color: #3333FF
border-color: rgb(0,255,0)

Only one color may be specified. The three valid color formats are shown.

color

color: red
color: #3333FF
color: rgb(0,255,0)

Sets the font color. The three valid color formats are shown.

display

display: none

Makes the element not display. Not very useful.

font-family

font-family: courier new,mono
font-family: arial,helvetica,sans-serif
font-family: times new roman, times, serif
font-family: comic sans ms,arial,sans-serif
font-family: times new roman

Possible font family values include all fonts installed on user's machine.

font-size

font-size: 18px
font-size: 12pt
font-size: 2.75em

Font sizes can be specified in pixels (px), points (pt), or ems (em).

font-weight

font-weight: normal
font-weight: bold

These are the only two values that seem to do anything.

line-height

line-height:25px
line-height: 2em
line-height: 6pt

Spaces lines in a paragraph farther apart or closer together (even overlapping). Pixels (px), points (pt), or ems (em) allowed.

margin (shorthand)

margin:20px
margin: 20px 5px
margin:-10px 0px 20px 5px

Margin is the spacing between this element and other elements around it. One value sets all margins (top, right, bottom, and left) to the same value. Two values sets the top and bottom margins to the first value and the right and left margins to the second value. Four values sets the top, right, bottom, and left margins in that order. Pixels (px), points (pt), or ems (em) allowed. Negative numbers allowed.

margin-top..left margin-top:20px
margin-right:1em
margin-bottom:10pt
margin-left:-10px
padding (shorthand)

padding:20px
padding: 20px 5px
padding:10px 0px 20px 5px

Padding is the spacing between this element and its own border. One value sets all padding (top, right, bottom, and left) to the same value. Two values sets the top and bottom padding to the first value and the right and left padding to the second value. Four values sets the top, right, bottom, and left padding amounts in that order. Pixels (px), points (pt), or ems (em) allowed. Negative numbers allowed.

padding-top..left padding-top:20px
padding-right:1em
padding-bottom:10pt
padding-left:-10px
text-align text-align:left
text-align:right
text-align:center
text-decoration text-decoration:underline
text-decoration:line-through
text-decoration:none
text-indent

text-indent:20px
text-indent:2em
text-indent:12pt
text-indent:-20px

Indents the first line of a paragraph. Makes sense to use this with "text-align:left". To create a hanging indent, specify a positive "margin-left" amount and a negative "text-indent" amount.

text-transform text-transform:uppercase
text-transform:lowercase
text-transform:none
width

width: 100px
width: 50em
width: 120pt

Forces the element to be a fixed width.

visibility

visibility:hidden
visibility:visible

Makes the element visible or invisible. This is different from "display:none" because "display:none" attempts to close up the space that the element would have occupied. "visibility:hidden" makes the element take up the same amount of space, but hides it from view.

Example

Sub main
  Set Dialog = CreateObject("TPFSoftware.ScriptDialog")
  ' Insert text that is green and bold
  NewStyle = "color:green;font-weight:bold"
  Dialog.InlineStyles("paragraph") = NewStyle
  Dialog.AddText "This will be green and bold"
  ' Insert text that is steel-blue on a white background
  NewStyle = "color:#FFFFFF;background-color:steelblue"
  Dialog.InlineStyles("paragraph") = NewStyle
  Dialog.AddText "This will be steel blue on white"
  ' Insert checkboxes w/ bold label, captions on yellow bkgrnd
  Dialog.InlineStyles("label") = "font-weight:bold"
  Dialog.InlineStyles("checkbox") = "background-color:yellow"
  Dialog.AddCheckboxes "Seasons", "Seasons:", _
    Array("Winter", "Spring", "Summer", "Fall") 


 Set Result = Dialog.Execute End Sub