SetFocus(fieldName As String) As String

 

If applicable, sets the focus to the control fieldName.

 

KeyDown events are directed to the control. If the control cannot get the focus on the platform on which the application is running, SetFocus does nothing.

 

  

Parameters:

 

Name

Type

Description

fieldname

String

ScreenFieldName of the control.

Ctrl+Click onto a control to retrieve its fieldName

(= ScreenFieldName)

 

Available in:

 

WindowMain

WindowLink

YES

YES

 

 Used in:

 

XojoScript Name

GUID

Add a Payment for Event participation

877AA389-2167-4A95-904E-95C6329A2BFD

Add code and prices to events

A5CABD2D-92A3-494C-ADDF-8666611B3B6B

Add item and price to list in finances

DD3D67C8-08BF-409A-AB03-BC837BE68D9D

 

Hint: You can find more references to XojoScripts which make use of this function by sending the following SQL statement to the database:

Select id,GUID, ScriptName,ScriptCode from im_scripts where ScriptCode Like '%SetFocus%'

 

Example XojoScript:

 

// Add code and prices to events

// Define listbox name

Dim lb As String = "imLB_evt_List3"

 

// Store contents of Item Textfield

Dim codeName As String

codeName = GetText("imTF_evt_PriceCode")

 

 

If codeName <> "" Then

 

// Create an array from TextField values

Dim Arr() As String = Array( _

codeName, _

GetText("imTF_evt_Price"), _

GetText("imTF_evt_PriceEuro"), _

GetText("imTF_evt_TextD"), _

GetText("imTF_evt_TextE"), _

GetText("imTF_evt_TextF"))

 

// Add record to Listbox

ListAddRow(lb,Arr)

 

// Clear input fields

SetText("imTF_evt_PriceCode","")

SetText("imTF_evt_PriceEuro","")

SetText("imTF_evt_Price","")

SetText("imTF_evt_TextD","")

SetText("imTF_evt_TextE","")

SetText("imTF_evt_TextF","")

Else

MsgBox("You must provide a price code!")

End if

 

// Set focus for next input

SetFocus("imTF_evt_PriceCode")