ObjectDCL Banner

Control_SetProperty Method

Description

This method sets a property to a control.

Parameters

MyControlReference
Reference to the control in the form of MyProject_MyForm_MyControl.
ProjectFile
String identifying the project as it was passed in LoadProject.
DialogName
String identifying the dialog by name.
ControlName
String identifying the control by name.
PropertyName
String identifying the property by name.
PropertyValue
The value to set, which can be of the type relevant to the property. A best effort is made to convert the argument to the destination type.

Return Values

Returns the following according to the situation:

  • T when successful.
  • Nil if the control is not found, the property does not exist or the property is read-only.

AutoLISP Syntax

The recommended convention is passing the control identifier directly:

CopyCode imageCopy Code
(Odcl_Control_SetProperty 
		MyControlReference [as Reference]
		PropertyName [as String]
		PropertyValue [as Any])

This variation allows for setting multiple properties at once:

CopyCode imageCopy Code
(Odcl_Control_SetProperty 
		MyControlReference [as Reference]
		( PropertyName1 [as String]
		  PropertyValue1 [as Any]
		  PropertyName2 [as String]
		  PropertyValue2 [as Any]
		  ... ) )

An alternative convention is to identify the control by providing the project file, the dialog name and the control name:

CopyCode imageCopy Code
(Odcl_Control_SetProperty
		ProjectFile [as String]
		DialogName [as String]
		ControlName [as String]
		PropertyName [as String]
		PropertyValue [as Any])

This variation allows for setting multiple properties at once:

CopyCode imageCopy Code
(Odcl_Control_SetProperty
		ProjectFile [as String]
		DialogName [as String]
		ControlName [as String]
		PropertyName [as String]
		PropertyValue [as Any]
		( PropertyName1 [as String]
		  PropertyValue1 [as Any]
		  PropertyName2 [as String]
		  PropertyValue2 [as Any]
		  ... ) )

Remarks

Does not apply to dialogs.

See the property of interest to know what string to pass.

Not all properties can be set.

When setting multiple properties, the process begins from the first to the last. If a problem occur during the processing, the function fails immediately. Any remaining property will not be set and no attempt will be made to set them.

Applies For

ActiveX, AngleSlider, Animation, BlockList, BlockView, CheckBox, ComboBox, DwgList, DwgPreview, Frame, GraphicButton, EditableGrid, Grid (Hatch), HtmlControl, ImageCombo, Label, ListBox, ListView, MonthPicker, Option, OptionList, PictureBox, ProgressBar, Rectangle, ScrollBar, SliderBar, SlideView, SpinButton, Splitter, TabControl, TextBox, TextButton, TreeControl, UrlLink.

Example

CopyCode imageCopy Code
; Enable the control
(Odcl_Control_SetProperty MyProject_MyForm_MyControl "Enabled" T)

; Make visible and enable the control
(Odcl_Control_SetProperty MyProject_MyForm_MyControl (list "Enabled" T "Visible" T))

See Also

Control_GetProperty