ObjectDCL Banner

Control_SetFocus Method

Description

This method will force the indicated control to take focus.

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.

Return Values

Returns the following according to the situation:

  • T when successful.
  • Nil if the control is not found or is not visible.

AutoLISP Syntax

The recommended convention is passing the control identifier directly:

CopyCode imageCopy Code
(Odcl_Control_SetFocus 
		MyControlReference [as Reference])

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_SetFocus
		ProjectFile [as String]
		DialogName [as String]
		ControlName [as String])

Remarks

But do not use it from the Form_OnInitialize event, rather use the Control_ZOrder to force the control to the top of the Tab/ZOrder list. This will allow the control to receive focus first when the dialog box is displayed.

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
; Make the control take focus
(Odcl_Control_SetFocus MyProject_MyForm_MyControl)

See Also

GetFocus, OnKillFocus, OnSetFocus, Control_ZOrder