SetText(fieldName As String, fieldText As String) As String

 

Sets the text contents of the control fieldName.

 

Parameters:

 

Name

Type

Description

fieldName

String

ScreenFieldName of the control.

Ctrl+Click onto a control to retrieve its fieldName

(= ScreenFieldName)

fieldText

String

Sets the text of the control fieldName

 

Text can be set for the following controls:

 

Control Type

Contents

TextField

Text

TextArea

Text

Combobox

Text

PopupMenu

Text

CheckBox

set string : "True" or "False"

True : checked

False : un-checked

RadioButton

set string : "True" or "False"

True : checked

False : un-checked

DateControl

tries to convert the passed in string to a valid date. Use a SQLDateTime string as a parameter of the format: YYYY-MM-DD or YYYY-MM-DD hh:mm:ss

Example : "2015-09-03 08:13:32"

ListBox

string with specific Field and Record delimiters:

After each Field add string (without hyphens) : "{*FLD*}"

After each Record add string (without hyphens) : "{*REC*}"

 

See also:

EndOfField and EndOfRecord

Caption

Text

 

 

Available in:

 

WindowMain

WindowLink

YES

YES

 

Used in:

 

XojoScript Name

GUID

Add code and prices to events

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

Calculate participation fee for seminar attendee

032B50D3-D463-453E-9370-9AF7C34DA1D5

Create Linkbox text for an address

63EAC259-4192-483E-9CB4-53AE6B5E5C24

Create Seminar Invoice in Word

D2036EFA-D283-481A-9A93-D00547680749

Generate Printlabel and linkbox text

74855E25-5542-4B9D-B821-04C414425526

 

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 '%SetText%'

 

Example XojoScript:

 

// Get Index of selected record in listbox

Dim idx As Integer = ListIndex("imLB_evt_List3")

 

// Skip if idx is -1, then there is no selection

If idx >= 0 Then

 

// Retrieve listbox text and store its records into an array

Dim arrLBRecs(-1) As String = Split(GetText("imLB_evt_List3"),EndOfRecord)

 

// Retrieve selected record

Dim rec As String = arrLBRecs(idx)

 

// store fields of selected record into an array

Dim arrRecFlds(-1) As String = Split(rec,EndOfField)

 

// Write each field out to textfields on screen

SetText("imTF_evt_PriceCode",arrRecFlds(0))

SetText("imTF_evt_Price",arrRecFlds(1))

SetText("imTF_evt_PriceEuro",arrRecFlds(2))

SetText("imTF_evt_TextD",arrRecFlds(3))

SetText("imTF_evt_TextE",arrRecFlds(4))

SetText("imTF_evt_TextF",arrRecFlds(5))

 

End If // idx >= 0