ClearBasic Control Reference
ClearBasic Control Reference
ActiveX control
Animation control
Close . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Open . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Play . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Stop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Bitmap control
Caption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
DataChanged . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Parent. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Click . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
BackColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Caption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Default . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
ForeColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Parent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Click . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Control object
Refresh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
SetFocus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
ControlType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Enabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Height . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
hWnd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Id. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Left . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Top . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Visible . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Width . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
GotFocus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
LostFocus. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
AppendItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Clear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Contains. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Down . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
GetList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
GetSelected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
RemoveByItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
RemoveItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
RemoveSelected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
ReplaceItem. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
SelectedIndexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
SelectedList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
SetSelected. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
UnSelect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
DataChanged . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
ListCount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
ListIndex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
NewIndex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Parent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
4
ClearBasic Control Reference
Contents
Selected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Sorted. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Click . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
AppendItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Clear. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Contains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Down . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
GetList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
GetSelected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
RemoveByItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
RemoveItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
RemoveSelected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
ReplaceItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
SelectedIndexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
SelectedList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
SetSelected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
UnSelect. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Up. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
DataChanged . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
ListCount. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
ListIndex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
NewIndex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Parent. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Selected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Sorted. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
UserData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Click . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Graph control
ClearData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
GetLabel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
GetLegend. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
GetPoint. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
SetLabel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
SetLegend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
SetPoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
5
ClearBasic Control Reference
Contents
BackColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
BackStyle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
BorderStyle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
GraphType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
LegendPos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
NumSets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
ShowLegend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Grid control
AbortCellChange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
AbortRowChange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
AppendContextMenu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
AppendItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Clear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
ClearContextMenu. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
ColorCells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
Contains. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
Down . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
GetChangedCell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
GetChangedRow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
GetChoiceList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
GetChoiceListDefault . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
GetChoiceListUserData. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
GetColumnControlType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
GetColumnMaxLength . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
GetColumnNames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
GetList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
GetSelected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
GetSelectedColumns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
HideColumn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
IsColumnEditable. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
IsColumnRequired. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
RemoveByItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
RemoveItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
RemoveSelected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
ReplaceItem. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
SaveAnyChanges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
SelectedIndexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
SelectedList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
SetCellColoring. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
SetCellFocus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
SetCellReadOnly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
6
ClearBasic Control Reference
Contents
SetCellText . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
SetContextMenuEnabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
SetContextMenuVisible . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
SetEditStates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
SetNewRowIndicator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
SetRowReadOnly. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
SetSelected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
UndoRowChanges. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
UnSelect. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
Up. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
AppendRows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
CObj . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
DataChanged . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Dirty. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
ListCount. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
ListIndex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
MultiSelect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
NewIndex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
PagingEvent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
Parent. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
PromptOnSave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
SelCount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
Selected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
Sorted. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
TopIndex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
TotalRows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
AdhocCellChanged . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
Cell_Btn_Click . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
CellChanged . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
Cell_Click . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
Cell_List_Select . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
Click . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
ContextMenuDisplaying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
ContextMenu_Select . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
DblClick. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
DoAdhocQuery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
NewRow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
Refresh. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
RowChanged . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
SortColumn. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
7
ClearBasic Control Reference
Contents
Label control
BackColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
Caption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
ForeColor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
Parent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
Click . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
AppendItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
Clear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
Contains. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
Down . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
GetList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
GetSelected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
RemoveByItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
RemoveItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
RemoveSelected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
ReplaceItem. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
SelectedIndexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
SelectedList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
SetSelected. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
UnSelect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
DataChanged . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
ListCount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
ListIndex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
MultiSelect. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
NewIndex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
Parent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
SelCount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
Selected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
Sorted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
TopIndex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
UserData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
Click . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
DblClick . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
AppendContextMenu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
8
ClearBasic Control Reference
Contents
ClearContextMenu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
SetContextMenuEnabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
SetContextMenuVisible . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
BackColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
ForeColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
MaxLength . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
MultiLine. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
Parent. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
Required . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
RequiredColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
SelLength. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
SelStart. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
SelText . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
Text. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
Click . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
ContextMenuDisplaying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
ContextMenu_Select . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
KeyPress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
Caption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
DataChanged . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320
Parent. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
Click . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
ProgressBar control
Max . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
Min . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
AppendAdhocFilter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
AppendDefaultSort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
AppendItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
AppendPreFilter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
ClearAdhocRow. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
ClearAll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
ClearPreFilter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
9
ClearBasic Control Reference
Contents
EnableAdhoc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
GenerateSQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
GetAdhocRow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
GetChangedCell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
GetCObj . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
GetCount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354
GetList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
GetNext . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
GetObjIds. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
GetPageSize. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
GetPrevious. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
GetSelCount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362
GetSelected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
InsertItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
OwnsGrid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
RefreshItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
Regenerate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
RejectAdhocCellEntry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370
RemoveItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372
RemoveSelected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374
ReplaceSelected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
ResetDefaultSort. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
ResetPreFilter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378
SelectedList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
SetAdhocCellReadOnly. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
SetAdhocCellText. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382
SetCObj . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
SetCurrent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384
SetSelected. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386
SetSelectedById . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
UnSelect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388
UpdateItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
Slider control
Max. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393
Min . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
Change . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
Scroll. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397
DataChanged . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401
10
ClearBasic Control Reference
Contents
Parent. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402
Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
Click . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405
AppendContextMenu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
ClearContextMenu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412
SetContextMenuEnabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413
SetContextMenuVisible . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414
BackColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
DataChanged . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417
ForeColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418
MaxLength . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420
MultiLine. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
Parent. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422
Required . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
RequiredColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424
SelLength. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425
SelStart. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426
SelText . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427
Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428
Text. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430
Click . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431
ContextMenuDisplaying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432
ContextMenu_Select . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433
KeyPress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434
TreeView control
Add . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438
Clear. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440
Expand. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441
GetItemText . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442
GetSelectedItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443
Key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444
Remove . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445
SetImageList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446
SetItemOverlayImage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448
SetItemText . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449
SetOverlayImage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450
SetSelectedItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452
11
ClearBasic Control Reference
Contents
Collapse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453
Expand . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454
NodeClick . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455
UpDown control
Max. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
Min . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460
Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
Change . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462
DownClick. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463
UpClick . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464
Index
12
ClearBasic Control Reference
About This Guide
This reference provides information about the ClearBasic controls and their methods,
properties, and events. It is a companion volume to the ClearBasic Object Reference,
which provides information about the ClearBasic objects. This reference is also a
companion to the ClearBasic Programmer’s Guide, which provides information about
using ClearBasic to perform tasks, and to the ClearBasic Language Reference, which
documents the ClearBasic language.
Related Documentation
The following referenced documentation is available on the CeFO Documentation
CD-ROM:
■ ClearBasic Object Reference
■ ClearBasic Programmer’s Guide
■ ClearBasic Language Reference
■ ClearBasic Customization Guide
■ User Interface Editor Guide
The online version of this document also introduces the use of live links. The control
description contains the list of methods, properties, and events for the control.
Clicking one of these entries takes you to the description of that entry. In addition, the
See Also sections associated with individual entries now contain live links to elements
within the same book. References to objects, methods, properties, or events outside of
this book do not use live links.
Conventions
These special formats are used:
NOTE: Provides additional information that is useful but not always essential.
More Information: Refers you to other sections of this guide or to other documents for more
information.
CAUTION: Highlights important situations that could potentially damage data or cause
system failure.
Description The ActiveX control lets you incorporate third-party controls into your forms. You
can use any control that conforms to the ActiveX interface. For more information, see
the User Interface Editor Guide
Referring to ActiveX You cannot create control objects directly using ClearBasic code. You must associate
Controls controls with a form, frame, or tab using the User Interface Editor. When the form,
frame, or tab is subsequently displayed, the corresponding control object is created
automatically.
If you need to refer to a control object explicitly, such as when passing a control object
as a method parameter, use a variable of type Control to refer to the control object.
For example, you would use the following code to obtain a reference to the ActiveX
control called YourActiveXControl:
Dim YourControl As Control
Set YourControl = YourActiveXControl
Methods The methods available for an ActiveX control are defined by the control vendor. See
the documentation that came with your control for a complete list.
Properties The properties available for an ActiveX control are defined by the control vendor. See
the documentation that came with your control for a complete list.
16
ClearBasic Control Reference
Animation control
Description An animation control handles the display of a movie clip in AVI (Audio Video
Interleaved) format. Movie clips are stored in an AVI clip file, which is a self-
contained file containing the video and audio information.
You can use this control to display only simple movie clips. The movie clips you
associate with this control must meet the following criteria:
■ The clip must contain exactly ONE video stream.
■ The video stream must have at least one frame.
■ There can be at most TWO streams in the AVI clip file. (The other stream must
be an audio stream.)
■ The clip must be either uncompressed or compressed using RLE8 compression.
Other compression formats are not supported.
■ The video stream must not contain any palette changes
Animation controls display only the video portion of a movie clip. If the AVI clip file
contains an audio stream, the control ignores that stream.
To load a new AVI clip file into the control, call the control’s Open method. This
method opens the clip file and prepares it for playback. To close a clip file, call the
Close method.
If the control’s AutoPlay property was set to Yes in the User Interface Editor, the Open
method opens the clip file and begins playing the entire movie clip. If the AutoPlay
property is set to No, you must call the Play method to initiate playback. The Play
method lets you specify the start and end frames of the movie clip and control the
number of times the clip is repeated.
If a movie clip is larger or smaller than the control rectangle in which it appears, the
Animation control does not attempt to scale the movie clip. As a result, larger clips
may be partially obscured and smaller clips may leave some empty space. In both
cases, the upper-left corner of the movie clip frame is always situated in the upper-left
corner of the control rectangle.
Referring to You cannot create control objects directly using ClearBasic code. You must associate
Animation Controls controls with a form, frame, or tab using the User Interface Editor. When the form,
frame, or tab is subsequently displayed, the corresponding control object is created
automatically.
If you need to refer to a control object explicitly, such as when passing a control object
as a method parameter, use a variable of type Control to refer to the control object.
For example, you would use the following code to obtain a reference to the animation
control called YourAnimationControl:
Dim YourControl As Control
Set YourControl = YourAnimationControl
Properties This object supports the following properties. Properties marked with [C] are
documented with the Control object.
■ ControlType property [C]
■ Height property [C]
■ Id property [C]
■ Left property [C]
■ Name property [C]
■ Top property [C]
■ Visible property [C]
■ Width property [C]
18
ClearBasic Control Reference
Animation control
method Close
Syntax YourControl.Close
Applies To Animation
Description The Close method closes the AVI clip file associated with the Animation control. If
the control does not have a clip file associated with it, this method does nothing.
After calling this method, the Animation control displays an empty space until you
load another clip file. To load a new clip file, call the Open method.
Example The following example illustrates one way to use the Close method. The movie clip
is closed when the user clicks the Close button. The name of the animation control is
animControl.
Sub Close_Click()
animControl.Close
End Sub
Close 19
ClearBasic Control Reference
Animation control
method Open
Description The Open method opens the specified AVI clip file and prepares it for playback. If the
control’s AutoPlay property is set to False, your code must call the Play method to
begin playback of the movie clip.
If the control’s AutoPlay property is set to True, this method begins playing the movie
clip immediately after it is opened. The entire movie clip is played repeatedly until the
Close method is called. To play only a selection of the movie clip, you must set the
AutoPlay property to No and then call the Play method.
Return Values Returns True if it successfully opens and prepares the clip file, otherwise returns False.
Example The following example uses the Open method to open a new AVI clip file. The name
of the clip file is stored in the FileName text box control. The name of the animation
control is animControl.
Sub OpenFile_Click()
Dim strName as string
strName = FileName.Value
ret = animControl.Open(strName)
End Sub
20 Open
ClearBasic Control Reference
Animation control
method Play
Description The Play method plays the movie clip associated with this animation control. The
movie clip is played in a background thread so that other tasks may continue.
If you only want to play a portion of the movie clip, specify values for the Start and
End parameters. These values let you specify the beginning and ending frames of the
movie clip. If you specify a Repeat value, only the portion between the Start and
End frames is repeated.
Return Values This method returns True if it began playing the movie clip, otherwise it returns False.
Example The following example illustrates how to begin playing the movie clip. When the
Start button is pressed, the animControl animation control begins playing its
current movie clip.
Sub Start_Click()
ret = animControl.Play()
End Sub
Play 21
ClearBasic Control Reference
Animation control
method Stop
Syntax YourControl.Stop
Description The Stop method stops the movie clip currently being played. If no clip is being
played, this method does nothing.
Example The following example illustrates how to stop the playback of a movie clip. When the
Stop button is pressed, the animControl animation control stops playing its current
movie clip.
Sub Stop_Click()
animControl.Stop
End Sub
22 Stop
ClearBasic Control Reference
Bitmap control
Description The Bitmap control is a static control for displaying graphics on your form. You can
use the bitmap control to display background graphics or icons. For more
information, see the User Interface Editor Guide
Referring to Bitmap You cannot create control objects directly using ClearBasic code. You must associate
Controls controls with a form, frame, or tab using the User Interface Editor. When the form,
frame, or tab is subsequently displayed, the corresponding control object is created
automatically.
If you need to refer to a control object explicitly, such as when passing a control object
as a method parameter, use a variable of type Control to refer to the control object.
For example, you would use the following code to obtain a reference to the Bitmap
control called YourBitmapControl:
Dim YourControl As Control
Set YourControl = YourBitmapControl
Properties This object supports the following properties. Properties marked with [C] are
documented with the Control object.
■ ControlType property [C]
■ Height property [C]
■ Id property [C]
■ Left property [C]
■ Name property [C]
■ Top property [C]
■ Visible property [C]
■ Width property [C]
24
ClearBasic Control Reference
Check Box control
Description The check box control represents a two-state button you can use to store user
selections. Typically, you use check boxes to provide the user with simple Yes/No or
True/False choices.
The state of a check box control is independent from all other check box controls. This
distinguishes check boxes from option buttons, which support the selection of only
one button in a group of option buttons.
You can use a check box control to set or retrieve the current value of a check box. The
Value property keeps track of the check box control’s current value.
Referring to Check You cannot create control objects directly using ClearBasic code. You must associate
Box Controls controls with a form, frame, or tab using the User Interface Editor. When the form,
frame, or tab is subsequently displayed, the corresponding control object is created
automatically.
If you need to refer to a control object explicitly, such as when passing a control object
as a method parameter, use a variable of type Control to refer to the control object.
For example, you would use the following code to obtain a reference to the check box
control called YourCheckBoxControl:
Dim YourControl As Control
Set YourControl = YourCheckBoxControl
Source At design time, you have the option of linking a source contextual object to this
control. When a form containing the check box is displayed, the label for the control is
retrieved from the source contextual object. If you do not assign a source contextual
object, the control obtains the label from the Caption property of its property sheet.
Using a source contextual object is advantageous in situations where you may want
the label of the check box control to change dynamically. For example, you could
assign a contextual object whose contents contained the value in a particular database
field. As the value in that field change, so does the control label.
NOTE: Whether you use a source contextual object or a fixed string for the check box label,
you can always change the label by assigning a new value to the control’s Caption property.
Destination At design time, you must link a destination contextual object to the control to store the
value for that control. The destination contextual object must contain a Long integer
value. When the check box is checked, it stores the value 1 in this contextual object;
otherwise it stores the value 0 in the contextual object.
Methods This object supports the following methods. Methods marked with a [C] are
documented with the Control object.
■ Refresh method [C]
■ SetFocus method [C]
Properties This object supports the following properties. Properties marked with [C] are
documented with the Control object.
■ Caption property
■ ControlType property [C]
■ DataChanged property
■ Enabled property [C]
■ Height property [C]
■ hWnd property [C]
■ Id property [C]
■ Left property [C]
■ Name property [C]
■ Parent property
■ Tag property
■ Top property [C]
■ Value property
■ Visible property [C]
■ Width property [C]
Events This object supports the following events. Events marked with a [C] are documented
with the Control object.
■ Click event
■ GotFocus event [C]
■ LostFocus event [C]
26
ClearBasic Control Reference
Check Box control
property Caption
Description The Caption property contains a string with the label currently displayed by the
check box control. You assign the initial value for this property at design time by
modifying the values on the control’s property sheet. If the control uses a source
contextual object, the initial value for this property is obtained from that object.
You can change the control’s label at runtime by assigning a new string value to this
property. If you plan to change the control’s label at runtime, set the AutoSize
property of the control to Yes in the User Interface Editor. The AutoSize property
expands the control size to accommodate the new label.
If the control uses a source contextual object for the label, getting this property returns
the value in the contextual object. Assigning a value to this property changes the
value in the source contextual object. If the source contextual object is linked to a
database field, the value in that field is also updated to reflect the changes.
IMPORTANT: On some platforms, your caption changes may not persist when you display or
redisplay the form. If this happens, modify the corresponding Form_Load event procedure
and have it set the caption for the control explicitly.
Caption 27
ClearBasic Control Reference
Check Box control
property DataChanged
Description The DataChanged property contains a boolean value indicating whether the user
modified the contents of this control. This value only indicates whether modifications
were made by the user; it does not reflect changes made to the control by your
ClearBasic code.
If you modify the control programmatically, you can set this property to reflect your
changes. Set this property to True to indicate you made modifications; otherwise, set it
to False to indicate the control is unchanged.
28 DataChanged
ClearBasic Control Reference
Check Box control
property Parent
Description The Parent property returns the form that contains the control. This property is read-
only.
Parent 29
ClearBasic Control Reference
Check Box control
property Tag
Description The Tag property contains a custom string that you can assign at runtime. You can
use this string to identify the object internally in your application. You can also use
this property to store extra information about the object.
30 Tag
ClearBasic Control Reference
Check Box control
property Value
Description The Value property contains the current value in the check box control. This value
corresponds to the check box state seen by the user. The value in this property is 1 if
the control is checked, otherwise 0.
NOTE: The value in this property may not coincide with the value currently in the control’s
destination contextual object. You can call the control’s Refresh method to synchronize the
two values.
You can assign a new value to this property to change the current state of the control.
Changing the value in this property also changes the value in the associated
destination contextual object.
Value 31
ClearBasic Control Reference
Check Box control
event Click
Description The Click event occurs when the user presses and releases the mouse button with
the cursor on or in the control. You can use this event to respond to user interactions
with the control.
32 Click
ClearBasic Control Reference
Command Button control
Description A command button implements a push button you can use to trigger actions. You can
associate command buttons with CeFO-defined actions or with actions you define.
You can also associate a Click event handler with a button to implement your actions
in ClearBasic.
If you use ClearBasic with your command buttons, you can use this object to retrieve
information about the command button. In addition to the common control
properties, the command button control contains additional properties such as the
color of the button and its label, the label text, and whether the button is the default
button of the form.
To implement button actions using ClearBasic, define a Click event for your button.
In your event handler, you can access the command button control methods and
properties, or any other objects using ClearBasic code.
Referring to You cannot create control objects directly using ClearBasic code. You must associate
Command Button controls with a form, frame, or tab using the User Interface Editor. When the form,
Controls frame, or tab is subsequently displayed, the corresponding control object is created
automatically.
If you need to refer to a control object explicitly, such as when passing a control object
as a method parameter, use a variable of type Control to refer to the control object.
For example, you would use the following code to obtain a reference to the command
button control called YourButtonControl:
Dim YourControl As Control
Set YourControl = YourButtonControl
Source At design time, you have the option of linking a source contextual object to this
control. When a form containing the command button is displayed, the label for the
control is retrieved from the source contextual object. If you do not assign a source
contextual object, the control obtains the label from the Caption property of its
property sheet.
Using a source contextual object is advantageous in situations where you may want
the label of the command button control to change dynamically. For example, you
could assign a contextual object whose contents contained the value in a particular
database field. As the value in that field change, so does the control label.
NOTE: Whether you use a source contextual object or a fixed string for the command button
label, you can always change the label by assigning a new value to the control’s Caption
property.
Methods This object supports the following methods. Methods marked with a [C] are
documented with the Control object.
■ Refresh method [C]
■ SetFocus method [C]
Properties This object supports the following properties. Properties marked with [C] are
documented with the Control object.
■ BackColor property
■ Caption property
■ ControlType property [C]
■ Default property
■ Enabled property [C]
■ ForeColor property
■ Height property [C]
■ hWnd property [C]
■ Id property [C]
■ Left property [C]
■ Name property [C]
■ Parent property
■ Tag property
■ Top property [C]
■ Value property
■ Visible property [C]
■ Width property [C]
Events This object supports the following events. Events marked with a [C] are documented
with the Control object.
■ Click event
■ GotFocus event [C]
■ LostFocus event [C]
34
ClearBasic Control Reference
Command Button control
property BackColor
Description The BackColor property allows you to set the background color of a control. You can
set this property directly for the control, or indirectly by setting the property on the
contextual object that is linked to the control.
Before using this property, you must establish a color scheme using either the
CreateColorScheme or SetColorScheme method.
IMPORTANT: Before you can set back or fore colors, you must first create a color scheme (see
CreateColorScheme) that maps available system colors to labels. Then you must use
SetColorScheme to assign that color-to-label mapping to the form where you want to
perform the coloring. The reason for this is that you must specify the label, not the system
color, when you set BackColor or ForeColor.
If you perform color operations on controls that do not support color, no errors are
generated; the controls simply won’t be colored. This may be useful information if
you want to use multiplatform color operations where color may not be universally
supported for a given control type. For example, the Command Button may be
colored in UNIX, but not on the Macintosh.
Setting Description
ColorLabel You must specify a label that is mapped to a valid system color. The
label must be in the color scheme that is currently in effect for the form
in which you are performing color operations. (See
CreateColorScheme and SetColorScheme.)
Example The following code illustrates how you use color in ClearBasic. (You are not required
to set color in the form load event procedure.)
Before you set the color properties, you must create a color scheme and set it into
effect, as shown in the example. Only then can you color the object you want to color.
In this example, the text box label and the command button foreground text are
assigned the same color, red, and the background color for the text box is set to cyan.
Sub Initialize_App
Dim LabelList1 As New List
Dim ColorList1 As New List
LabelList1.AppendItem "Urgent", _
"Important", "Weak"
ColorList1.AppendItem "red", _
BackColor 35
ClearBasic Control Reference
Command Button control
"cyan", "blue"
App.CreateColorScheme "Form2020", _
LabelList1,ColorList1
End Sub
Sub Form_Load
App.SetColorScheme "Form2020"
Btn1_Label.ForeColor = "Urgent"
Btn1.ForeColor = "Urgent"
Btn1.BackColor = "Important"
End Sub
See Also CreateColorScheme method (App object in the ClearBasic Object Reference)
SetColorScheme method (App object in the ClearBasic Object Reference)
36 BackColor
ClearBasic Control Reference
Command Button control
property Caption
Description Use the Caption property to get or set the text label for the control. If you want to
assign a new value to this property at runtime, make sure you set the Autosizable
property of the control to Yes in the User Interface Editor.
The Caption property works on a control whether you assigned it a fixed text label
or whether you linked the control to a source contextual object. If the control is linked
to a source contextual object, modifying this property also modifies the value in the
specified field of that contextual object.
IMPORTANT: On some platforms, your caption changes may persist when you display or
redisplay the form. If this happens, set the caption in the Form_Load event procedure for that
form. Also, if the control supports labeling through use of a source contextual object, and you
make this source link at design time, you can use the Fill method on the contextual object to get
the caption to display properly.
One way to use the caption property is to change the caption on a control during the
execution of some procedure to indicate that the procedure is executing.
Setting Description
CaptionTextString Specify the text string.
The default caption is the string defined for the form or control at
design time using the User Interface Editor.
Return Values In read mode, this property returns the title of the control or form. If the control is
source linked to a contextual object field, the value of the field is returned.
Caption 37
ClearBasic Control Reference
Command Button control
property Default
Description The Default property contains a boolean value indicating whether the command
button is the default button of its form. In addition to receiving mouse clicks like other
buttons, the default button also receives a Click event when the user presses the
Enter key while its form is active.
Setting this property to True makes this button the default button of the form. Setting
this property to False resets the default button to the one that was specified using the
User Interface Editor.
If you set this button to be the form’s default button at design time using the User
Interface Editor, you must not modify this property. For information on setting the
default button of a form using the User Interface Editor, see the User Interface Editor
Guide.
IMPORTANT: If the form containing the command button also contains a multiline text box,
do not set this property to True. Doing so would prevent users from entering carriage returns
in the text box.
38 Default
ClearBasic Control Reference
Command Button control
property ForeColor
Description The ForeColor property allows you to set the color of the control label text. You can
set this property directly for the control, or indirectly by setting the property on the
contextual object that is linked to the control.
Before using this property, you must establish a color scheme using either the
CreateColorScheme or SetColorScheme method.
IMPORTANT: Before you can set back or fore colors, you must first create a color scheme (see
CreateColorScheme) that maps available system colors to labels. Then you must use
SetColorScheme to assign that color-to-label mapping to the form where you want to
perform the coloring. The reason for this is that you must specify the label, not the system
color, when you set BackColor or ForeColor.
If you perform color operations on controls that do not support color, no errors are
generated; the controls simply won’t be colored. This may be useful information if
you want to use multiplatform color operations where color may not be universally
supported for a given control type. For example, the Command Button may be
colored in UNIX, but not on the Macintosh.
Setting Description
ColorLabel You must specify a label that is mapped to a valid system color. The
label must be in the color scheme that is currently in effect for the form
in which you are performing color operations. (See
CreateColorScheme and SetColorScheme.)
Example The following code illustrates how you use color in ClearBasic. (You are not required
to set color in the form load event procedure.)
Before you set the color properties, you must create a color scheme and set it into
effect, as shown in the example. Only then can you color the object you want to color.
In this example, the text box label and the command button foreground text are
assigned the same color, red, and the background color for the text box is set to cyan.
Sub Initialize_App
Dim LabelList1 As New List
Dim ColorList1 As New List
ForeColor 39
ClearBasic Control Reference
Command Button control
End Sub
Sub Form_Load
App.SetColorScheme "Form2020"
TextBox1_Label.ForeColor = "Urgent"
TextBox1.ForeColor = "Urgent"
TextBox1.BackColor = "Important"
End Sub
See Also CreateColorScheme method (App object in the ClearBasic Object Reference)
SetColorScheme method (App object in the ClearBasic Object Reference)
40 ForeColor
ClearBasic Control Reference
Command Button control
property Parent
Description The Parent property contains the form object that owns the button. You can use this
property to retrieve a reference to the form object containing the button.
Parent 41
ClearBasic Control Reference
Command Button control
property Tag
Description The Tag property contains a custom string that you assign at runtime. You can use
this string to identify the command button control internally to your application. You
can also use this property to store extra information about the control.
42 Tag
ClearBasic Control Reference
Command Button control
property Value
Description The Value property lets you simulate a user click in the command button. The Value
property for a command button is normally set to 0. When you set it to 1, the button
initiates its Click event handler and resets the property to 0.
Value 43
ClearBasic Control Reference
Command Button control
event Click
Description The Click event handler for your button is called when a user or program action
triggers the command button. Your Click event handler is called in the following
situations:
■ the user clicks the button using the mouse.
■ the user presses the Enter key while this button is the default button.
■ your code sets the Value property of the command button control to 1.
44 Click
ClearBasic Control Reference
Control object
Description The Control object is the physical representation of controls in ClearBasic. You use this
object only in situations where you need to pass a control to a ClearBasic procedure or
function. To use this object, declare a variable of type Control and then set the
variable to the control you want to reference, as shown in the following example:
Dim YourControl As Control
Set YourControl = YourCheckBox1
A procedure or function that receives a Control object can use the ControlType
property to determine the control’s exact type. The code can use this information to
perform different operations for different control types, as shown in the following
example:
Sub ProcessControlInfo(ctrl_obj as Control)
Select Case ctrl_obj.ControlType
Case "CheckBox"
' Process checkboxes
Case "Text Box"
' Process text boxes
...
End Select
End Sub
For more information on ClearBasic controls, refer to the descriptions for each of the
controls.
Common Control Whenever you need information about the methods, properties, or events of a specific
Information control, the first place to look is the documentation for that control. The
documentation for each control always contains the most up-to-date information
about the control, including a complete list of its methods, properties, and events.
Some controls list methods, properties, and events as being documented with the
Control object. An entry marked this way indicates common functionality that is
shared by all controls. The documentation for these entries is included with the
Control object. The following sections describe the common control functionality.
Control Properties Most controls have a visual interface that the user can interact with on a form. You can
access some of the properties governing this interface at runtime using ClearBasic
code. For example, you can use the Left, Right, Height, and Width properties of a
control to determine the control’s bounding rectangle. The hWnd property available
for some controls gives you access to the native platform data structure associated
with the control.
46
ClearBasic Control Reference
Control object
Controls also contain several properties that are useful for identification purposes.
The Name property contains the name you assigned to the control using the User
Interface Editor. The Id property contains the form-specific ID associated with the
control.
State information for controls is maintained in two properties. The Visible and
Enabled properties control the end user’s ability to see and modify the control. You
can modify both of these properties at runtime to change the state of the control.
NOTE: The Select CBX control coordinates the interactions between several other controls and
does not have an interface of its own. As a result, Select CBX does not support any of the
common properties supported by other controls.
Managing the Focus When ClarifyCRM eFrontOffice displays a form, it assigns the focus to one of the
form’s controls. Only one control at a time may own the focus for a given form.
The control with the focus is the control that responds when certain keys are typed on
the keyboard. For example, focused buttons simulate a click in the button whenever
the user presses the Enter key. Other controls may respond to the arrow keys or other
navigation related keys.
A control can receive the focus as a result of any of the following actions:
■ At run time, a user clicks on the control to select it.
■ At run time, a user selects the control using an access key, such as the Tab key
or one of the Arrow (←→↑ ↓) keys.
■ A CB procedure or function calls the SetFocus method of the control.
Changes in focus are accompanied by calls to the LostFocus and GotFocus event
handlers of the appropriate controls. If your controls need to respond to changes in
focus, you can use these event handlers to implement your response.
Methods Most controls support the following methods. See the specific control for an exact list
of the methods it supports.
■ Refresh method
■ SetFocus method
47
ClearBasic Control Reference
Control object
Properties Most controls support the following properties. See the specific control for an exact
list of the properties it supports.
■ ControlType property
■ Enabled property
■ Height property
■ hWnd property
■ Id property
■ Left property
■ Name property
■ Top property
■ Visible property
■ Width property
Events Most controls support the following events. See the specific control for an exact list of
the events it supports.
■ GotFocus event
■ LostFocus event
48
ClearBasic Control Reference
Control object
method Refresh
Syntax YourControl.Refresh
Applies To Control
Description The Refresh method forces the control to redraw itself. This method also causes the
control to retrieve updated information from its contextual objects, if any. You can call
this method after a series of operations to update the appearance of the control.
In order to save time during operations, some methods and functions do not
automatically redraw the appearance of controls. In those situations, you can call this
method to update the display of a specific control.
Parameters None
See Also Refresh method (ContextualObject object in the ClearBasic Object Reference)
Refresh 49
ClearBasic Control Reference
Control object
method SetFocus
Syntax YourControl.SetFocus
Applies To Control
Description The SetFocus method acquires the focus for the specified control. You can use this
method to direct system-level events such as keystrokes to the control.
When you call this method, ClearBasic sends a LostFocus event to the control that
currently owns the focus. It then sends a GotFocus event to notify the specified
control that it has received the focus.
Parameters None
50 SetFocus
ClearBasic Control Reference
Control object
property ControlType
Syntax YourControl.ControlType
Applies To Controls
Description The ControlType property contains a string describing the type of the control. If
you need to pass a control object as a parameter to a method, you can use this
property to verify the control type on the receiving end.
This property is read-only and can return one of the following strings:
String Control
"Animation" Animation
"CheckBox" Check box
"CommandButton" Command button
"Control" Graph
"CustomList" Grid
"Dropdown ComboBox" Dropdown Combo Box
"Dropdown ListBox" Dropdown List Box
"GroupBox" Group Box
"Label" Label
"Line" Line
"ListBox" List Box
"Multiline TextBox" Multiline Text Box
"OptionButton" Option Button
"PictureBox" Bitmap
"ProgressBar" Progress Bar
"Slider" Slider
"Tab" Tab
"Text Box" Text Box
"TreeView" Treeview
"UpDown" UpDown
NOTE: ActiveX and Select CBX controls do not support the ControlType property.
str1 = List_B1.ControlType
If str1 = "ListBox" Then
logstring = "The control type is List Box"
ControlType 51
ClearBasic Control Reference
Control object
Else
logstring = "The control type is " + str1
End If
End Sub
52 ControlType
ClearBasic Control Reference
Control object
property Enabled
Applies To Control
Description The Enabled property contains a boolean value indicating whether or not the control
is enabled. You can enable or disable the control by changing the value in this
property. Specify True to enable the control; specify False to disable it.
See Also EnableControls method (Form object in the ClearBasic Object Reference)
DisableControls method (Form object in the ClearBasic Object Reference)
Enabled 53
ClearBasic Control Reference
Control object
property Height
Applies To Control
Description The Height property contains an integer value indicating the height of the control (in
pixels). This property is read-only.
IMPORTANT: At design time in the User Interface Editor, the size of the form and controls are
created with machine-independent coordinates. At runtime, these coordinates are replaced
with machine-dependent coordinates, which can result in slight variations in size properties
for forms and controls.
54 Height
ClearBasic Control Reference
Control object
property hWnd
Applies To Control
Description The hWnd property contains the native platform designator (handle) for the control.
You can use this property in situations where you need to pass the control to a C
function available at runtime. This property is read-only.
Do not cache the value in this property. The hWnd property of a control can change at
runtime. If you store a previous version, it may be invalid by the time you need to use
it.
Example In the following test procedure, a check box handle is returned as a string to be
displayed in a text box. The text box Text property is then checked to make sure the
handle was passed properly.
Sub CheckHandle
Results_TBox.text=str$(Checkbox1.hWnd)
hWnd 55
ClearBasic Control Reference
Control object
property Id
Applies To Control
Description The Id property contains an integer value that identifies a control relative to its form.
The User Interface Editor assigns the value of this property automatically at design
time.
Control IDs are unique within the form containing the controls. However, controls on
different forms may use the same control ID.
56 Id
ClearBasic Control Reference
Control object
property Left
Applies To Control
Description The Left property contains an integer indicating the position of the left edge of the
control. The position is measured in pixels. This property is read-only.
IMPORTANT: At design time in the User Interface Editor, the size of the form and controls are
created with machine-independent coordinates. At runtime, these coordinates are replaced
with machine-dependent coordinates, which can result in slight variations in size properties
for forms and controls.
Left 57
ClearBasic Control Reference
Control object
property Name
Applies To Control
Description The Name property contains a string with the name of the control. You can use this
string as a unique identifier for controls on a given form. You must assign the name of
the control at design time using the User Interface Editor.
58 Name
ClearBasic Control Reference
Control object
property Top
Applies To Control
Description The Top property contains an integer indicating the position of the top edge of the
control. The position is measured in pixels. This property is read-only.
IMPORTANT: At design time in the User Interface Editor, the size of the form and controls are
created with machine-independent coordinates. At runtime, these coordinates are replaced
with machine-dependent coordinates, which can result in slight variations in size properties
for forms and controls.
Top 59
ClearBasic Control Reference
Control object
property Visible
Applies To Control
Description The Visible property contains a boolean value that determines whether the control
is hidden or visible. You can read this property to determine the control’s current
visibility or you can set the property to change the visibility. Other methods such as
ShowControls and ShowControlsDeep may also set the value of this property.
Set this property to False to hide the control. Set it to True to make the control visible.
See Also ShowControls method (Form object in the ClearBasic Object Reference)
ShowControlsDeep method (Form object in the ClearBasic Object Reference)
60 Visible
ClearBasic Control Reference
Control object
property Width
Applies To Control
Description The Width property contains an integer value indicating the width of the control (in
pixels). This property is read-only.
IMPORTANT: At design time in the User Interface Editor, the size of the form and controls are
created with machine-independent coordinates. At runtime, these coordinates are replaced
with machine-dependent coordinates, which can result in slight variations in size properties
for forms and controls.
Width 61
ClearBasic Control Reference
Control object
event GotFocus
Applies To Control
Description The GotFocus event notifies a control that it has received the focus. This event occurs
immediately after the control actually receives the focus. The control must be enabled
and visible to receive this event.
The focus determines which control receives keyboard events. You can use your
GotFocus event handler to update the control’s appearance or state information.
Controls do not gain focus as the result of user selections in the menu bar.
Example The following example illustrates the use of the GotFocus and LostFocus events.
Sub YourControl_GotFocus
Debug.Print "Your control got focus."
End Sub
Sub YourControl_LostFocus
Debug.Print "Your control lost focus."
End Sub
62 GotFocus
ClearBasic Control Reference
Control object
event LostFocus
Applies To Control
Description The LostFocus event notifies the control that it is about to lose the focus. This event
occurs immediately before the control actually loses the focus. The control must be
enabled and visible to receive this event.
The focus determines which control receives keyboard events. You can use your
LostFocus event handler to validate control information or handle any focus-related
updates.
Controls do not lose focus as the result of user selections in the menu bar. Controls
also do not lose focus when the user clicks one of the window’s built-in scroll bars.
Example The following example illustrates the use of the GotFocus and LostFocus events.
Sub YourControl_GotFocus
Debug.Print "Your control got focus."
End Sub
Sub YourControl_LostFocus
Debug.Print "Your control lost focus."
End Sub
LostFocus 63
ClearBasic Control Reference
Control object
64 LostFocus
ClearBasic Control Reference
Dropdown Combo Box
control
Description The dropdown combo box control consists of a writable text box with a dropdown list
box arrow. The text box displays only the selected item from among a list of items. The
remaining list items are displayed when the dropdown list box arrow is clicked. (The
dropdown combo box control is similar to the dropdown list box control except that
the dropdown list box control is read-only.)
The user can select an item from the dropdown combo box control in one of the
following ways:
■ By clicking the dropdown list box arrow and selecting an item from the
displayed list
■ By typing the name of the item in the text box. (The item name must be an item
in the item list.)
You should use this control to display a list of items when space is limited and you
expect the user to know what’s on the list. For example, you might want to use this
control to allow the user to select from among a list of states or provinces in your
country.
You can use the methods of the dropdown combo box control to modify the list at
runtime. You can add new items to the list or remove existing items. You can move
existing items up or down in the list. You can also get and set the current selection for
the list.
This control does not include a label automatically. To add a label, create a label
control and place it next to this control.
Referring to You cannot create control objects directly using ClearBasic code. You must associate
Dropdown Combo controls with a form, frame, or tab using the User Interface Editor. When the form,
Box Controls frame, or tab is subsequently displayed, the corresponding control object is created
automatically.
If you need to refer to a control object explicitly, such as when passing a control object
as a method parameter, use a variable of type Control to refer to the control object.
For example, you would use the following code to obtain a reference to the dropdown
combo box control called YourDDComboBoxControl:
Dim YourControl As Control
Set YourControl = YourDDComboBoxControl
Source The source contextual object of a dropdown combo box control stores the list of items
to be displayed in the control. Each item in the list is a string containing the text to
display for the item. You can specify the items for this list at design time using the
User Interface Editor or at runtime using the methods of the dropdown combo box
control.
Destination The destination contextual object of a dropdown combo box control stores the list item
that is currently selected. This contextual object must specify a string data type.
Methods This object supports the following methods. Methods marked with a [C] are
documented with the Control object.
■ AppendItem method
■ Clear method
■ Contains method
■ Down method
■ GetList method
■ GetSelected method
■ Refresh method [C]
■ RemoveByItem method
■ RemoveItem method
■ RemoveSelected method
■ ReplaceItem method
■ SelectedIndexes method
■ SelectedList method
■ SetFocus method [C]
■ SetSelected method
■ UnSelect method
■ Up method
66
ClearBasic Control Reference
Dropdown Combo Box control
Properties This object supports the following properties. Properties marked with [C] are
documented with the Control object.
■ ControlType property [C]
■ DataChanged property
■ Enabled property [C]
■ Height property [C]
■ hWnd property [C]
■ Id property [C]
■ Left property [C]
■ ListCount property
■ ListIndex property
■ Name property [C]
■ NewIndex property
■ Parent property
■ Selected property
■ Sorted property
■ Tag property
■ Top property [C]
■ Value property
■ Visible property [C]
■ Width property [C]
Events This object supports the following events. Events marked with a [C] are documented
with the Control object.
■ Click event
■ GotFocus event [C]
■ LostFocus event [C]
67
ClearBasic Control Reference
Dropdown Combo Box control
method AppendItem
Description The AppendItem method appends a single item or list of items to the control. The
control must have a source contextual object to store the items added by this method.
This method automatically updates the items in the source contextual object.
You can use this method in a Form_Load procedure to initialize the control. If you
had not previously initialized the control’s source contextual object, you must do so
by calling its Fill method before calling this method.
This method updates the value in the NewIndex property to reflect the index of the
newly added item. When you add a list of items, the NewIndex property reflects the
index of the first item in the list.
Example In the following example, NewCourse is added to the combo box Combo1, then the
combo box is refreshed to display the added item.
Sub AppendToControl
Combo1.AppendItem "NewCourse"
Combo1.Refresh
End Sub
68 AppendItem
ClearBasic Control Reference
Dropdown Combo Box control
method Clear
Syntax YourControl.Clear
Description The Clear method removes all of the items from the dropdown combo box control
and from the control’s source contextual object. This method also resets the value of
the NewIndex property to -1.
After calling this method, call the form’s ForceRedraw method to update the
control’s display.
Parameters None
Clear 69
ClearBasic Control Reference
Dropdown Combo Box control
method Contains
Description The Contains method returns a boolean value indicating whether the specified item
is in the list.
Return Values Returns True if the item is already in the control, or False if the item is not in the
control.
Example The following test routine shows one use of the Contains method. In the example,
the method is used to verify that an item has been properly added to a control.
Notice that the count of items in the control is taken before the new item is added.
This means that the index of Clover should be equal to the count.
Sub TestSub_Click
Dim I As integer
Dim J As integer
I= ComboBox1.ListCount
ComboBox1.AppendItem "Clover"
ComboBox1.Refresh
J= ComboBox1.NewIndex
If (J = I) Then
If ComboBox1.Contains("Clover") Then
App.MsgBox "Clover is here!"
Else
App.MsgBox "Clover is not here!"
End If
Else
App.MsgBox "Item not added properly"
End If
End Sub
70 Contains
ClearBasic Control Reference
Dropdown Combo Box control
method Down
Syntax YourControl.Down
Description The Down method moves the currently selected item down one position in the
control’s list. Any displaced items are moved up to make room for the item. If the
selected item is already at the bottom of the list, it remains there.
Parameters None
Example In the following example, a loop loads five strings into an empty dropdown combo
box. The strings are sequenced Item 1 to Item 5, and Item 2 is moved down. At this
point, the index of Item 2 should become 2 and the index of Item 3 should become 1.
GetList is used to check this, returning the item at index 1 in the control. If Item 3 is at
that index, the appropriate notification is stored in Logstr.
Sub DownTest
Dim Hold1 As string
Dim Logstr As string
Combo1.clear
For i = 1 to 5
Combo1.AppendItem "item"+Str$(i)
Combo1.Refresh
Next i
Hold1 = Combo1.GetList(1)
Down 71
ClearBasic Control Reference
Dropdown Combo Box control
method GetList
Description The GetList method returns items currently in the dropdown combo box. If you
specify an index of an item in the list, this method returns that item. If you do not
specify any parameters, this method returns the entire list of items.
The source contextual object associated with the control must be initialized before
calling this method.
Return Values Returns a List object containing zero or more strings. Each string in the list
corresponds to an item in the dropdown combo box control.
If the Index parameter was specified, this method returns a String containing the text
of the desired item.
Example In the following example, a loop loads five strings into an empty dropdown combo
box. The strings are sequenced Item 1 to Item 5, and Item 2 is moved down. At this
point, the index of Item 2 should become 2 and the index of Item 3 should become 1.
GetList is used to check this, returning the item at index 1 in the control. If Item 3 is at
that index, the appropriate notification is stored in Logstr.
Sub DownTest
Dim Hold1 As string
Dim Logstr As string
Combo1.Clear
For i = 1 to 5
Combo1.AppendItem "item"+Str$(i)
Combo1.Refresh
Next i
Hold1 = Combo1.GetList(1)
72 GetList
ClearBasic Control Reference
Dropdown Combo Box control
GetList 73
ClearBasic Control Reference
Dropdown Combo Box control
method GetSelected
Description The GetSelected method returns the currently selected item in the dropdown
combo box control. The text for the item is returned in the SelectedItem parameter,
which you must provide when you call the method. The method returns a boolean
value indicating whether or not an item was actually selected.
74 GetSelected
ClearBasic Control Reference
Dropdown Combo Box control
method RemoveByItem
Description The RemoveByItem method removes one or more items from the dropdown combo
box control. After removing the items, this method sets the value in the NewIndex
property to -1. You can use this method to selectively remove items from the
dropdown combo box control.
As the method processes the list of items, it keeps track of those items that were not in
the control’s list. Upon completion, the method returns the list of missing items to
you. Duplicate entries are considered missing items and are therefore returned in this
list.
Return Values Returns a List object containing zero or more strings. Each string contains the name
of an item that was not in the control’s list.
RemoveByItem 75
ClearBasic Control Reference
Dropdown Combo Box control
method RemoveItem
Description The RemoveItem method removes the specified item from the dropdown combo box
control. If the specified item is currently selected, this method clears the selection
before removing the item. After removing the item, this method sets the value in the
NewIndex property to -1
76 RemoveItem
ClearBasic Control Reference
Dropdown Combo Box control
method RemoveSelected
Description The RemoveSelected method removes the currently selected items from the
dropdown combo box control. This method clears the current selection and sets the
value in the NewIndex property to -1.
Parameters None
Return Values Returns a Long integer with the number of items remaining in the control after the
removal of the selected items.
Example The following code snippet shows one application of this method. Selected items are
removed from MyControl and the number of items remaining in the control are
returned to Count. If no more items are left in the control, the REMOVE button is
disabled.
Count = MyControl.RemoveSelected
If Count = 0 Then
Remove.Enabled = False
End If
RemoveSelected 77
ClearBasic Control Reference
Dropdown Combo Box control
method ReplaceItem
Description The ReplaceItem method replaces the item at the specified index with the desired
string. This method does not affect the current selection or the value in the NewIndex
property.
78 ReplaceItem
ClearBasic Control Reference
Dropdown Combo Box control
method SelectedIndexes
This method is provided as a convenience for situations where you may want to
iterate through a group of controls and get the selected items from each.
Parameters None
Return Values Returns a List object containing zero or one long integer. The integer is a 0-based
index into the control’s list of items.
SelectedIndexes 79
ClearBasic Control Reference
Dropdown Combo Box control
method SelectedList
Description The SelectedList method returns a list containing the currently selected items in
the control. Because dropdown combo boxes only allow the selection of one item at a
time, this list can contain at most one item.
This method is provided as a convenience for situations where you may want to
iterate through a group of controls and get the selected items from each.
Parameters None
Return Values Returns a List object containing zero or more strings. Each string in the list
corresponds to a selected item in the control. If no items are selected, the returned list
is empty.
80 SelectedList
ClearBasic Control Reference
Dropdown Combo Box control
method SetSelected
Description The SetSelected method selects the specified item. If there was an existing
selection, this method clears it before selecting the new item.
Only one item at a time may be selected for a dropdown combo box control. If you
specify an item that does not exist in the control’s list, this method exits without
clearing the previous selection.
SetSelected 81
ClearBasic Control Reference
Dropdown Combo Box control
method UnSelect
Syntax YourControl.Unselect
Parameters None
82 UnSelect
ClearBasic Control Reference
Dropdown Combo Box control
method Up
Syntax YourControl.Up
Description The Up method moves the currently selected item up one position in the control’s list.
Any displaced items are moved down to make room for the item. If the selected item
is already at the beginning of the list, it remains there.
Parameters None
Up 83
ClearBasic Control Reference
Dropdown Combo Box control
property DataChanged
Description The DataChanged property contains a boolean value indicating whether the user
modified the contents of this control. This value only indicates whether modifications
were made by the user; it does not reflect changes made to the control by your
ClearBasic code.
If you modify the control programmatically, you can set this property to reflect your
changes. Set this property to True to indicate you made modifications; otherwise, set it
to False to indicate the control is unchanged.
84 DataChanged
ClearBasic Control Reference
Dropdown Combo Box control
property ListCount
Description The ListCount property contains a Long integer indicating the total number of
items in the dropdown combo box control.
ListCount 85
ClearBasic Control Reference
Dropdown Combo Box control
property ListIndex
Description The ListIndex property returns the index of the control’s currently selected item. A
dropdown combo box control always has exactly one item selected. The selected item
appears in the text box portion of the control.
List indexes are 0-based, that is, the first item is at index 0, the second at index 1, and
so on. As a result, the maximum index is always one less than the total number of
items as stored in the ListCount property.
MyRetInt = MyComboBox.ListIndex
If MyRetInt = -1 Then
App.MsgBox "No Selection"
Else
‘Do this
...
End If
End Sub
86 ListIndex
ClearBasic Control Reference
Dropdown Combo Box control
property NewIndex
Description The NewIndex property contains a long integer with the index of the most recently
added item. You can pass this index to other methods to modify (or subsequently
remove) the item.
When you add a new item, the AppendItem method updates this property to reflect
the position of any new items. Methods that remove items reset the value in this
property to -1.
NewIndex 87
ClearBasic Control Reference
Dropdown Combo Box control
property Parent
Description The Parent property contains the form object that owns the control. You can use this
property in to retrieve a reference to the form object containing the dropdown combo
box.
88 Parent
ClearBasic Control Reference
Dropdown Combo Box control
property Selected
Description The Selected property contains the item currently selected in the control. For
dropdown combo boxes, the item is a string. Dropdown combo boxes always have
exactly one item selected.
This property is provided as a convenience for situations where you may want to
iterate through a group of controls and get the selected item from each.
Selected 89
ClearBasic Control Reference
Dropdown Combo Box control
property Sorted
Description The Sorted property contains a boolean value indicating whether the items in the
control’s list are sorted. This property contains the value True if the items in the
control’s source contextual object are sorted, otherwise False.
See Also Sort method (ContextualObject object in the ClearBasic Object Reference)
90 Sorted
ClearBasic Control Reference
Dropdown Combo Box control
property Tag
Description The Tag property contains a custom string that you assign at runtime. You can use
this string to identify the control internally to your application. You can also use this
property to store extra information about the control.
Tag 91
ClearBasic Control Reference
Dropdown Combo Box control
property Value
Description The Value property contains a string with the item text for the currently selected
item. You can get this property to retrieve the item text for the selected item.
If you assign a value to this property, you must specify a string the name of the item
you want to select. This string is case-sensitive and must match the name of an item in
the list exactly. The string you specify is stored in the control’s destination contextual
object.
NOTE: It is possible to update the contents of the control’s destination contextual object
without changing the value in this property. Before getting this property, you can call the
Refresh method to ensure the control’s caches are up-to-date.
92 Value
ClearBasic Control Reference
Dropdown Combo Box control
property Click
Description The Click event handler for your dropdown combo box is called when the user
presses and releases the mouse button over the control. A Click event usually
indicates the selection of an item from the control’s list. However, this event does not
distinguish between the selection of a new item or of the same item.
You can use the Click event handler to perform other actions based on the selection
of an item.
Click 93
ClearBasic Control Reference
Dropdown Combo Box control
94 Click
ClearBasic Control Reference
Dropdown List Box control
Description The dropdown list box control consists of a read-only text box with a dropdown list
box arrow. The text box displays only the selected item from among a list of items. The
remaining list items are displayed when the dropdown list box arrow is clicked.
You should use this control to display a list of items when space is too limited to use a
list box control. This control is similar to both the list box and dropdown combo box
control. The control displays a fixed set of list items like the list box control but takes
up the same amount of space as a dropdown combo box control.
You can use dropdown list boxes to display several different types of data. When you
create the control in the User Interface Editor, you associate one of three list types to
the control. These list types let you fill the contents of the control with static items or
with items loaded dynamically from the database.
You can use the methods of the dropdown list box control to modify the contents of
the list at runtime. You can add new items to the list or remove existing items. You can
move existing items up or down in the list. You can also get and set the current
selection for the list.
This control does not include a label automatically. To add a label, create a label
control and place it next to this control.
Referring to You cannot create control objects directly using ClearBasic code. You must associate
Dropdown List Box controls with a form, frame, or tab using the User Interface Editor. When the form,
Controls frame, or tab is subsequently displayed, the corresponding control object is created
automatically.
If you need to refer to a control object explicitly, such as when passing a control object
as a method parameter, use a variable of type Control to refer to the control object.
For example, you would use the following code to obtain a reference to the dropdown
list box control called YourDDLIstBoxControl:
Dim YourControl As Control
Set YourControl = YourDDListBoxControl
Source The source contextual object of a dropdown list box control stores the list of items to
be displayed in the control. Each item in the list is a string containing the text to
display for the item. You can specify the items for this list at design time using the
User Interface Editor or at runtime using the methods of the dropdown list box
control.
Destination The destination contextual object of a dropdown list box control stores the list item
that is currently selected. This contextual object must specify a string data type.
Methods This object supports the following methods. Methods marked with a [C] are
documented with the Control object.
■ AppendItem method
■ Clear method
■ Contains method
■ Down method
■ GetList method
■ GetSelected method
■ Refresh method [C]
■ RemoveByItem method
■ RemoveItem method
■ RemoveSelected method
■ ReplaceItem method
■ SelectedIndexes method
■ SelectedList method
■ SetFocus method [C]
■ SetSelected method
■ UnSelect method
■ Up method
96
ClearBasic Control Reference
Dropdown List Box control
Properties This object supports the following properties. Properties marked with [C] are
documented with the Control object.
■ ControlType property [C]
■ DataChanged property
■ Enabled property [C]
■ Height property [C]
■ hWnd property [C]
■ Id property [C]
■ Left property [C]
■ ListCount property
■ ListIndex property
■ Name property [C]
■ NewIndex property
■ Parent property
■ Selected property
■ Sorted property
■ Tag property
■ Top property [C]
■ UserData property
■ Value property
■ Visible property [C]
■ Width property [C]
Events This object supports the following events. Events marked with a [C] are documented
with the Control object.
■ Click event
■ GotFocus event [C]
■ LostFocus event [C]
97
ClearBasic Control Reference
Dropdown List Box control
method AppendItem
Description The AppendItem method appends a single item or list of items to the control. The
control must have a source contextual object to store the items added by this method.
This method automatically updates the items in the source contextual object.
You can use this method in a Form_Load procedure to initialize the control. If you
had not previously initialized the control’s source contextual object, you must do so
by calling its Fill method before calling this method.
This method updates the value in the NewIndex property to reflect the index of the
newly added item. When you add a list of items, the NewIndex property reflects the
index of the first item in the list.
Example In the following example, NewCourse is added to the dropdown list box DDListBox1,
then the control is refreshed to display the added item.
Sub AppendToControl
DDListBox1.AppendItem "NewCourse"
DDListBox1.Refresh
End Sub
98 AppendItem
ClearBasic Control Reference
Dropdown List Box control
method Clear
Syntax YourControl.Clear
Description The Clear method removes all of the items from the dropdown list box control and
from the control’s source contextual object. This method also resets the value of the
NewIndex property to -1.
After calling this method, call the form’s ForceRedraw method to update the
control’s display.
Parameters None
Clear 99
ClearBasic Control Reference
Dropdown List Box control
method Contains
Description The Contains method returns a boolean value indicating whether the specified item
is in the list.
Return Values Returns True if the item is already in the control, or False if the item is not in the
control.
Example The following test routine shows one use of the Contains method. In the example,
Contains is used to verify that an item has been properly added to a control.
Notice that the count of items in the control is taken before the new item is added.
This means that the index of Clover should be equal to the count.
Sub TestSub_Click
Dim I As integer
Dim J As integer
I= DDListBox1.ListCount
DDListBox1.AppendItem "Clover"
DDListBox1.Refresh
J= DDListBox1.NewIndex
If (J = I) Then
If DDListBox1.Contains("Clover") Then
App.MsgBox "Clover is here!"
Else
App.MsgBox "Clover is not here!"
End If
Else
App.MsgBox "Item not added properly"
End If
End Sub
100 Contains
ClearBasic Control Reference
Dropdown List Box control
method Down
Syntax YourControl.Down
Description The Down method moves the currently selected item down one position in the
control’s list. Any displaced items are moved up to make room for the item. If the
selected item is already at the bottom of the list, it remains there.
Parameters None
Example In the following example, a loop loads five strings into an empty dropdown list box.
The strings are sequenced Item 1 to Item 5, and Item 2 is moved down. At this point,
the index of Item 2 should become 2 and the index of Item 3 should become 1. GetList
is used to check this, returning the item at index 1 in the control. If Item 3 is at that
index, the appropriate notification is stored in Logstr.
Sub DownTest
Dim Hold1 As string
Dim Logstr As string
DDListBox1.Clear
For i = 1 to 5
DDListBox1.AppendItem "item"+Str$(i)
DDListBox1.Refresh
Next i
Hold1 = DDListBox1.GetList(1)
Down 101
ClearBasic Control Reference
Dropdown List Box control
method GetList
Description TheGetList method returns items currently in the dropdown list box. If you specify
an index of an item in the list, this method returns that item. If you do not specify any
parameters, this method returns the entire list of items.
The source contextual object associated with the control must be initialized before
calling this method.
Return Values Returns a List object containing zero or more strings. Each string in the list
corresponds to an item in the dropdown list box control.
If the Index parameter was specified, this method returns a String containing the text
of the desired item.
Example In the following example, a loop loads five strings into an empty dropdown list box.
The strings are sequenced Item 1 to Item 5, and Item 2 is moved down. At this point,
the index of Item 2 should become 2 and the index of Item 3 should become 1. GetList
is used to check this, returning the item at index 1 in the control. If Item 3 is at that
index, the appropriate notification is stored in Logstr.
Sub DownTest
Dim Hold1 As string
Dim Logstr As string
DDListBox1.clear
For i = 1 to 5
DDListBox1.AppendItem "item"+Str$(i)
DDListBox1.Refresh
Next i
Hold1 = DDListBox1.GetList(1)
102 GetList
ClearBasic Control Reference
Dropdown List Box control
GetList 103
ClearBasic Control Reference
Dropdown List Box control
method GetSelected
Description The GetSelected method returns the currently selected item in the dropdown list
box. The text for the item is returned in the SelectedItem parameter, which you
must provide when you call the method. The method returns a boolean value
indicating whether or not an item is selected.
104 GetSelected
ClearBasic Control Reference
Dropdown List Box control
method RemoveByItem
Description The RemoveByItem method removes one or more items from the dropdown list box.
After removing the items, this method sets the value in the NewIndex property to -1.
You can use this method to selectively remove items from the dropdown list box
control.
As the method processes the list of items, it keeps track of those items that were not in
the control’s list. Upon completion, the method returns the list of missing items to
you. Duplicate entries are considered missing items and are therefore returned in this
list.
Return Values Returns a List object containing zero or more strings. Each string contains the name
of an item that was not in the control’s list.
RemoveByItem 105
ClearBasic Control Reference
Dropdown List Box control
method RemoveItem
Description The RemoveItem method removes the specified item from the dropdown list box
control. If the specified item is currently selected, this method clears the selection
before removing the item. After removing the item, this method sets the value in the
NewIndex property to -1
106 RemoveItem
ClearBasic Control Reference
Dropdown List Box control
method RemoveSelected
Description The RemoveSelected method removes the currently selected items from the
dropdown list box control. This method clears the current selection and sets the value
in the NewIndex property to -1.
Parameters None
Return Values Returns a Long integer with the number of items remaining in the control after the
removal of the selected items.
Example The following code snippet shows one application of this method. Selected items are
removed from MyControl and the number of items remaining in the control are
returned to Count. If no more items are left in the control, the REMOVE button is
disabled.
Count = MyControl.RemoveSelected
If Count = 0 Then
REMOVE.Enabled = False
End If
RemoveSelected 107
ClearBasic Control Reference
Dropdown List Box control
method ReplaceItem
Description The ReplaceItem method replaces the item at the specified index with the desired
string. This method does not affect the current selection or the value in the NewIndex
property.
108 ReplaceItem
ClearBasic Control Reference
Dropdown List Box control
method SelectedIndexes
This method is provided as a convenience for situations where you may want to
iterate through a group of controls and get the selected items from each.
Parameters None
Return Values Returns a List object containing zero or one long integer. The integer is a 0-based
index into the control’s list of items.
SelectedIndexes 109
ClearBasic Control Reference
Dropdown List Box control
method SelectedList
Description The SelectedList method returns a list containing the currently selected items in
the control. Because dropdown list boxes only allow the selection of one item at a
time, this list can contain at most one item.
This method is provided as a convenience for situations where you may want to
iterate through a group of controls and get the selected items from each.
Parameters None
Return Values Returns a List object containing zero or more strings. Each string in the list
corresponds to a selected item in the control. If no items are selected, the returned list
is empty.
110 SelectedList
ClearBasic Control Reference
Dropdown List Box control
method SetSelected
Description The SetSelected method selects the specified item. If there was an existing
selection, this method clears it before selecting the new item.
Only one item at a time may be selected for a dropdown list box control. If you specify
an item that does not exist in the control’s list, this method exits without clearing the
previous selection.
SetSelected 111
ClearBasic Control Reference
Dropdown List Box control
method UnSelect
Syntax YourControl.Unselect
Parameters None
112 UnSelect
ClearBasic Control Reference
Dropdown List Box control
method Up
Syntax YourControl.Up
Description The Up method moves the currently selected item up one position in the control’s list.
Any displaced items are moved down to make room for the item. If the selected item
is already at the beginning of the list, it remains there.
Parameters None
Up 113
ClearBasic Control Reference
Dropdown List Box control
property DataChanged
Description The DataChanged property contains a boolean value indicating whether the user
modified the contents of this control. This value only indicates whether modifications
were made by the user; it does not reflect changes made to the control by your
ClearBasic code.
If you modify the control programmatically, you can set this property to reflect your
changes. Set this property to True to indicate you made modifications; otherwise, set it
to False to indicate the control is unchanged.
114 DataChanged
ClearBasic Control Reference
Dropdown List Box control
property ListCount
Description The ListCount property contains a Long integer indicating the total number of
items in the dropdown list box control.
ListCount 115
ClearBasic Control Reference
Dropdown List Box control
property ListIndex
Description The ListIndex property returns the index of the control’s currently selected item. A
dropdown list box control always has exactly one item selected. The selected item
appears in the text box portion of the control.
List indexes are 0-based, that is, the first item is at index 0, the second at index 1, and
so on. As a result, the maximum index is always one less than the total number of
items as stored in the ListCount property.
MyRetInt = MyDDListBox.ListIndex
If MyRetInt = -1 Then
App.MsgBox "No Selection"
Else
‘Do this
...
End If
End Sub
116 ListIndex
ClearBasic Control Reference
Dropdown List Box control
property NewIndex
Description The NewIndex property contains a long integer with the index of the most recently
added item. You can pass this index to other methods to modify (or subsequently
remove) the item.
When you add a new item, the AppendItem method updates this property to reflect
the position of any new items. Methods that remove items reset the value in this
property to -1.
NewIndex 117
ClearBasic Control Reference
Dropdown List Box control
property Parent
Description The Parent property contains the form object that owns the control. You can use this
property in to retrieve a reference to the form object containing the dropdown list box.
118 Parent
ClearBasic Control Reference
Dropdown List Box control
property Selected
Description The Selected property contains the item currently selected in the control. For
dropdown list boxes, the item is a string. Dropdown list boxes always have exactly
one item selected.
This property is provided as a convenience for situations where you may want to
iterate through a group of controls and get the selected item from each.
Selected 119
ClearBasic Control Reference
Dropdown List Box control
property Sorted
Description The Sorted property contains a boolean value indicating whether the items in the
control’s list are sorted. This property contains the value True if the items in the
control’s source contextual object are sorted, otherwise False.
See Also Sort method (ContextualObject object in the ClearBasic Object Reference)
120 Sorted
ClearBasic Control Reference
Dropdown List Box control
property Tag
Description The Tag property contains a custom string that you assign at runtime. You can use
this string to identify the control internally to your application. You can also use this
property to store extra information about the control.
Tag 121
ClearBasic Control Reference
Dropdown List Box control
property UserData
Description The UserData property contains the string associated with the currently selected
item. At design time, you can associate a string with each item of a dropdown list.
This string may contain a database path or any other type of value that you designate.
Only dropdown list box controls that display a static list can include user data. You
can assign user data to any of the items in your list or omit the user data as
appropriate for each item.
This property is read-only. For information on associating user data with dropdown
list box items, see the User Interface Editor Guide.
122 UserData
ClearBasic Control Reference
Dropdown List Box control
property Value
Description The Value property contains a string with the item text for the currently selected
item. You can get this property to retrieve the item text for the selected item.
If you assign a value to this property, you must specify a string the name of the item
you want to select. This string is case-sensitive and must match the name of an item in
the list exactly. The string you specify is stored in the control’s destination contextual
object.
NOTE: It is possible to update the contents of the control’s destination contextual object
without changing the value in this property. Before getting this property, you can call the
Refresh method to ensure the control’s caches are up-to-date.
Value 123
ClearBasic Control Reference
Dropdown List Box control
event Click
Description The Click event handler for your dropdown list box is called when the user presses
and releases the mouse button over the control. A Click event usually indicates the
selection of an item from the control’s list. However, this event does not distinguish
between the selection of a new item or of the same item.
You can use the Click event handler to perform other actions based on the selection
of an item.
124 Click
ClearBasic Control Reference
Graph control
Description A graph control displays table data using a bitmap image. You can use graph controls
in your forms to help the user visualize large amounts of information, which may
point out useful trends in the data.
The graph control supports several different styles for displaying data, including bar
graphs, pie graphs, polar graphs, scatter graphs, and so on. The graph control also
supports both 2D and 3D variations of most graphs.
Data Sets and Data A graph control organizes data into data sets and data points. A data point
Points corresponds to a single value plotted on the graph. A data set represents a group of
related data points. The data points of a data set are organized along the columns or
rows of the data table. For example, Figure 1: shows some sales figures in a table. Each
cell containing a number represents a data point in the resulting graph. (The entries in
the first column and along the top row represent the labels associated with each
group. See Graph Labels and Legends.)
When you organize the table data along column boundaries, you get the data sets
shown on the left side of Figure 2:. Similarly, if you organize the table along row
boundaries, you get the data sets shown on the right side of Figure 2:.
If you were to display graphs for both the column-based data sets and the row-based
data sets, you would get the graphs shown in Figure 3:
Graph Labels and To make it easier for users to read the graph, the graph control labels graph elements.
Legends The location of labels depends on the type of graph being displayed by the control.
For example, labels for a vertical bar graph would be along the top or bottom of the
graph while labels for a horizontal bar graph would be along the left or right side.
Each group of related data points has an associated label. The label identifies a
common property shared by the data points. For example, in Figure 3:, the data points
in the left graph are grouped by month.
You can assign labels to a graph programmatically or using a contextual object. If your
graph uses a contextual objects to acquire the data points then it must acquire the
labels from a contextual object as well. If you are entering data points using ClearBasic
code, you can use the SetLabel method of the graph control to specify labels.
In addition to assigning labels to groups of data points, the graph control renders the
data points in each data set using a unique color or pattern. The special shading
attributes allow you to distinguish among the data points displayed with a particular
label.
Each data set is assigned a specific color to make it easier for users to quickly identify
elements in the data set. You can set the text for each data set’s legend entry using the
SetLegend method.
Figure 4: shows a table and its corresponding 2D bar graph. In this table, the two
columns of data correspond to the data sets of the graph. The labels and legend text
entries are highlighted in the table and can be seen in the corresponding graph.
126
ClearBasic Control Reference
Graph control
Specifying Data The graph control lets you specify the graph data in one of two ways. If you associate
Sets a contextual object with the graph control, the control always obtains the data from
that object. If you do not associate a contextual object with the control, you must
specify the data manually using the methods of the graph control.
If you use a contextual object with your graph control, the graph obtains all of the
graph data from that object. On the property sheet of the graph control, you specify
the rows or columns from which to obtain both the data sets and labels for the graph.
You cannot call the SetPoint, SetLabel, or SetLegend methods.
If you do not use a contextual object, you must call the SetPoint method from your
ClearBasic code to enter graph data. After you enter the graph data, you can assign
labels to each group of data points using the SetLabel method. You can also assign a
legend entry for each data set using the SetLegend method.
Aggregation In addition to graphing tabular data row by row and column by column, the graph
control has the ability to aggregate entries dynamically. One example of aggregation is
where you want to count the number of times a particular choice-list item appears.
The graph control can count the number of times each choice appears and display
those numbers as data points.
Another aggregation example supported by the graph control is the situation where a
set of data points share a common label. In this instance, the graph control can
perform a summation of the data points with the same label and present the result as
a single data point.
To enable aggregation, you must modify property sheet of the graph control using the
User Interface Editor. You cannot enable aggregation using ClearBasic code. When
enabled, the graph control automatically aggregates data provided by a contextual
object or by your code.
Referring to Graph You cannot create control objects directly using ClearBasic code. You must associate
Controls controls with a form, frame, or tab using the User Interface Editor. When the form,
frame, or tab is subsequently displayed, the corresponding control object is created
automatically.
If you need to refer to a control object explicitly, such as when passing a control object
as a method parameter, use a variable of type Control to refer to the control object.
For example, you would use the following code to obtain a reference to the graph
control called YourGraphControl:
Dim YourControl As Control
Set YourControl = YourGraphControl
Source You can specify the graph data points and labels using contextual objects or
ClearBasic code. Graph controls support contextual objects with the following
primitive types:
■ Long
■ Single
■ Date
■ String
127
ClearBasic Control Reference
Graph control
Properties This object supports the following properties. Properties marked with [C] are
documented with the Control object.
■ BackColor property
■ BackStyle property
■ BorderStyle property
■ ControlType property [C]
■ Enabled property [C]
■ GraphType property
■ Height property [C]
■ Id property [C]
■ Left property [C]
■ LegendPos property
■ Name property [C]
■ NumSets property
■ ShowLegend property
■ Top property [C]
■ Visible property [C]
■ Width property [C]
128
ClearBasic Control Reference
Graph control
method ClearData
Syntax YourControl.ClearData
Applies To Graph
Description The ClearData method removes all data points that were added using the
SetPoint method. Use this method to reset the graph data before adding a new set
of points.
If the graph uses a contextual object to acquire its data, this method does nothing.
Parameters None
Example The following example clears the current graph data before assigning any new data.
In this case, the Graph control displays data from some custom fields added to the
wipelm_case view.
Sub Form_Load()
Dim myrec as Record
Dim mybulk as New BulkRetrieve
Dim mylist as List
Dim i as Integer
Dim grp as Integer
grp = 0
mybulk.SimpleQuery 0, "wipelm_case"
mybulk.RetrieveRecords
ClearData 129
ClearBasic Control Reference
Graph control
130 ClearData
ClearBasic Control Reference
Graph control
method GetLabel
Applies To Graph
Description The GetLabel method returns the label text associated with one data point. The
graph control displays this label text next to the graph element represented by that
data point.
NOTE: The graph control lets you associate a label with each data point in the graph, even if
the graph contains multiple data sets. You should always assign the same label to points whose
DataPointIndex parameter is the same.
Example The following code fragment retrieves the label associated with the second group of
points.
Dim secondLabel as String
secondLabel = grphDataTrend.GetLabel(0,2)
GetLabel 131
ClearBasic Control Reference
Graph control
method GetLegend
Applies To Graph
Description The GetLegend method returns the legend text associated with the specified data set.
The legend text serves as an identifier for the data in a particular data set.
You can use this method to retrieve the text for legend entries even if the legend is not
currently visible. Entries in the legend are color-coded to match the elements
displayed in the graph. The position of the legend is controlled by the LegendPos
property.
Example The following code fragment retrieves the legend text associated with the third data
set in the graph.
Dim thirdLegend as String
thirdLegend = grphDataTrend.GetLegend(3)
132 GetLegend
ClearBasic Control Reference
Graph control
method GetPoint
Applies To Graph
Description The GetPoint method returns the value of one point in the specified data set. When
you call this method, you must specify the location of the point in the data set. In turn,
this method returns the value stored at that point.
Return Values Returns the value at the specified location in the graph. The type of the returned value
can vary but must be one of the following types: Float, Double, Long, Integer.
Example The following code fragment returns the third point in the second data set.
Dim pointValue as Long
pointValue = grphDataTrend.GetPoint(2,3)
GetPoint 133
ClearBasic Control Reference
Graph control
method SetLabel
Applies To Graph
Description The SetLabel method sets the label text for a related group of data points. Labels
identify the category to which the group of items belong. Individual items within the
group are further distinguished by the legend. See Graph Labels and Legends on
page 126 for more information.
The position of the label text is determined by the type of the graph. If the graph uses
a contextual object to acquire its data, this method does nothing.
Example The following code fragment generates a set of random data for a graph. The graph
contains four data sets. The labels of the graph are the even integers from 0 to 16,
inclusive.
Dim i as Integer
Dim j as Integer
For i = 0 to 3
For j = 0 to 16 Step 2
graphDataTrend.SetPoint i,j,Random(0,100)
graphDataTrend.SetLabel 0,j,CStr(j)
Next j
graphDataTrend.SetLegend i, "Group "+CStr(i)
Next i
134 SetLabel
ClearBasic Control Reference
Graph control
method SetLegend
Applies To Graph
Description The SetLegend method sets the legend text associated with the specified data set.
The legend text serves as an identifier for the data in a particular data set.
You can use this method to assign the text for legend entries even if the legend is not
currently visible. Entries in the legend are color-coded to match the elements
displayed in the graph. The position of the legend is controlled by the LegendPos
property.
If the graph uses a contextual object to acquire its data, this method does nothing.
Example The following code fragment generates a set of random data for a graph. The graph
contains four data sets. The legend entries for the graph consist of the strings "Group
0", "Group 1", "Group 2", and "Group 3".
Dim i as Integer
Dim j as Integer
For i = 0 to 3
For j = 0 to 16 Step 2
graphDataTrend.SetPoint i,j,Random(0,100)
graphDataTrend.SetLabel 0,j,CStr(j)
Next j
graphDataTrend.SetLegend i, "Group "+CStr(i)
Next i
SetLegend 135
ClearBasic Control Reference
Graph control
method SetPoint
Applies To Graph
Description The SetPoint method adds a new data point to the graph. Use this method to add
points to a graph that does not acquire its data from a contextual object. If the graph
uses a contextual object to acquire its data, this method does nothing.
Using this method, you can specify the contents of the graph one point at a time. The
DataSetIndex and XValue parameters identify the place in which to insert the point.
The YValue parameter contains the value for the point.
Example The following code fragment generates a set of random data for a graph. The graph
contains four data sets.
Dim i as Integer
Dim j as Integer
For i = 0 to 3
For j = 0 to 16 Step 2
graphDataTrend.SetPoint i,j,Random(0,100)
graphDataTrend.SetLabel 0,j,CStr(j)
Next j
graphDataTrend.SetLegend i, "Group "+CStr(i)
Next i
136 SetPoint
ClearBasic Control Reference
Graph control
property BackColor
Applies To Graph
Description The BackColor property contains a string that identifies a color scheme entry. You
can get or set this value.
You can use this property only after using the CreateColorScheme/
SetColorScheme methods to specify the colors corresponding to the color labels.
The BackColor property allows you to set the background color of the graph control.
You can set this property directly for the control, or indirectly by setting the property
on the contextual object that is linked to the control.
IMPORTANT: Before you can set back or fore colors, you must first create a color scheme (see
CreateColorScheme) that maps available system colors to labels. Then you must use
SetColorScheme to assign that color-to-label mapping to the form where you want to
perform the coloring. The reason for this is that you must specify the label, not the system
color, when you set BackColor or ForeColor.
Setting Description
ColorLabel You must specify a label that is mapped to a valid system color. The
label must be in the color scheme that is currently in effect for the form
in which you are performing color operations. (See
CreateColorScheme and SetColorScheme.)
Example The following code illustrates how you use color in ClearBasic. (You are not required
to set color in the form load event procedure.)
Before you set the color properties, you must create a color scheme and set it into
effect, as shown in the example. Only then can you color the object you want to color.
In this example, the text box label and the textbox foreground text are assigned the
same color, red, and the background color for the text box is set to cyan.
Sub Initialize_App
Dim LabelList1 As New List
Dim ColorList1 As New List
BackColor 137
ClearBasic Control Reference
Graph control
App.CreateColorScheme"Form2020", _
LabelList1, ColorList1
End Sub
Sub Form_Load
App.SetColorScheme "Form2020"
CBGraph.BackColor = "Yellow"
End Sub
138 BackColor
ClearBasic Control Reference
Graph control
property BackStyle
Applies To Graph
Description The BackStyle property contains a long integer that indicates the background fill
style used to display graph elements, where each graph element corresponds to a data
point plotted on the graph. The value stored in this property corresponds to one of the
following constants:
Constant Description
cbGraphNoFill Graph elements are not filled.
cbGraphFill Graph elements are filled.
BackStyle 139
ClearBasic Control Reference
Graph control
property BorderStyle
Applies To Graph
Description The BorderStyle property contains a long integer indicating the type of border
drawn around the control. The value stored in this property corresponds to one of the
following constants:
Constant Description
cbGraphNoBorder None
cbGraphThinRaisedBorder Thin Raised Border
cbGraphThinSunkenBorder Thin Sunken Border
cbGraphThin3DBorder Thin 3D Border
cbGraphThickRaisedBorder Thick Raised Border
cbGraphThickSunkenBorder Thick Sunken Border
cbGraphThick3DBorder Thick 3D Border
cbGraphLineBorder Simple Line Border
If the graph uses a contextual object to acquire its data, this property is read-only.
140 BorderStyle
ClearBasic Control Reference
Graph control
property GraphType
Applies To Graph
Description The GraphType property contains a long integer indicating the type of graph drawn
by the control. The value stored in this property corresponds to one of the following
constants:
Constant Description
cbGraphLine Line plot
cbGraphHBar Horizontal bar chart
cbGraphVBar Vertical bar chart
cbGraphPie Pie chart
cbGraphArea Area under curve
cbGraphStock High-Low-Quotes
cbGraphISOBar 3D Bar chart "Manhattan"
cbGraphISOArea 3D Bar chart "Rooftop"
cbGraphStackVBar 2D Stacked vertical bar
cbGraphStackHBar 2D Stacked horizontal bar
cbGraphISOPie 3D pie chart
cbGraphStrata Strata graph
cbGraphExVBar 3D Vertical bar
cbGraphExHBar 3D Horizontal bar
cbGraphBubbleRadius Bubble radius
cbGraphBubbleArea Bubble area
cbGraphVectorTail Vector - anchor at tail
cbGraphVectorCenter Vector - anchor at center
cbGraphVectorPointAndOffset Vector with point & offset
cbGraphXYScatterAlt Scatter graph(alternate)
cbGraphXYScatterIndex Scatter graph(indeces)
cbGraphXYScatterGroup Scatter graph(groups)
cbGraphAreaWeb Area Web chart
cbGraphAreaStock Area Stock (hi-lo-now)
cbGraphPolar Polar chart
cbGraphAreaPolar Polar chart (area fill)
cbGraphCandle Candle chart
cbGraphHiLoOpenClose Hi-Lo-Open-Close
cbGraphGantt Gantt
cbGraphLineOnly Line only (no widgets)
GraphType 141
ClearBasic Control Reference
Graph control
Constant Description
cbGraphRibbon 3D Ribbon chart
cbGraphWeb Web chart
cbGraphXYScatterAltEx Scatter graph with log/lin axis (alternate)
cbGraphXYScatterIndexEx Scatter graph with log/lin axis (indices)
cbGraphXYScatterGroupEx Scatter graph with log/lin axis (group)
cbGraphStep Step chart
cbGraphStepLo Step chart (line only)
cbGraphStrataVBar Strata vertical bar (one index/per bar)
cbGraphStrataHBar Strata horizontal bar (one index/per bar)
cbGraphStrataVBarGroup Strata vertical bar (one group/per bar)
cbGraphStrataHBarGroup Strata horizontal bar (one group/per bar)
If the graph uses a contextual object to acquire its data, this property is read-only.
142 GraphType
ClearBasic Control Reference
Graph control
property LegendPos
Applies To Graph
Description The LegendPos property contains a long integer indicating the position of the
graph’s legend text. You can set this property to one of the following values:
If the graph uses a contextual object to acquire its data, this property is read-only.
LegendPos 143
ClearBasic Control Reference
Graph control
property NumSets
Applies To Graph
Description The NumSets property contains a long integer indicating the number of data sets in
the graph. Each data set consists of one or more data points, which you add using the
SetPoint method.
144 NumSets
ClearBasic Control Reference
Graph control
property ShowLegend
Applies To Graph
Description The ShowLegend property contains a Boolean value that indicates whether or not the
graph’s legend is displayed. You can get the value of this property to determine if the
legend is currently visible or set the value to hide or show the legend.
ShowLegend 145
ClearBasic Control Reference
Graph control
146 ShowLegend
ClearBasic Control Reference
Grid control
Description A grid control displays information in a series of columns and rows. You can use this
control to display records from a database table, database view, or dynamic view—
user-defined type (UDT). Each row of the grid corresponds to a single record of the
specified type. Each column corresponds to a field of the table or view. A cell
represents the intersection of a row and column and contains the data for a specific
field of a record.
You create grid controls using the User Interface Editor. When you create the control,
you associate it with a contextual object that designates the table or view you want to
display in the grid. You must create one or more columns to display the fields of the
table or view. You must also decide whether the user may edit the contents of the grid
by setting the control’s Is Editable property.
NOTE: Grid controls are sometimes referred to as Custom List controls. The name Custom
List is maintained in some situations for backwards compatibility. However, the term Grid is
preferred.
Static Grid Controls By default, new grid controls are static, that is, their contents cannot be edited by the
user. You can use static controls in situations where you only want to display the data
or when you want to force the user to open a child dialog to edit the contents of a row.
In both cases, the user cannot edit the contents of the grid directly.
Although the user may not edit the contents of the grid using the grid interface, you
can modify the contents programmatically using ClearBasic code. You can add new
rows using the AppendItem method and remove individual rows using the
RemoveByItem, RemoveItem, and RemoveSelected methods. To remove all rows
from a control, use the Clear method.
Selections in a static grid control affect entire rows, as opposed to individual cells of
the row. When the user clicks in a cell, the control highlights the entire row. Some
methods of the grid control operate only on the currently selected row. For example,
the Down and Up methods adjust the position of one or more rows. You can get the
current selection using the GetSelected, SelectedIndexes, and SelectedList
methods or using the Selected and ListIndex properties. You can also change the
selection using the SetSelected and UnSelect methods.
You can use the properties of the grid control to gather information about its current
settings. You can retrieve the name of the control, its location, and other information
that describes the control’s current state.
Static grid controls generate two types of events for handling user clicks in the control.
Your Click and DblClick event handlers can process these events and perform any
relevant tasks.
Editable Grid When you create a new grid control, you can make it editable by setting its Is Editable
Controls property to True in the User Interface Editor. An editable grid control supports all of
the same functionality for manipulating the grid as does the static version of the
control. In addition, the editable control allows the user to modify the displayed data
directly in the grid. To edit the contents of a particular cell, the user simply clicks in a
cell to activate the cell. Once activated, the user can enter data using the cell’s edit
control.
Most of the methods relating specifically to editable grids help you set cell values and
validate rows and cells. Use the GetChoiceList, GetChoiceListDefault, and
SetCellText methods to get and set cell values. Use the GetChangedCell and
GetChangedRow methods to retrieve user edits for validation. Use the
AbortCellChange and AbortRowChange method to prevent the user from saving
those changes to the database.
With an editable grid control, you can call methods to prevent the user from editing
specific cells. The SetCellReadOnly method marks individual cells as read-only.
The SetRowReadOnly and SetEditStates methods mark groups of cells as read-
only.
Editable grids generate several additional events for you to handle. The
CellChanged event notifies you when the user has modified the contents of a cell.
The RowChanged event notifies you when the user has finished making changes to a
row so that you can save those changes to the database. When the user adds another
row to the grid, the grid control calls your NewRow event handler to create the row
and set the initial cell values. Other events support Select CBX-related features such as
searching and sorting.
Multiple Contextual The grid control supports the ability to change the current source and destination
Object Support contextual objects at runtime. Changing these objects allows one grid control to
display records from different database tables. Support for multiple contextual objects
requires the use of extended contextual object information. A grid that supports the
switching of contextual objects is called a multigrid control.
At runtime, you can change the contextual object of the grid by changing the value in
the CObj property of the grid. This property contains the name of the grid’s current
source contextual object. When you change the value, the grid reconfigures itself
using information in the new contextual object. Only one source contextual object can
be associated with the grid at any given time.
See the User Interface Editor Guide for information on how to configure and use a grid
control with multiple contextual objects.
Select CBX and The Select CBX control uses a grid control to display records retrieved by a query.
Grids When you relate a Select CBX to a grid, the Select CBX takes over many aspects of the
grid operation. In particular, the Select CBX coordinates the storage of the records in
the grid and the updates needed to display those records.
IMPORTANT: The Select CBX control defines several methods for retrieving grid information.
If you need to retrieve or set some grid data, call the Select CBX method instead of the
corresponding grid or contextual object method whenever possible. Calling the Select CBX
method ensures that any Select CBX state information is updated appropriately.
148
ClearBasic Control Reference
Grid control
Paging If you associate a grid with a Select CBX control, the Select CBX control may use
paging to improve performance when handling large result sets. If the size of the
result set exceeds a preset amount, the Select CBX loads only a portion of the result set
into memory at any given time. The Select CBX keeps two pages worth of records in
memory at any given time. As the user scrolls through the list, the Select CBX loads
new pages into memory and updates the grid display.
Because the grid has no knowledge of which pages are in memory, you cannot make
any assumptions about the position of a record in the overall result set. When using
the Select CBX or grid interfaces, do not attempt to manipulate more than one record
at a time. If a paging event has occurred, one of the records may no longer be in
memory.
Before loading a new page, the grid sends appropriate CellChanged and
RowChanged events to allow you to save the contents of the current row. If the
current row has not changed, only the paging event is sent.
IMPORTANT: For CeFO default grid controls, you can specify the page size in the application
.env file.
Context-Sensitive This control supports the display of a context-sensitive menu. The control
Menu Support automatically provides several control-related menu items to allow the user to modify
the grid. You may add additional menu items using the methods of this control.
If you add context-sensitive menu items to a control, you must provide an event
handler to respond to the selection of your menu items. The ContextMenu_Select
event handler lets you handle the selection of all your context-sensitive menu items.
You may also implement a ContextMenuDisplaying event handler to modify the
state of your menu items immediately before the menu is displayed.
Grid Event The grid control supports several events for handling user interactions with the grid
Execution Order and its contents. In a few cases, a single action may trigger several events. In these
cases, the events are sent in a specific order. Table lists the actions and the
corresponding grid events.
149
ClearBasic Control Reference
Grid control
Referring to Grid You cannot create control objects directly using ClearBasic code. You must associate
Controls controls with a form, frame, or tab using the User Interface Editor. When the form,
frame, or tab is subsequently displayed, the corresponding control object is created
automatically.
If you need to refer to a control object explicitly, such as when passing a control object
as a method parameter, use a variable of type Control to refer to the control object.
For example, you would use the following code to obtain a reference to the grid
control called YourGridControl:
Dim YourControl As Control
Set YourControl = YourGridControl
Source At control design time, you must link a separate source field from one contextual
object to each column in the grid. The type of the contextual object must be a database
type or a UDT. It holds a list of records/UDTs at runtime.
Destination At run time, when the user selects one or more rows from the grid, the index or
indexes (and not the contents of the selected rows!) of the selected item(s) is stored in
the destination contextual object, which is of type List.
Control Label This control does not contain a label. You must create a label control and place it next
to this control.
150
ClearBasic Control Reference
Grid control
Methods This object supports the following methods. Methods marked with a [C] are
documented with the Control object. Methods marked with an [E] apply only to
editable grid controls.
■ AbortCellChange method [E]
■ AbortRowChange method [E]
■ AppendContextMenu method
■ AppendItem method
■ Clear method
■ ClearContextMenu method
■ ColorCells method
■ Contains method
■ Down method
■ GetChangedCell method [E]
■ GetChangedRow method [E]
■ GetChoiceList method [E]
■ GetChoiceListDefault method [E]
■ GetChoiceListUserData method [E]
■ GetColumnControlType method [E]
■ GetColumnMaxLength method [E]
■ GetColumnNames method [E]
■ GetList method
■ GetSelected method
■ GetSelectedColumns method
■ HideColumn method
■ IsColumnEditable method [E]
■ IsColumnRequired method [E]
■ Refresh method [C]
■ RemoveByItem method
■ RemoveItem method
■ RemoveSelected method
■ ReplaceItem method
■ SaveAnyChanges method [E]
■ SelectedIndexes method
■ SelectedList method
■ SetCellColoring method
■ SetCellFocus method [E]
■ SetCellReadOnly method[E]
151
ClearBasic Control Reference
Grid control
152
ClearBasic Control Reference
Grid control
Properties This object supports the following properties. Properties marked with [C] are
documented with the Control object. Properties marked with [E] apply only to
editable grid controls.
■ AppendRows property [E]
■ CObj property
■ ControlType property [C]
■ DataChanged property
■ Dirty property [E]
■ Enabled property [C]
■ Height property [C]
■ hWnd property [C]
■ Id property [C]
■ Left property [C]
■ ListCount property
■ ListIndex property
■ MultiSelect property
■ Name property [C]
■ NewIndex property
■ PagingEvent property
■ Parent property
■ PromptOnSave property [E]
■ SelCount property
■ Selected property
■ Sorted property
■ Tag property
■ Top property [C]
■ TopIndex property
■ TotalRows property
■ Visible property [C]
■ Width property [C]
153
ClearBasic Control Reference
Grid control
Events This object supports the following events. Events marked with a [C] are documented
with the Control object. Events marked with an [E] are sent only to editable grid
controls.
■ AdhocCellChanged event [E]
■ Cell_Btn_Click event [E]
■ CellChanged event [E]
■ Cell_Click event
■ Cell_List_Select event [E]
■ Click event
■ ContextMenuDisplaying event
■ ContextMenu_Select event
■ DblClick event
■ DoAdhocQuery event
■ GotFocus event [C]
■ LostFocus event [C]
■ NewRow event [E]
■ Refresh event
■ RowChanged event [E]
■ SortColumn event
Deprecated Events The names of the following events have changed. The old event names are still
supported for compatibility but their use is discouraged. Use the new event names
instead.
154
ClearBasic Control Reference
Grid control
method AbortCellChange
Description The AbortCellChange method lets you abort the changes to a cell before they are
committed to the grid’s source contextual object. When you call this method, you may
use the DialogType and Message parameters to notify the user about the aborted
attempt to modify the cell. You may also use these parameters to let the user override
the abort operation and save the cell contents regardless.
Call this method from a CellChanged event handler when the contents of a cell are
invalid. This method prevents the cell focus from changing to another cell. The user
may not select a different cell until the edited cell contains a valid value or until you
give the user the option of saving the invalid changes.
The value you specify for the DialogType parameter determines what kind of
notification (if any) the user receives. If you specify the value
cbAbortDisplayYesNo for this parameter, the user has the option of accepting the
cell changes even though they are invalid. If you specify any other value, the changes
are automatically aborted.
This method is available only for grids whose Editable property has been set to Yes in
the User Interface Editor.
Constant Description
cbAbortUndo Do not notify the user
cbAbortDisplayOK Notify the user that the changes
are being aborted
cbAbortDisplayYesNo Ask the user whether or not to
abort the changes
Message String Specify the prompt message to display to the user. If the
DialogType is cbAbortUndo, specify an empty string.
AbortCellChange 155
ClearBasic Control Reference
Grid control
Example The following example shows the CellChanged event handler for the grid whose
name is GridCtl. This event handler validates only the quantity field of the grid. If
the user specifies a negative quantity, the event handler calls AbortCellChange to
notify the user that a positive integer must be entered.
Sub GridCtl_CellChanged
dim rowNum as Integer
dim fieldName as String
dim fieldData as String
dim numItems as Integer
156 AbortCellChange
ClearBasic Control Reference
Grid control
method AbortRowChange
Description The AbortRowChange method lets you abort any changes to a row before
committing those changes to the database. Call this method from a RowChanged
event handler when your code determines that the contents of a row are invalid. This
method prevents the focus from changing to another row. The edited row remains
selected until the user corrects the errors, discards the changes, or overrides the abort
operation.
When you call this method, you may use the DialogType and Message parameters to
notify the user about the aborted attempt to save the row changes. You may also use
these parameters to let the user override the abort operation and save the row changes
regardless.
The value you specify for the DialogType parameter determines what kind of
notification (if any) the user receives. If you specify the value
cbAbortDisplayYesNo for this parameter, the user has the option of overriding the
abort operation and accepting the row changes even though they are invalid. If you
specify any other value, the row changes are automatically aborted.
Although the entire row remains selected when you abort a set of changes, you may
assign the cell focus to a particular cell of that row using this method. If you specify a
value in the FieldName parameter, the grid highlights the cell corresponding to that
field and assigns it the cell focus.
This method is available only for grids whose Editable property has been set to Yes in
the User Interface Editor.
AbortRowChange 157
ClearBasic Control Reference
Grid control
158 AbortRowChange
ClearBasic Control Reference
Grid control
method AppendContextMenu
Applies To Grid
Description The AppendContextMenu method adds a new menu item to the end of the grid
control’s context-sensitive menu. You can use this method to supplement the menu
items specified using the User Interface Editor.
In addition to adding menu items, you can use this method to add a separator after an
existing menu item. To add a separator, specify True for the Separator parameter.
The menu items you add using this method are enabled and visible initially. To
change the appearance of an item, call the SetContextMenuEnabled or
SetContextMenuVisible method. You can also add code to a
ContextMenuDisplaying event handler to update the appearance of menu items
dynamically.
AppendContextMenu 159
ClearBasic Control Reference
Grid control
Example The following example adds two new items to the context-sensitive menu associated
with a grid control. The new items allow the user to select all of the rows in the grid
and to deselect whatever is currently selected.
Sub Form_Load
' Add two new menu items for selecting
' everything and nothing.
GridCtl.AppendContextMenu "cntxSelectAll", _
"Select All", "", FALSE
GridCtl.AppendContextMenu _
"cntxSelectNone", "Select None", "", _
FALSE
End Sub
160 AppendContextMenu
ClearBasic Control Reference
Grid control
method AppendItem
Applies To Grid
Description The AppendItem method appends one row or a list of rows to the grid. The data type
of each row must match the data type currently associated with the grid. For
multigrids, you can check the current contextual object assigned to the grid to
determine the row type. This method automatically updates the source contextual
object linked to the grid.
When you add a new row to a grid, the grid sets the row’s Dirty property to False.
When the user modifies the value in a cell (or you modify the contents of a cell
programmatically), the grid updates the Dirty property.
Before calling this method, you must make sure there is a contextual object linked to
the grid and that the contextual object has already been initialized with the Fill
method. The subtype of the source contextual object must be set to Record List.
NOTE: If the grid is associated with a Select CBX control, use the AppendItem method of
the Select CBX control instead.
AppendItem 161
ClearBasic Control Reference
Grid control
method Clear
Syntax YourGrid.Clear
Applies To Grid
Description The Clear method removes all items from the grid. This method sets the value of the
NewIndex property to -1.
Parameters None
162 Clear
ClearBasic Control Reference
Grid control
method ClearContextMenu
Syntax YourGrid.ClearContextMenu
Applies To Grid
Description The ClearContextMenu method removes custom menu items from the control’s
context-sensitive menu. This method removes only menu items that were added
using the AppendContextMenu method of the control. This method does not remove
menu items put on the menu by ClarifyCRM eFrontOffice or added in the User
Interface Editor.
Parameters None
ClearContextMenu 163
ClearBasic Control Reference
Grid control
method ColorCells
Applies To Grid
Description The ColorCells method sets the foreground and background color for the grid cells.
The colors you specify must belong to the current color scheme.
You can use this method in conjunction with the SetCellColoring method to
specify a color procedure for the grid. A color procedure is a subroutine you define in
your form’s module for coloring the cells of the grid. Whenever rows are added to the
grid, either programmatically or by the user, the grid calls your color procedure to
adjust the cell colors. You use this method to apply the colors to the cells.
Before calling this method from a color procedure, you must set up the parameters to
specify which colors you want to apply to each cell. For any given index, the
parameters specify the colors to apply and the cell position at which to apply them.
For example, the following table shows a sample set of lists. In the example, the colors
red and white are applied to the first column of each row and the colors green and
white are applied to the fourth column of the first row.
The number of items in the Foregrounds and Backgrounds lists must be equal to the
number of cells specified by the Rows and Columns parameters. If you do not want to
apply a color to a particular cell, specify an empty string in place of a color name in
either the Foregrounds or Backgrounds parameter.
NOTE: The index for each column in a grid is determined at control design time in the User
Interface Editor. Therefore, if the end user reorders columns in the grid, the indexes are not
affected.
164 ColorCells
ClearBasic Control Reference
Grid control
CAUTION: You must specify a color or "" in both the Foregrounds and Backgrounds
parameters for each cell you specify using the Rows and Columns parameters. Failure to do so
will result in unexpected behavior.
Example The following example shows a sample color procedure that applies a color to the
column containing the “priority” field.
The first part of the example sets up the initial color scheme. In a global module, the
Initialize_App routine defines the color scheme and associates different colors
with the values that can exist in the “priority” field. In the global module, define the
following code:
Sub Initialize_App
Dim ColorVals As New List
Dim ColorNames As New List
ColorNames.AppendItem "Immediate", _
ColorCells 165
ClearBasic Control Reference
Grid control
App.CreateColorScheme "MyColorScheme", _
ColorNames, ColorVals
End Sub
In the form module, the Form_Load routine sets the current color scheme and
associates a color procedure with the grid. The color procedure iterates through the
rows of the grid and assigns an appropriate color to the “priority” field of each row, as
shown in the following code:
'In the form module
Sub Form_Load
App.SetColorScheme "MyColorScheme"
MyGrid.SetCellColoring "MyColorProc"
Me.DoDefault
End Sub
Foregrounds.ItemType="String"
Backgrounds.ItemType="String"
RowList.ItemType="Integer"
ColList.ItemType="Integer"
RowList.AppendItem Row
ColList.AppendItem 2 ' Third column is “priority”
Next Row
166 ColorCells
ClearBasic Control Reference
Grid control
method Contains
Applies To Grid
Description The Contains method returns a boolean value indicating whether the specified
record exists in the grid. The type of the record you specify in the ItemToFind
parameter must match the type of items displayed in the grid. This method compares
every field of the specified record with the fields of the records in the grid.
IMPORTANT: This method performs a comparison of all of the fields in the specified records,
including those not displayed in the grid. If you want to perform field-level comparisons, use
the FindFirstIndex method.
Return Values Returns True if the item is in the grid, otherwise False.
See Also FindFirstIndex method (List object in the ClearBasic Object Reference
Contains 167
ClearBasic Control Reference
Grid control
method Down
Syntax YourGrid.Down
Applies To Grid
Description The Down method moves the currently selected item or items down one position in
the grid.
This method moves the selected items in the grid down one place. Each selected item
moves down to appear one line lower than previously displayed. The displaced items
move up accordingly. If multiple items are selected, some displaced items may move
up to make room for the items that move down.
If a selected item is at the end of the list, it remains there. If multiple items are selected
so that all the items between an item and the end of the list are selected, then that item
will remain in its previous position.
Parameters None
168 Down
ClearBasic Control Reference
Grid control
method GetChangedCell
Description The GetChangedCell method returns information about the most recently changed
cell. Call this method only from a CellChanged event handler.
This method returns the row index and field name of the cell that changed and returns
the new value of the cell. You can use this information to validate the contents of the
cell.
This method is available only for grids whose Editable property has been set to Yes in
the User Interface Editor.
Return Values Returns True if the data was acquired successfully, otherwise False.
Example The following example shows a sample CellChanged event handler. Before
validating any data, this method calls the GetChangedCell method to determine
which cell changed and to determine the new value in the cell.
Sub GridCtl_CellChanged
dim rowNum as Integer
dim fieldName as String
dim fieldData as String
dim numItems as Integer
GetChangedCell 169
ClearBasic Control Reference
Grid control
170 GetChangedCell
ClearBasic Control Reference
Grid control
method GetChangedRow
Description The GetChangedRow method returns information about the most recently changed
row. Call this method only from a RowChanged event handler.
This method returns the row and field names of the cells that changed. (All of the cells
belong to the same row.) This method also returns the data for each of the changed
cells.
The items in the FieldNameList and DataList parameters are ordered in parallel. That
is, for each field name in the FieldNameList parameter, the corresponding cell data is
at the same index in the DataList parameter. For example, the data at index 0 in the
DataList parameter belongs to the cell whose field name is at index 0 in the
FieldNameList parameter.
This method is available only for grids whose Editable property has been set to Yes in
the User Interface Editor.
Return Values Returns True if the data was acquired successfully, otherwise False.
Example The following example gets the changed record and saves it to the database using a
BulkSave object.
Sub GridCtl_RowChanged
dim blkSave as New BulkSave
dim recordList as List
dim changedRec as Record
dim rowIndex as Integer
dim fields as List
GetChangedRow 171
ClearBasic Control Reference
Grid control
blkSave.UpdateRecord changedRec
blkSave.Save
End Sub
172 GetChangedRow
ClearBasic Control Reference
Grid control
method GetChoiceList
Description The GetChoiceList method returns a list of strings corresponding to the items in
the specified column’s choice list. You may call this method for columns that use a
drop-down list box or drop-down combo box. If a column uses a drop-down combo
box, the returned list includes any items that the user added to the list.
This method returns only the name of the choice list item; it does not return the user
data associated with the item. To get the user data for a selected item, call the
GetChoiceListUserData method.
You assign a choice list to a column using the User Interface Editor. The choice list
may be of any type: static, popup, or Clarify. You cannot change the type of list
associated with the grid control at runtime using ClearBasic code.
This method is available only for grids whose Editable property has been set to Yes in
the User Interface Editor.
Return Values Returns a list of String objects. If the field does not have a choice list, this method
returns the null list Nothing.
Each string in the list contains the name of one entry in the choice list. The order of the
returned entries matches the order of the items as they are displayed in the control.
GetChoiceList 173
ClearBasic Control Reference
Grid control
method GetChoiceListDefault
Description The GetChoiceListDefault method returns the default item associated with the
specified column’s choice list. This method is primarily for informational purposes.
However, you can use the value returned by this method to initialize new records in a
NewRow event handler.
You assign a choice list to a column using the User Interface Editor. The cell’s column
must display the choice list using either a drop-down list box or a drop-down combo
box control. Only static choice lists may have a default value. You cannot assign the
default item using ClearBasic code.
This method is available only for grids whose Editable property has been set to Yes in
the User Interface Editor.
Return Values Returns a String object containing the text of the default choice. If the column does not
have a default item, this method returns an empty string ("").
174 GetChoiceListDefault
ClearBasic Control Reference
Grid control
method GetChoiceListUserData
Description The GetChoiceListUserData method returns the user data associated with the
selected choice-list item. The returned data belongs to the currently selected item in
the cell specified by the Row and FieldName parameters. The data consists of a string,
which you can use to store information about the item. This string is never displayed
to end users and is for your application’s internal use only.
You assign a choice list to a column using the User Interface Editor. The cell’s column
must display a choice list using either a drop-down list box or a drop-down combo
box control. Only static choice list items may have user data. You cannot assign the
user data using ClearBasic code.
This method is available only for grids whose Editable property has been set to Yes in
the User Interface Editor.
Return Values Returns a String object containing the user data. If the selected list item does not have
any user data, this method returns an empty string ("").
GetChoiceListUserData 175
ClearBasic Control Reference
Grid control
method GetColumnControlType
Description The GetColumnControlType method returns the name of the control used to edit
the specified column’s cells. This method is primarily for informational purposes.
Some methods of the grid control may only be called on columns that use specific
types of controls. You can use this method to verify the control type before calling
those methods.
This method is available only for grids whose Editable property has been set to Yes in
the User Interface Editor.
Return Values Returns a String object containing the name of the control type. This method returns
one of the following values:
176 GetColumnControlType
ClearBasic Control Reference
Grid control
method GetColumnMaxLength
Description The GetColumnMaxLength method returns the maximum number of bytes available
for storing data in the cells of the specified column. This value does not correspond to
the visual width of the column in pixels.
This value cannot be set using ClearBasic; you must set it at design time using the
User Interface Editor. You can assign a maximum length value only to lookup
controls, edit controls, and drop-down combo boxes.
The value returned by this method applies to data entered using the grid control
interface. The grid generates an error if the user types too many characters or you call
a method with a value that exceeds this limit. Data entered using the grid’s contextual
objects are not bound by this limit.
This method is available only for grids whose Editable property has been set to Yes in
the User Interface Editor.
Return Values Returns an integer value containing the number of bytes allowed for data in the cells
of the specified column.
GetColumnMaxLength 177
ClearBasic Control Reference
Grid control
method GetColumnNames
Applies To Grid
Description The GetColumnNames method returns a list containing the names of each column in
the grid. The names returned by this method are the visible names displayed at the
top of the column. The name of a column does not necessarily correspond to the name
of the field associated with that column.
The order of the returned column names corresponds to the current order of the
columns in the grid. If user may rearranged the grid columns at runtime, the names
are returned in the rearranged order.
Parameters None.
Return Values Returns a list of String objects, each of which contains the name of one column.
178 GetColumnNames
ClearBasic Control Reference
Grid control
method GetList
Applies To Grid
Description The GetList method returns the list of items currently in the grid.
Because of paging limitations, this method returns only the records currently in
memory. For large result sets, this list may contain only a portion of the total records.
Return Values If an index is specified, this method returns the item at the specified index. If no index
is specified, this method returns a list of the items currently in the control. The data
type is the same as the items in the grid.
GetList 179
ClearBasic Control Reference
Grid control
method GetSelected
Applies To Grid
Description The GetSelected method returns the current selection. If an item is selected, this
method returns True and places the selected item into the SelectedItem output
parameter. If no item is selected, this method returns False and does not put a value in
the SelectedItem parameter. This method returns an error if more than one item is
selected, so it should not be used on controls that support the selection of multiple
items (use SelectedList instead).
NOTE: This method performs the same function as the Selected property, except that this
method can be used with user-defined types, unlike Selected.
Return Values Returns True if an item is selected and False if no item is selected.
Example In the following button click procedure, the code first checks whether the user
selected anything in the grid. If a selection was made, GetSelected returns the
record to MyRecord, changes the field value, then updates the database with the
changes.
Sub SelectMe_Click
Dim MyRecord As Record
Dim Bulks As New BulkSave
If MyCustList.GetSelected(MyRecord) Then
MyRecord.SetField "myfield", "Notified"
180 GetSelected
ClearBasic Control Reference
Grid control
Bulks.UpdateRecord MyRecord
Bulks.Save
End If
End Sub
GetSelected 181
ClearBasic Control Reference
Grid control
method GetSelectedColumns
Applies To Grid
You use this method in a SortColumn event handler to determine which columns to
use when sorting the rows of the grid.
Parameters None.
Return Values Returns a List containing zero or more strings. Each string contains the name of a field
corresponding to a selected column.
182 GetSelectedColumns
ClearBasic Control Reference
Grid control
method HideColumn
Applies To Grid
Description The HideColumn method hides the specified column. You can use this method to
prevent users from accessing information in a particular column. Your application can
also use this method to show a column that is already hidden.
When you hide a column, the column is no longer visible in the grid control. While
hidden, you can still manipulate the column and its contents using ClearBasic code.
However, the user cannot see any of the changes until you show the column again.
NOTE: The grid control does not let the user show a column that is hidden. Hidden columns
can only be modified by your ClearBasic code.
HideColumn 183
ClearBasic Control Reference
Grid control
method IsColumnEditable
Description The IsColumnEditable method returns a boolean indicating whether the Editable
property of the specified column is set. If the property is set, the user can modify the
cells in this column; otherwise, the user can only view the cell contents.
You must decide at design time whether you want users to be able to modify the cells
in a particular column. Use the User Interface Editor to set the value of the column’s
Editable property as it cannot be changed using ClearBasic.
NOTE: This method only detects the Editable property set for the column in the User Interface
Editor. This method does not detect the read-only status of a cell that was set using the
SetCellReadOnly or SetRowReadOnly methods.
This method is available only for grids whose Editable property has been set to Yes in
the User Interface Editor.
Return Values Returns True if the specified column is editable, otherwise False.
184 IsColumnEditable
ClearBasic Control Reference
Grid control
method IsColumnRequired
Description The IsColumnRequired method returns a boolean indicating whether the Required
property of column was set using the User Interface Editor. If this property is set, the
cell in this column must contain a value before the corresponding record can be saved.
If the property is not set, the cell can be left empty.
You must decide at design time whether or not a cell requires data. Use the User
Interface Editor to set the value of the column’s Required property as it cannot be
changed using ClearBasic.
It is your responsibility to make sure each required field contains a suitable value.
Therefore, you must always call this method in your RowChanged event handler
before attempting to save the row.
This method is available only for grids whose Editable property has been set to Yes in
the User Interface Editor.
Return Values Returns True if the Required property is set, otherwise False.
IsColumnRequired 185
ClearBasic Control Reference
Grid control
method RemoveByItem
Applies To Grid
Description The RemoveByItem method removes one item or a list of items from the grid. If any
of the specified items are not in the grid, this method removes the items it can find
and returns a list of the missing items.
Return Values Returns a List object containing zero or more records. Each record in the list
corresponds to an item that was not found in the grid.
186 RemoveByItem
ClearBasic Control Reference
Grid control
method RemoveItem
Applies To Grid
Description The RemoveItem method removes the specified item from the grid, using the index
provided. This method does not delete any information from the database. It simply
removes the specified item from the grid’s contextual object.
NOTE: Because of paging limitations, the index you specify must correspond to the index of a
record relative to the currently loaded page.
RemoveItem 187
ClearBasic Control Reference
Grid control
method RemoveSelected
Applies To Grid
Description The RemoveSelected method removes the items that are currently selected in the
grid control.
Calling this method does not delete the records from the database; it simply removes
them from the result set of the most recent query. If you rerun the original query you
used to fill the grid, the query still returns the removed records.
Parameters None.
Return Values This method returns the number of items that are left in the grid after the removal of
the selected item(s).
Example The following code snippet shows one application of this method. Selected items are
removed from MyControl and the number of items remaining in the control are
returned to Count. If no more items are left in the control, the REMOVE button is
disabled.
Count = MyControl.RemoveSelected
If Count = 0 Then
Remove.Enabled = False
End If
188 RemoveSelected
ClearBasic Control Reference
Grid control
method ReplaceItem
Applies To Grid
Description The ReplaceItem method replaces an item in the control with another item. This
method will replace an existing item in a control list with the supplied object. The
index parameter specifies which item to replace in the list. This index must contain a
number between 0 and the number of items in the list minus 1. If the index is not in
this range, an error will result. Also, an error will result if the type of object being
replaced into the control's list is not the same as the type of objects currently in the
control's list.
The ReplaceItem method does not support UDTs. For UDTs, you must use the
ReplaceByIndex method.
ReplaceItem 189
ClearBasic Control Reference
Grid control
method SaveAnyChanges
Normally, RowChanged events are triggered when the user has edited a row and then
selects a cell in another row. However, the user can dismiss the form without selecting
another row, thus preventing the dispatch of the final RowChanged event. This
method allows you to generate the RowChanged event manually so that you can
prevent the loss of any data.
Call this method before performing any task that might cause row changes to be lost.
For example, call this method from the Click event handler of your form’s Done
button to save any changes before dismissing the form.
This method is available only for grids whose Editable property has been set to Yes in
the User Interface Editor.
Parameters None
Return Values Returns True if the grid changes were saved, or if the grid was not dirty. Returns False
if the changes could not be saved (usually due to invalid data).
Example The following example shows the Click event handler for a form’s Done button.
When this button is clicked, the event handler tries to save any changes to the grid. If
changes were made, the event handler closes the form, otherwise it leaves the form
open so that the user can correct any problems.
Sub CLOSE_Click
If GridCtl.SaveAnyChanges Then
Me.Close
End If
End Sub
190 SaveAnyChanges
ClearBasic Control Reference
Grid control
method SelectedIndexes
Applies To Grid
Description The SelectedIndexes method returns a list of the indexes of the currently selected
items in a control.
If a control allows only one item to be selected at a time, the returned list will always
contain 0 or 1 items (indexes). If a control allows for more than one item to be selected
at a time, the returned list contains 0 or more items. (If no items are currently selected,
the returned list contains 0 items.)
NOTE: Because of paging limitations, the returned indexes correspond to the selected records
on the currently loaded pages only.
Parameters None.
Return Values Returns a list of long integers which are the indexes of the items currently selected in
the control.
SelectedIndexes 191
ClearBasic Control Reference
Grid control
method SelectedList
Applies To Grid
Description The SelectedList method returns a list of the currently selected items in a control.
NOTE: Because of paging limitations, the selection returned by this method never extends
beyond page boundaries.
Use this method where more than one item at a time can be selected in a control. If
only one item can be selected at a time in the control, using the Selected property
may be more convenient.
Parameters None
Return Values Returns a List object containing zero or more items. Each item corresponds to a
selected record in the grid.
192 SelectedList
ClearBasic Control Reference
Grid control
method SetCellColoring
Applies To Grid
Description The SetCellColoring method associates a custom color procedure with the grid.
You must write the color procedure that you pass to this method. When you call this
method, the grid immediately runs your color procedure to establish the colors for the
grid’s current contents. After this method returns, the grid runs the color procedure
any time you add or remove rows.
The color procedure you define must take no parameters and return no values. The
following example shows a sample color procedure:
Sub MyColorProc
' Apply color using the ColorCells method
End Sub
In your color procedure, call the ColorCells method to apply colors to the cells of
the grid. The colors you specify must belong to the current color scheme. To ensure
that the colors exist, call the SetColorScheme method prior to calling
SetCellColoring.
IMPORTANT: If you specify a ColorProc that is invalid or that cannot be found, all subsequent
operations affecting the grid will fail.
SetCellColoring 193
ClearBasic Control Reference
Grid control
Examples The following example shows a sample color procedure that applies a color to the
column containing the “priority” field.
The first part of the example sets up the initial color scheme. In a global module, the
Initialize_App routine defines the color scheme and associates different colors
with the values that can exist in the “priority” field. In the global module, define the
following code:
Sub Initialize_App
Dim ColorVals As New List
Dim ColorNames As New List
ColorNames.AppendItem "Immediate", _
"Urgent", "Casual", "Other","Medium"
App.CreateColorScheme "MyColorScheme", _
ColorNames, ColorVals
End Sub
In the form module, the Form_Load routine sets the current color scheme and
associates a color procedure with the grid. The color procedure iterates through the
rows of the grid and assigns an appropriate color to the “priority” field of each row, as
shown in the following code:
'In the form module
Sub Form_Load
App.SetColorScheme "MyColorScheme"
MyGrid.SetCellColoring "MyColorProc"
Me.DoDefault
End Sub
Foregrounds.ItemType="String"
Backgrounds.ItemType="String"
RowList.ItemType="Integer"
ColList.ItemType="Integer"
194 SetCellColoring
ClearBasic Control Reference
Grid control
RowList.AppendItem Row
ColList.AppendItem 2 ' Third column is “priority”
Next Row
SetCellColoring 195
ClearBasic Control Reference
Grid control
method SetCellFocus
Description The SetCellFocus method sets the cell focus to the specified cell. The cell focus
indicates which cell in the grid receives system-level events such as keyboard events.
Only one cell in the grid may own the cell focus at any given time.
The grid control highlights the cell with the cell focus and displays the control
associated with that cell’s column. If the cell is hidden behind another control, this
method fronts the entire grid control.
If a cell is being edited, changing the cell focus generates a CellChanged event and
may also generate a RowChanged event. This method generates a RowChanged event
if the new cell is in a different row from the cell that previously owned the cell focus.
The CellChanged event occurs before the RowChanged event.
This method is available only for grids whose Editable property has been set to Yes in
the User Interface Editor.
NOTE: Because of paging restrictions, you can set the cell focus to a cell only if the cell is on a
page currently loaded into memory.
196 SetCellFocus
ClearBasic Control Reference
Grid control
method SetCellReadOnly
Description The SetCellReadOnly method sets the read-only status of a single cell in the grid
control. You can use this method to prevent the user from editing specific cells in the
grid.
Refreshing the contents of the grid neutralizes the effects of this method. After you
refresh the grid, you must call SetRowReadOnly again to mark any desired rows as
read-only. As a result, this method is most appropriate for use on the current row in
situations where you want to change the read-only state of cells based on input to
another cell.
This method is available only for grids whose Editable property has been set to Yes in
the User Interface Editor.
NOTE: Because of paging restrictions, you can set the read-only status of a cell only if the cell
is on a page currently loaded into memory.
SetCellReadOnly 197
ClearBasic Control Reference
Grid control
method SetCellText
Description The SetCellText method sets the value for the specified cell, even if the cell’s
column is not editable. The length of the new data string must not exceed the
maximum length allowed by the field. After setting the new value, this method
generates a CellChanged event.
This method is available only for grids whose Editable property has been set to Yes in
the User Interface Editor.
198 SetCellText
ClearBasic Control Reference
Grid control
method SetContextMenuEnabled
Applies To Grid
You can call this method from a ContextMenuDisplaying event handler to adjust
the appearance of the items in the menu. The enabled state of the item does not
change until you call this method again.
You may use this method to modify both permanent menu items and those added
using the AppendContextMenu method. To set the default enabled state of a
permanent menu item, modify the item’s entry in the User Interface Editor.
SetContextMenuEnabled 199
ClearBasic Control Reference
Grid control
method SetContextMenuVisible
Applies To Grid
You can call this method from a ContextMenuDisplaying event handler to adjust
the appearance of the items in the menu. The visible state of the item does not change
until you call this method again.
You may use this method to modify both permanent menu items and those added
using the AppendContextMenu method. To set the default visible state of a
permanent menu item, modify the item’s entry in the User Interface Editor.
200 SetContextMenuVisible
ClearBasic Control Reference
Grid control
method SetEditStates
Description The SetEditStates method sets the read-only state for a group of rows or cells.
Call this method from a Refresh event handler to set the read-only state of the rows
or cells when the grid is updated. If you omit the FieldNameList parameter, this
method applies the changes to entire rows. If you specify a value for the
FieldNameList parameter, the changes are applied to individual cells.
To mark a set of rows as read-only, specify the same number of elements in both the
StateList and RowList parameters. This method assigns each element in the StateList
parameter to the row at the same index in the RowList parameter.
IMPORTANT: If you are modifying a baseline form, the UseExisting parameter must
contain the value True.
This method is available only for grids whose Editable property has been set to Yes in
the User Interface Editor.
SetEditStates 201
ClearBasic Control Reference
Grid control
Example The following code shows the Refresh event handler used to modify the read-only
status of a set of cells. This event handler iterates through the new list of rows and
checks the current status and owner of each record. If the record’s current status is
"closed", this method makes the "title" field read-only. If the supervisor owns the
record, this method makes the "priority" field editable.
Sub MyGrid_Refresh()
dim source as List
dim Value as New List
dim Rows as New List
dim Cols as New List
dim RecBuf as Record
dim i as Integer
dim CurStatus as String
dim Owner As String
Value.ItemType = "Integer"
Rows.ItemType = "Integer"
Cols.ItemType = "String"
202 SetEditStates
ClearBasic Control Reference
Grid control
Cols.AppendItem "title"
Value.AppendItem 1
End If
End If
Me.ForceRedraw
End If
End Sub
SetEditStates 203
ClearBasic Control Reference
Grid control
method SetNewRowIndicator
Description The SetNewRowIndicator places a new row indicator next to the row and marks
the row as dirty. Call this method immediately after creating a new row in the
NewRow event handler. When the user begins editing a cell in the row, the control
removes the indicator automatically.
This method is available only for grids whose Editable property has been set to Yes in
the User Interface Editor.
204 SetNewRowIndicator
ClearBasic Control Reference
Grid control
method SetRowReadOnly
Description The SetRowReadOnly method sets the read-only status of a row of cells in the grid
control. You can use this method to prevent the user from editing the contents of an
entire row.
Refreshing the contents of the grid neutralizes the effects of this method. After you
refresh the grid, you must call SetRowReadOnly again to mark any desired rows as
read-only. As a result, this method is most appropriate for use on the current row in
situations where you want to change the read-only state of cells based on input to
another cell.
This method is available only for grids whose Editable property has been set to Yes in
the User Interface Editor.
SetRowReadOnly 205
ClearBasic Control Reference
Grid control
method SetSelected
Applies To Grid
Description The SetSelected method deselects any previously selected items in a grid and
selects the specified item or items. Because of paging limitations, selections are limited
to those rows on the currently loaded pages. The grid’s source contextual object
always contains the contents of the currently loaded pages.
NOTE: Because this method sets the selection programmatically, it does not generate a Click
event for the grid.
206 SetSelected
ClearBasic Control Reference
Grid control
method UndoRowChanges
Syntax YourGrid.UndoRowChanges
Description The UndoRowChanges method aborts the changes made to a row and restores the
original values of the changed cells. Call this method only from your RowChanged
event handler.
Normally, you use this method after prompting the user to discard any row changes.
Use this method to discard the row changes.
This method is available only for grids whose Editable property has been set to Yes in
the User Interface Editor.
Parameters None
Example The following example prompts the user to save, discard, or cancel any row changes.
If the user chooses to discard the row changes, the RowChanged event handler calls
UndoRowChanges.
Sub MyGrid_RowChanged()
Select Case App.MsgBox(“Save changes?”, _
cbSaveDiscardCancel, “Confirmation Message”)
Case cbIdSave
Call SaveData
Case cbIdCancel
MyGrid.AbortRowChange cbAbortUndo, ““, “login_name”
Case cbIdDiscard
MyGrid.UndoRowChanges
End Select
End Sub
UndoRowChanges 207
ClearBasic Control Reference
Grid control
method UnSelect
Syntax YourGrid.Unselect
Applies To Grid
Parameters None
Example The following example implements a Click event handler for a button. When the
button is pressed, the current selection is cleared.
Sub cmdClearSelection_Click
MyGrid.Unselect
End Sub
208 UnSelect
ClearBasic Control Reference
Grid control
method Up
Syntax YourGrid.Up
Applies To Grid
Description The Up method moves the selected item(s) up one place in the control.
When used on controls, this method moves the selected item or items in the control up
one place. This means that each selected item is moved up so that it appears one line
higher than previously displayed. Items that are displaced are moved down
accordingly. Note that this method will work if multiple items are selected; in that
case, some displaced items may be moved down several places to make room for the
items that move up.
If a selected item is already at the top of the list, it will remain at the top of the list.
Additionally, if more than one item is selected, but all the items between it and the top
of the list are also selected, then that item will remain in its previous position.
Parameters None
Up 209
ClearBasic Control Reference
Grid control
property AppendRows
Description The AppendRows property contains a boolean value indicating whether or not new
rows can be added to the grid. If this property is set to True, the user may add new
rows by selecting the last row in the grid and pressing the down-arrow key.
This property is read-only from ClearBasic code. You must use the User Interface
Editor to set the value of this property.
This property is available only for grids whose Editable property has been set to Yes
in the User Interface Editor.
210 AppendRows
ClearBasic Control Reference
Grid control
property CObj
Applies To Grid
Description The CObj property contains the ContextualObject instance currently associated with
the grid control. You can assign a new contextual object to the grid by changing the
value in this property. If you change the contextual object, make sure you refresh the
contents of the grid.
This property applies only to grids that support multiple contextual objects. For
information on creating grids that support multiple contextual objects, see the User
Interface Editor Guide.
CAUTION: If the grid is associated with a Select CBX control, do not modify this property.
Use the SetCObj method of the Select CBX control instead. The Select CBX maintains state
information about the current contextual object. Changing the grid’s contextual object in this
situation can cause errors in the behavior of the grid.
CObj 211
ClearBasic Control Reference
Grid control
property DataChanged
Applies To Grid
Description The DataChanged property indicates whether the user made modifications to the
grid’s contents. This property does not indicate changes made programmatically. If
you modify the contents of a control programmatically, you can change the value in
this property directly to reflect your changes.
This property contains the value True if changes were made to the control, otherwise
it contains the value False.
IMPORTANT: The DataChanged property is not affected by selecting a row of the grid.
212 DataChanged
ClearBasic Control Reference
Grid control
property Dirty
Description The Dirty property contains a boolean value indicating whether the grid contains
any dirty rows. A dirty row is one that has been changed by the user but which has
not been saved to the database. The grid control displays a pencil icon ( )
immediately to the left of any dirty row.
Using the AppendItem method to add a new row to the grid has no effect on this
property. However, modifying the contents of a cell in that row sets this property to
True.
This property is available only for grids whose Editable property has been set to Yes
in the User Interface Editor.
Dirty 213
ClearBasic Control Reference
Grid control
property ListCount
Applies To Grid
Description The ListCount property contains the number of rows currently loaded into memory
for the grid. If the grid supports paging, this value can be less than the total number of
rows in the grid. Compare this property with the TotalRows property, which returns
the total number of rows in the grid.
214 ListCount
ClearBasic Control Reference
Grid control
property ListIndex
Applies To Grid
Description The ListIndex property contains an integer value indicating the index of the
selected item. If no item is selected, the value is -1. If multiple items are selected, this
property contains the index of the first item in the selection.
ListIndex 215
ClearBasic Control Reference
Grid control
property MultiSelect
Applies To Grid
Description The MultiSelect property contains a boolean value that indicates whether the grid
supports the selection of more than one item. Set this property to True to support the
selection of multiple items in the grid. Set it to False to disallow multiple selected
items.
Changing this property at runtime does not permanently set the property for the grid.
The new value remains in effect only until the form containing the grid is dismissed.
216 MultiSelect
ClearBasic Control Reference
Grid control
property NewIndex
Applies To Grid
Description The NewIndex property contains a long integer with the index of the most recently
added item. You can pass this index to other methods so that they can modify (or
subsequently remove) the item.
When you add a new item, the AppendItem method updates this property to reflect
the position of any new items. Methods that remove items reset the value in this
property to -1.
NewIndex 217
ClearBasic Control Reference
Grid control
property PagingEvent
Applies To Grid
Description The PagingEvent property contains a boolean value indicating whether or not the
grid is currently loading a new page of data. This event occurs when the user attempts
to scroll beyond the number of records currently in memory. See Paging on page 149
for more information on how grids handle paging.
You should check this property from your CellChanged and RowChanged event
handlers. If this property contains the value True, your event handlers cannot cancel
any changes that were made to the cells. The event handler must either save or
discard the changes.
218 PagingEvent
ClearBasic Control Reference
Grid control
property Parent
Applies To Grid
Description The Parent property contains a reference to the Form object that owns the grid. You
can use this property to access information on the parent form.
See Also SetParent method (Form object in the ClearBasic Object Reference)
Parent 219
ClearBasic Control Reference
Grid control
property PromptOnSave
Description The PromptOnSave property contains a boolean value indicating whether or not the
user should be prompted before saving any data to the database. Check the value of
this property in your RowChanged event handler before saving a row to the database.
If this property contains the value True, display a dialog to confirm the changes with
the user. Your dialog should display buttons that allow the user to save or discard the
changes. You should also provide a Cancel button to stop the action.
NOTE: In cases where the user may want to modify multiple rows, you can add an option to
your dialog that allows the user to skip future confirmation dialogs. If the user sets this option,
your RowChanged code can simply use the user’s last choice
This property is read-only from ClearBasic code. You must use the User Interface
Editor to set the value of this property.
This property is available only for grids whose Editable property has been set to Yes
in the User Interface Editor.
220 PromptOnSave
ClearBasic Control Reference
Grid control
property SelCount
Applies To Grid
Description The SelCount property contains an integer that indicates the number of currently
selected items in the grid. If no items are selected, this property contains the value 0.
This property is read-only.
SelCount 221
ClearBasic Control Reference
Grid control
property Selected
Applies To Grid
Description The Selected property contains the selected item in the grid. It is not intended to be
used for controls where multiple items can be selected. (If more than one item is
selected, an error is generated.)
IMPORTANT: This property cannot be used on controls that contain user-defined type values.
If the control contains user-defined type values, then use the GetSelected method.
This property returns the actual item selected. The type of the item is the same as the
record type for the grid’s source contextual object. If no item is selected, it returns a
variant NULL value.
222 Selected
ClearBasic Control Reference
Grid control
property Sorted
Applies To Grid
Description The Sorted property contains a boolean value indicating whether the items in the
control’s list are sorted. Sorting is determined by the current settings of the grid’s
source contextual object. This property contains the value True if the items in the
control’s source contextual object are sorted, otherwise False.
See Also Sort method (ContextualObject object in the ClearBasic Object Reference)
Sorted 223
ClearBasic Control Reference
Grid control
property Tag
Applies To Grid
Description The Tag property allows you to assign a tag string to the grid, with no effect other
than identifying the object in some way or providing extra data about it.
224 Tag
ClearBasic Control Reference
Grid control
property TopIndex
Applies To Grid
Description The TopIndex property scrolls the item of the specified index to the top of the
control. It does not permanently move the item in relation to the other items, but only
moves it up temporarily. The next time the user scrolls the grid, the position of the
items in the list will change.
You can get the TopIndex anytime, and you can also set the TopIndex, but you must
be aware that there are certain operations that will destroy your setting of this
property. Essentially, if you do anything to the control or the control’s contextual
object in the same event, your setting of the TopIndex will be lost. This includes:
AppendItem, SetSelected, Refresh, Fill, and so on. So, the TopIndex setting
will only take effect if you are careful not to do any other things that change the
control.
When calling this method, you may specify any integer greater than zero and less
than the total number of items in the control.
When read, this property returns the index of the item currently at the top of the
control.
TopIndex 225
ClearBasic Control Reference
Grid control
property TotalRows
Description The TotalRows property indicates the total number of rows in the grid. This value
includes all rows, whether or not they are loaded into memory. Compare this property
with the ListCount property, which returns the number of rows currently loaded
into the grid.
This property is available only for grids whose Editable property has been set to Yes
in the User Interface Editor.
226 TotalRows
ClearBasic Control Reference
Grid control
event AdhocCellChanged
Applies To Grid
Description The AdhocCellChanged event notifies your application when the value of an adhoc
query cell changes to a non-empty value. The grid control sends this event instead of a
CellChanged event when the cell focus leaves a cell in the adhoc query row. This
event only occurs if the grid is associated with a Select CBX control displaying the
adhoc query row. This event does not occur if the contents of the adhoc query cell are
cleared.
In your AdhocCellChanged event handler, validate the cell’s new value. For
example, you might perform checks to make sure an integer value is within a specific
range. You can get the cell value and location by calling the GetChangedCell
method.
When your event handler exits, the grid control stores the cell value internally. If the
cell contains an invalid value, you can prevent the new value from being saved by
calling the RejectAdhocCellEntry method of the Select CBX.
NOTE: To validate cells outside of the adhoc query row, use the CellChanged event instead.
This property is available only for grids whose Editable property has been set to Yes
in the User Interface Editor.
AdhocCellChanged 227
ClearBasic Control Reference
Grid control
event Cell_Btn_Click
Description The Cell_Btn_Click event reports the click of a button in a Lookup, dropdown list
box, or dropdown combo box control of the grid. This event occurs after the user has
clicked the button but before any other actions are taken.
For cells that contain a dropdown list box or dropdown combo box, the grid control
calls your event handler to give it a chance to update the contents of the dropdown
list. After calling your event handler, the grid displays the list and sends additional
events in response to the user’s selection.
For cells that contain a lookup control, you must use this event to handle clicks in the
Lookup ( ) and GoTo ( ) buttons of the control. When the user clicks the
Lookup button, use your event handler to display an appropriate selection form.
After the user makes a selection, change the cell text to display the value of the
selected item in the cell.
When the user clicks the GoTo button, use your event handler to display the details of
the currently selected item. The grid sends this event only if the cell contains a non-
empty string. The Text parameter contains the contents of the cell; use this parameter
to locate the item selected by the user.
228 Cell_Btn_Click
ClearBasic Control Reference
Grid control
Cell_Btn_Click 229
ClearBasic Control Reference
Grid control
event CellChanged
Description The CellChanged event notifies your application when the value of a grid cell
changes. The grid sends this event automatically when the focus leaves a cell whose
contents have changed. The user may change the cell focus by selecting another cell or
you may change the focus programmatically by calling the SetCellFocus method.
In your CellChanged event handler, validate the cell’s new value. For example, you
might perform checks to make sure an integer value is within a specific range. You can
get the cell value and location by calling the GetChangedCell method.
IMPORTANT: Use this event only for validating the contents of the cell. Do not attempt to
display any new forms or modify the contents of any grid cells from your event handler.
When your event handler exits, the grid control saves the cell value to the control’s
contextual object. If the cell contains an invalid value, you can prevent the new value
from being saved by calling the AbortCellChange method.
NOTE: To validate the value in a cell belonging to the adhoc query row, use the
AdhocCellChanged event instead.
This property is available only for grids whose Editable property has been set to Yes
in the User Interface Editor.
Example The following example shows the CellChanged event handler for the grid whose
name is GridCtl. This event handler validates only the quantity field of the grid. If
the user specifies a negative quantity, the event handler calls the AbortCellChange
method to notify the user that a positive value must be entered.
Sub GridCtl_CellChanged
dim rowNum as Integer
dim fieldName as String
dim fieldData as String
dim numItems as Integer
230 CellChanged
ClearBasic Control Reference
Grid control
CellChanged 231
ClearBasic Control Reference
Grid control
event Cell_Click
Description The Cell_Click event reports a click in a different cell than the currently selected
cell. Subsequent clicks in the same cell do not trigger this event. However, clicking in a
different cell generates a new Cell_Click event for that cell.
The grid fires this event for every cell of the grid, including the row and column
headers. When the user clicks in a row header, the FieldName parameter contains an
empty string. When the user clicks in a column header, this event sets the RowNumber
parameter to a negative number. When you click in any other cell, the grid selects the
row containing that cell.
For editable grids, if the current cell is dirty, the grid sends a CellChanged event
before sending this event. If the CellChanged event prevents the change of focus,
this event is not sent.
232 Cell_Click
ClearBasic Control Reference
Grid control
event Cell_List_Select
Description The Cell_List_Select event reports the selection of an item in a dropdown list
box or dropdown combo box control. The grid control sends this event immediately
prior to a CellChanged event; however, this event occurs while the cell still has the
focus.
Cell_List_Select 233
ClearBasic Control Reference
Grid control
event Click
Applies To Grid
Description The Click event occurs when the user clicks in a different row. Subsequent clicks in
the same row do not generate additional Click events. However, clicking in a
different row generates a new Click event for that row.
The Click event handler reports clicks in both the rows of the list and in the column
headers of the list. If a click occurs in a column header, the GetSelected method
returns False and the SelectedList method returns an empty list.
For editable grids, if the current row is dirty and the user clicks in another row, the
Click event for the new row fires after the RowChanged event for the old row.
234 Click
ClearBasic Control Reference
Grid control
event ContextMenuDisplaying
Applies To Grid
Description The ContextMenuDisplaying event notifies your control that its context-sensitive
menu is about to be displayed. This event is sent before the menu is displayed. Use
this event to update the appearance of the menu and its items. You can enable or
disable items, set the visibility of items, or add items to the menu as appropriate.
Example The following example enables and disables items in a grid control’s context-sensitive
menu. The new items allow the user to select all of the rows in the grid and to deselect
whatever is currently selected. Because the items do not apply in all situations, they
are disabled when the appropriate conditions are met.
Sub GridCtl_ContextMenuDisplaying
Dim numSelItems As Integer
Dim numTotalItems As Integer
ContextMenuDisplaying 235
ClearBasic Control Reference
Grid control
event ContextMenu_Select
Applies To Grid
Description The ContextMenu_Select event notifies your application that the user chose an
item from the grid’s context-sensitive menu. In your event handler, perform the task
associated with the menu item. Use the EventName parameter to determine which
menu item was selected by the user.
You can define menu items at design time using the User Interface Editor or at
runtime using the AppendContextMenu method.
236 ContextMenu_Select
ClearBasic Control Reference
Grid control
event DblClick
Applies To Grid
Description The DblClick event occurs when the user double clicks on the grid control. When
the user double-clicks a grid, the following events occur in order:
■ A Click event for the grid
■ A DblClick event for the grid
■ A Click event for the default button on the form.
DblClick 237
ClearBasic Control Reference
Grid control
event DoAdhocQuery
Applies To Grid
Description The DoAdhocQuery event notifies your grid control when the user wants to perform
a query using the information in the adhoc query row of the grid control. This event
only occurs if the grid is associated with a Select CBX control displaying the adhoc
query row. The user triggers the generation of this event by pressing the Enter key
when the cell focus is on a cell in the adhoc query row.
NOTE: The Find button associated with a Select CBX control does not trigger this event.
In your DoAdhocQuery event handler, you must use the information in the adhoc
query row of the list to perform the query. Call the GetAdhocRowValues method of
the corresponding Select CBX control to retrieve the values in the cells of the adhoc
query row.
238 DoAdhocQuery
ClearBasic Control Reference
Grid control
event NewRow
Description The NewRow event notifies your application when the user wants to add a new row to
the grid. The user creates new rows by pressing the Insert key.
In your NewRow event handler, create a new record object and fill it with default
information appropriate for the record or view displayed by the grid. To add the
record object to the grid, use the AppendItem method.
NOTE: If the grid’s AppendRows property is set to False, the grid does not send NewRow
events. To set the value for the AppendRows property, use the User Interface Editor.
Adding a new row does not affect the contents of the grid’s Dirty property unless
you call the SetNewRowIndicator method. If you modify one or more cells, you can
mark the grid as dirty and thus force the grid to save the new row, even if the user has
not entered any data.
This property is available only for grids whose Editable property has been set to Yes
in the User Interface Editor.
NewRow 239
ClearBasic Control Reference
Grid control
event Refresh
Applies To Grid
Description The Refresh event notifies your application that the contents of the grid have
changed. The grid sends this event every time the grid is filled with a new set of
records or when you call the Refresh, AppendItem, or ReplaceItem of the grid.
In your Refresh event handler, you can update the read-only status of the newly
loaded records and perform any other necessary cleanup. Use the SetEditStates
method to set the read-only status of a group of cells and rows in one operation.
The Select CBX control uses paging to fill its associated grid control with the next set
of records returned by a query. The grid sends this event each time a new page is
loaded.
240 Refresh
ClearBasic Control Reference
Grid control
event RowChanged
Description The RowChanged event notifies your application that one or more cells in a row have
changed. The grid sends this event when the user selects a different row or when you
call the SaveAnyChanges method from your ClearBasic code. Use this event to save
any pending changes before the user begins working on a different row. The grid does
not send this event if the cells in the row have not changed.
In your RowChanged event handler, save the contents of the modified row to the
database. The grid control maintains changes to the row in the attached contextual
object. When the user selects a cell in a different row, save the changes to the database
before allowing the user to modify the new row.
If the PromptOnSave property of the grid control is set to True, your RowChanged
event handler should prompt the user with a confirmation dialog.
In addition to saving the changes to the database, you can use the RowChanged event
to perform additional validation on the row. Use this technique to supplement the
validation you perform in your CellChanged event handler. This technique is useful
when the value in one cell depends on the value in another cell and you want to wait
until the user has finished editing all of the dependent cells.
Call the GetChangedRow method to determine which of the row’s cells changed and
what their new values are. To abort all of the changes made to the row and restore the
original cell values, call the AbortRowChange method.
This property is available only for grids whose Editable property has been set to Yes
in the User Interface Editor.
Example The following example gets the changed record and saves it to the database using a
BulkSave object.
Sub GridCtl_RowChanged
dim blkSave as New BulkSave
dim recordList as List
dim changedRec as Record
dim rowIndex as Integer
dim cols as List
dim values as List
dim promptRet as Long
RowChanged 241
ClearBasic Control Reference
Grid control
cbSaveDiscardCancel
Select Case (whichBtn)
Case cbIDSave
' Save changes to the database
Case cbIdDiscard
' Discard changes
GridCtl.UndoRowChanges
Exit Sub
Case cbIdCancel
' Abort the procedure
GridCtl.AbortRowChange cbAbortUndo, ““, ““
Exit Sub
Case Else
' Error. No other buttons should be
' available.
End Select
End If
set recordList = Cobj_GridCtl.Contents
set changedRec = _
Cobj_GridCtl.GetRecordByIndex rowIndex
blkSave.UpdateRecord changedRec
blkSave.Save
End Sub
242 RowChanged
ClearBasic Control Reference
Grid control
event SortColumn
Applies To Grid
Description The SortColumn event notifies your grid control that the user wants to sort its rows.
You must use the currently selected columns to determine the sort order for the rows.
The SortOrder parameter specifies whether you should sort the rows in ascending or
descending order. This event occurs only if the grid is associated with a Select CBX
control.
In your SortColumn event handler, use the information in the currently selected
columns to sort the rows. Typically, you do this by repeating the previous query but
applying the new sort criteria to the query. When executed, the query returns the
records in the new sort order.
NOTE: Due to paging restrictions, the records in the contextual object may be only a portion
of the records in the entire grid.
You can get the list of selected columns by calling the GetSelectedColumns
method. If more than one column is selected, sort the rows based on the left-to-right
order of the columns. That is, use the data in the left-most column to perform the
primary sort and use data in subsequent columns to perform secondary or tertiary
sorts as needed.
Constant Description
cbAscending Sort the items in ascending order.
cbDescending Sort the items in descending order.
SortColumn 243
ClearBasic Control Reference
Grid control
244 SortColumn
ClearBasic Control Reference
Label control
Description The label control displays a static string of text on a form. You can use control to
identify other controls that do not have their own built-in labels.
In the User Interface Editor, you can specify a fixed string of text for the label control
or link the control to a source contextual object. Linking the control to a contextual
object causes the control to receive automatic updates whenever the data in the
contextual object changes.
In addition to specifying fixed text strings, you can use the label control to implement
Hypertext links. When clicked, the label control opens the file that you specified in the
control’s property sheet at design time. You cannot modify the destination of a
Hypertext link at runtime using this control.
Referring to Label You cannot create control objects using ClearBasic code. You must associate controls
Controls with a form, frame, or tab using the User Interface Editor. When the form, frame, or
tab is subsequently displayed, the corresponding control object is created
automatically.
If you need to refer to a control object explicitly, such as when passing a control object
as a method parameter, use a variable of type Control to refer to the control object.
For example, you would use the following code to obtain a reference to the label
control called YourLabelControl:
Dim YourControl As Control
Set YourControl = YourLabelControl
Methods This object supports the following methods. Methods marked with a [C] are
documented with the Control object.
■ Refresh method [C]
Properties This object supports the following properties. Properties marked with [C] are
documented with the Control object.
■ BackColor property
■ Caption property
■ ControlType property [C]
■ Enabled property [C]
■ ForeColor property
■ Height property [C]
■ Id property [C]
■ Left property [C]
■ Name property [C]
■ Parent property
■ Tag property
■ Top property [C]
■ Visible property [C]
■ Width property [C]
246
ClearBasic Control Reference
Label control
property BackColor
Applies To Label
Description The BackColor property allows you to set the background color of a control. You can
set this property directly for the control, or indirectly by setting the property on the
contextual object that is linked to the control.
Before using this property, you must establish a color scheme using either the
CreateColorScheme or SetColorScheme method.
IMPORTANT: Before you can set back or fore colors, you must first create a color scheme (see
CreateColorScheme) that maps available system colors to labels. Then you must use
SetColorScheme to assign that color-to-label mapping to the form where you want to
perform the coloring. The reason for this is that you must specify the label, not the system
color, when you set BackColor or ForeColor.
If you perform color operations on controls that do not support color, no errors are
generated; the controls simply won’t be colored. This may be useful information if
you want to use multiplatform color operations where color may not be universally
supported for a given control type. For example, the label control may be colored on
UNIX, but not on the Macintosh.
Setting Description
ColorLabel You must specify a label that is mapped to a valid system color. The
label must be in the color scheme that is currently in effect for the form
in which you are performing color operations. (See CreateColorScheme
and SetColorScheme.)
Example The following code illustrates how you use color in ClearBasic. (You are not required
to set color in the form load event procedure.)
Before you set the color properties, you must create a color scheme and set it into
effect, as shown in the example. Only then can you color the object you want to color.
In this example, the text box label and the textbox foreground text are assigned the
same color, red, and the background color for the text box label is set to cyan.
Sub Initialize_App
Dim LabelList1 As New List
Dim ColorList1 As New List
LabelList1.AppendItem "Urgent", _
"Important", "Weak"
ColorList1.AppendItem "red", _
BackColor 247
ClearBasic Control Reference
Label control
"cyan", "blue"
App.CreateColorScheme "Form2020", _
LabelList1,ColorList1
End Sub
Sub Form_Load
App.SetColorScheme "Form2020"
TextBox1.ForeColor = "Urgent"
TextBox1_Label.ForeColor = "Urgent"
TextBox1_Label.BackColor = "Important"
End Sub
248 BackColor
ClearBasic Control Reference
Label control
property Caption
Applies To Label
Description Use the Caption property to get or set the text label for the control. If you want to
assign a new value to this property at runtime, make sure you set the Autosizable
property of the control to Yes in the User Interface Editor.
The Caption property works on a control whether you assigned it a fixed text label
or whether you linked the control to a source contextual object. If the control is linked
to a source contextual object, modifying this property also modifies the value in the
specified field of that contextual object.
IMPORTANT: On some platforms, your caption changes may persist when you display or
redisplay the form. If this happens, set the caption in the Form_Load event procedure for that
form. Also, if the control supports labeling through use of a source contextual object, and you
make this source link at design time, you can use the Fill method on the contextual object to
get the caption to display properly.
One way to use the caption property is to change the caption on a control during the
execution of some procedure to indicate that the procedure is executing.
Setting Description
CaptionTextString Specify the text string.
The default caption is the string defined for the form or control at
design time using the User Interface Editor.
Return Values In read mode, this property returns the title of the control or form. If the control is
source linked to a contextual object field, the value of the field is returned.
Caption 249
ClearBasic Control Reference
Label control
property ForeColor
Applies To Label
Description The ForeColor property allows you to set the color of the control label text. You can
set this property directly for the control, or indirectly by setting the property on the
contextual object that is linked to the control.
Before using this property, you must establish a color scheme using either the
CreateColorScheme or SetColorScheme method.
IMPORTANT: Before you can set back or fore colors, you must first create a color scheme (see
CreateColorScheme) that maps available system colors to labels. Then you must use
SetColorScheme to assign that color-to-label mapping to the form where you want to
perform the coloring. The reason for this is that you must specify the label, not the system
color, when you set BackColor or ForeColor.
If you perform color operations on controls that do not support color, no errors are
generated; the controls simply won’t be colored. This may be useful information if
you want to use multiplatform color operations where color may not be universally
supported for a given control type. For example, the Command Button may be
colored on UNIX, but not on the Macintosh.
Setting Description
ColorLabel You must specify a label that is mapped to a valid system color. The
label must be in the color scheme that is currently in effect for the
form in which you are performing color operations. (See
CreateColorScheme and SetColorScheme.)
Example The following code illustrates how you use color in ClearBasic. (You are not required
to set color in the form load event procedure.)
Before you set the color properties, you must create a color scheme and set it into
effect, as shown in the example. Only then can you color the object you want to color.
In this example, the text box label and the textbox foreground text are assigned the
same color, red, and the background color for the text box label is set to cyan.
Sub Initialize_App
Dim LabelList1 As New List
Dim ColorList1 As New List
250 ForeColor
ClearBasic Control Reference
Label control
End Sub
Sub Form_Load
App.SetColorScheme "Form2020"
TextBox1.ForeColor = "Urgent"
TextBox1_Label.ForeColor = "Urgent"
TextBox1_Label.BackColor = "Important"
End Sub
ForeColor 251
ClearBasic Control Reference
Label control
property Parent
Applies To Label
Description The Parent property contains the form object that owns the label control. You can
use this property to retrieve a reference to the form object containing the button.
252 Parent
ClearBasic Control Reference
Label control
property Tag
Applies To Label
Description The Tag property contains a custom string that you assign at runtime. You can use
this string to identify the command button control internally to your application. You
can also use this property to store extra information about the control.
Tag 253
ClearBasic Control Reference
Label control
event Click
Applies To Label
Description The Click event reports a click on a Hypertext-enabled label control. You can use this
event to perform any appropriate action for the label, including displaying a web
page.
254 Click
ClearBasic Control Reference
List Box control
Description The list box control displays a read-only list from which the user may make a
selection. The functionality of this control is similar to the dropdown list box control,
but requires more display space since it displays several list items at once. (The
dropdown list box displays only one item.) You should use this control if you don’t
expect the user to know what the possible selections are without seeing the list.
You can use the methods of the list box control to modify the contents of the list at
runtime. You can add new items to the list or remove existing items. You can move
existing items up or down in the list. You can also get and set the current selection for
the list.
This control does not include a label automatically. To add a label, create a label
control and place it next to this control.
Referring to List Box You cannot create control objects using ClearBasic code. You must associate controls
Controls with a form, frame, or tab using the User Interface Editor. When the form, frame, or
tab is subsequently displayed, the corresponding control object is created
automatically.
If you need to refer to a control object explicitly, such as when passing a control object
as a method parameter, use a variable of type Control to refer to the control object.
For example, you would use the following code to obtain a reference to the list box
control called YourLIstBoxControl:
Dim YourControl As Control
Set YourControl = YourListBoxControl
Source The source contextual object of a list box control stores the list of items to be displayed
in the control. Each item in the list is a string containing the text to display for a single
item. You can specify the items for this list at design time using the User Interface
Editor or at runtime using the methods of the list box control.
Destination The destination contextual object of a list box control stores the list item that is
currently selected. This contextual object must specify a string data type.
Methods This object supports the following methods. Methods marked with a [C] are
documented with the Control object.
■ AppendItem method
■ Clear method
■ Contains method
■ Down method
■ GetList method
■ GetSelected method
■ Refresh method [C]
■ RemoveByItem method
■ RemoveItem method
■ RemoveSelected method
■ ReplaceItem method
■ SelectedIndexes method
■ SelectedList method
■ SetFocus method [C]
■ SetSelected method
■ UnSelect method
■ Up method
256
ClearBasic Control Reference
List Box control
Properties This object supports the following properties. Properties marked with [C] are
documented with the Control object.
■ ControlType property [C]
■ DataChanged property
■ Enabled property [C]
■ Height property [C]
■ hWnd property [C]
■ Id property [C]
■ Left property [C]
■ ListCount property
■ ListIndex property
■ MultiSelect property
■ Name property [C]
■ NewIndex property
■ Parent property
■ SelCount property
■ Selected property
■ Sorted property
■ Tag property
■ Top property [C]
■ TopIndex property
■ UserData property
■ Value property
■ Visible property [C]
■ Width property [C]
Events This object supports the following events. Events marked with a [C] are documented
with the Control object.
■ Click event
■ DblClick event
■ GotFocus event [C]
■ LostFocus event [C]
257
ClearBasic Control Reference
List Box control
method AppendItem
Description The AppendItem method appends a single item or list of items to the control. The
control must have a source contextual object to store the items added by this method.
This method automatically updates the items in the source contextual object.
You can use this method in a Form_Load procedure to initialize the control. If you
had not previously initialized the control’s source contextual object, you must do so
by calling its Fill method before calling this method.
This method updates the value in the NewIndex property to reflect the index of the
newly added item. When you add a list of items, the NewIndex property reflects the
index of the first item in the list.
Example In the following example, NewCourse is added to the list box ListBox1, then the list box
is refreshed to display the added item.
Sub AppendToControl
ListBox1.AppendItem "NewCourse"
ListBox1.Refresh
End Sub
258 AppendItem
ClearBasic Control Reference
List Box control
method Clear
Syntax YourControl.Clear
Description The Clear method removes all of the items from the list box control and from the
control’s source contextual object. This method also resets the value of the NewIndex
property to -1.
After calling this method, call the form’s Refresh method to update the control’s
display.
Parameters None
Clear 259
ClearBasic Control Reference
List Box control
method Contains
Description The Contains method returns a boolean value indicating whether the specified item
is in the list.
Return Values Returns True if the item is already in the control, or False if the item is not in the
control.
Example The following test routine shows one use of the Contains method. In the example,
Contains is used to verify that an item has been properly added to a control.
Notice that the count of items in the control is taken before the new item is added.
This means that the index of Clover should be equal to the count.
Sub TestSub_Click
Dim I As integer
Dim J As integer
I= ListBox1.ListCount
ListBox1.AppendItem "Clover"
ListBox1.Refresh
J= ListBox1.NewIndex
If (J = I) Then
If ListBox1.Contains("Clover") Then
App.MsgBox "Clover is here!"
Else
App.MsgBox "Clover is not here!"
End If
Else
App.MsgBox "Item not added properly"
End If
End Sub
260 Contains
ClearBasic Control Reference
List Box control
method Down
Syntax YourControl.Down
Description The Down method moves the currently selected item down one position in the
control’s list. Any displaced items are moved up to make room for the item. If the
selected item is already at the bottom of the list, it remains there.
Parameters None
Example In the following example, a loop loads five strings into an empty list box. The strings
are sequenced Item 1 to Item 5, and Item 2 is moved down. At this point, the index of
Item 2 should become 2 and the index of Item 3 should become 1. GetList is used to
check this, returning the item at index 1 in the control. If Item 3 is at that index, the
appropriate notification is stored in Logstr.
Sub DownTest
Dim Hold1 As string
Dim Logstr As string
ListBox1.Clear
For i = 1 to 5
ListBox1.AppendItem "item"+Str$(i)
ListBox1.Refresh
Next i
Hold1 = ListBox1.GetList(1)
Down 261
ClearBasic Control Reference
List Box control
method GetList
Description The GetList method returns the items currently in the list box. If you specify an
index of an item in the list, this method returns that item. If you do not specify any
parameters, this method returns the entire list of items.
The source contextual object associated with the control must be initialized before
calling this method.
Return Values Returns a List object containing zero or more strings. Each string in the list
corresponds to an item in the list box control.
If the Index parameter was specified, this method returns a String containing the text
of the desired item.
Example In the following example, a loop loads five strings into an empty list box. The strings
are sequenced Item 1 to Item 5, and Item 2 is moved down. At this point, the index of
Item 2 should become 2 and the index of Item 3 should become 1. GetList is used to
check this, returning the item at index 1 in the control. If Item 3 is at that index, the
appropriate notification is stored in Logstr.
Sub DownTest
Dim Hold1 As string
Dim Logstr As string
ListBox1.Clear
For i = 1 to 5
ListBox1.AppendItem "item"+Str$(i)
ListBox1.Refresh
Next i
Hold1 = ListBox1.GetList(1)
262 GetList
ClearBasic Control Reference
List Box control
GetList 263
ClearBasic Control Reference
List Box control
method GetSelected
Description The GetSelected method returns the currently selected item in the list box. The text
for the item is returned in the SelectedItem parameter, which you must provide
when you call the method. The method returns a boolean value indicating whether or
not an item is selected.
264 GetSelected
ClearBasic Control Reference
List Box control
method RemoveByItem
Description The RemoveByItem method removes one or more items from the list box. After
removing the items, this method sets the value in the NewIndex property to -1. You
can use this method to selectively remove items from the list box control.
As the method processes the list of items, it keeps track of those items that were not in
the control’s list. Upon completion, the method returns the list of missing items to
you. Duplicate entries are considered missing items and are therefore returned in this
list.
Return Values Returns a List object containing zero or more strings. Each string contains the name
of an item that was not in the control’s list.
RemoveByItem 265
ClearBasic Control Reference
List Box control
method RemoveItem
Description The RemoveItem method removes the specified item from the list box. If the
specified item is currently selected, this method clears the selection before removing
the item. After removing the item, this method sets the value in the NewIndex
property to -1
266 RemoveItem
ClearBasic Control Reference
List Box control
method RemoveSelected
Description The RemoveSelected method removes the currently selected items from the list box
control. This method clears the current selection and sets the value in the NewIndex
property to -1.
Parameters None
Return Values Returns a Long integer with the number of items remaining in the control after the
removal of the selected items.
Example The following code snippet shows one application of this method. Selected items are
removed from MyControl and the number of items remaining in the control are
returned to Count. If no more items are left in the control, the REMOVE button is
disabled.
Count = MyControl.RemoveSelected
If Count = 0 Then
REMOVE.Enabled = False
End If
RemoveSelected 267
ClearBasic Control Reference
List Box control
method ReplaceItem
Description The ReplaceItem method replaces the item at the specified index with the desired
string. This method does not affect the current selection or the value in the NewIndex
property.
268 ReplaceItem
ClearBasic Control Reference
List Box control
method SelectedIndexes
This method is provided as a convenience for situations where you may want to
iterate through a group of controls and get the selected items from each.
Parameters None
Return Values Returns a List object containing zero or one long integer. The integer is a 0-based
index into the control’s list of items.
SelectedIndexes 269
ClearBasic Control Reference
List Box control
method SelectedList
Description The SelectedList method returns a list containing the currently selected items in
the control. Because list boxes only allow the selection of one item at a time, this list
can contain at most one item.
This method is provided as a convenience for situations where you may want to
iterate through a group of controls and get the selected items from each.
Parameters None
Return Values Returns a List object containing zero or more strings. Each string in the list
corresponds to a selected item in the control. If no items are selected, the returned list
is empty.
270 SelectedList
ClearBasic Control Reference
List Box control
method SetSelected
Description The SetSelected method selects the specified item. If there was an existing
selection, this method clears it before selecting the new item.
Only one item at a time may be selected for a list box control. If you specify an item
that does not exist in the control’s list, this method exits without clearing the previous
selection.
SetSelected 271
ClearBasic Control Reference
List Box control
method UnSelect
Syntax YourControl.Unselect
Parameters None
272 UnSelect
ClearBasic Control Reference
List Box control
method Up
Syntax YourControl.Up
Description The Up method moves the currently selected item up one position in the control’s list.
Any displaced items are moved down to make room for the item. If the selected item
is already at the beginning of the list, it remains there.
Parameters None
Up 273
ClearBasic Control Reference
List Box control
property DataChanged
Description The DataChanged property contains a boolean value indicating whether the user
modified the contents of this control. This value only indicates whether modifications
were made by the user; it does not reflect changes made to the control by your
ClearBasic code.
If you modify the control programmatically, you can set this property to reflect your
changes. Set this property to True to indicate you made modifications; otherwise, set it
to False to indicate the control is unchanged.
274 DataChanged
ClearBasic Control Reference
List Box control
property ListCount
Description The ListCount property contains a Long integer indicating the total number of
items in the list box control.
ListCount 275
ClearBasic Control Reference
List Box control
property ListIndex
Description The ListIndex property returns the index of the control’s currently selected item. A
list box control may have at most one item selected. The list box may also not have a
selection.
List indexes are 0-based, that is, the first item is at index 0, the second at index 1, and
so on. As a result, the maximum index is always one less than the total number of
items as stored in the ListCount property.
MyRetInt = MyListBox.ListIndex
If MyRetInt = -1 Then
App.MsgBox "No Selection"
Else
‘Do this
...
End If
End Sub
276 ListIndex
ClearBasic Control Reference
List Box control
property MultiSelect
Description The MultiSelect property contains a boolean value indicating whether the list box
supports the selection of multiple items. For list box controls, this property always
contains the value False.
MultiSelect 277
ClearBasic Control Reference
List Box control
property NewIndex
Description The NewIndex property contains a long integer with the index of the most recently
added item. You can pass this index to other methods to modify (or subsequently
remove) the item.
When you add a new item, the AppendItem method updates this property to reflect
the position of any new items. Methods that remove items reset the value in this
property to -1.
278 NewIndex
ClearBasic Control Reference
List Box control
property Parent
Description The Parent property contains the form object that owns the control. You can use this
property in to retrieve a reference to the form object containing the list box.
Parent 279
ClearBasic Control Reference
List Box control
property SelCount
Description The SelCount property contains an integer value indicating the number of currently
selected list items. If no items are selected, this property contains the value 0.
280 SelCount
ClearBasic Control Reference
List Box control
property Selected
Description The Selected property contains the string representing the currently selected item.
List boxes can have at most one item selected. If no item is selected, this property
contains an empty string ("").
This property is provided as a convenience for situations where you may want to
iterate through a group of controls and get the selected item from each.
Selected 281
ClearBasic Control Reference
List Box control
property Sorted
Description The Sorted property contains a boolean value indicating whether the items in the
control’s list are sorted. This property contains the value True if the items in the
control’s source contextual object are sorted, otherwise False.
See Also Sort method (ContextualObject object in the ClearBasic Object Reference)
282 Sorted
ClearBasic Control Reference
List Box control
property Tag
Description The Tag property contains a custom string that you assign at runtime. You can use
this string to identify the control internally to your application. You can also use this
property to store extra information about the control.
Tag 283
ClearBasic Control Reference
List Box control
property TopIndex
Description The TopIndex property contains the index of the first visible item in the list box. This
index is one-based, that is, the first item is at index 1, the second at index 2, and so on.
This property is readable and writable.
The item represented by the index is not necessarily the first item in the list, but it is
the first item scrolled into view in the list box control. If the list box contains a selected
item, the value in this property is 0.
If you assign a new value to this property, the control scrolls the item into view. The
position of other items in the list does not change; only their visibility in the list box
control changes. If you specify an index that is less than 1 or greater than the number
of items in the control, this method generates an error.
The value in this property changes when you add or remove list items, set or clear the
selection, or update the control’s appearance. This property is also modified by
changes to the contents of the control’s destination contextual object. For example,
this property is affected by the AppendItem, SetSelected, and Refresh methods
of the list box control and by the Fill method of a ContextualObject.
284 TopIndex
ClearBasic Control Reference
List Box control
property UserData
Description The UserData property contains the string associated with the currently selected
item. At design time, you can associate a string with each item of a dropdown list. You
can assign individual strings for each item in the list or omit the string as appropriate.
This string may contain a database path or any other type of value that you designate.
This property is read-only. For information on associating user data with dropdown
list box items, see the User Interface Editor Guide.
UserData 285
ClearBasic Control Reference
List Box control
property Value
Description The Value property contains a string with the item text for the currently selected
item. You can get this property to retrieve the item text for the selected item.
If you assign a value to this property, you must specify a string the name of the item
you want to select. This string is case-sensitive and must match the name of an item in
the list exactly. The string you specify is stored in the control’s destination contextual
object.
NOTE: It is possible to update the contents of the control’s destination contextual object
without changing the value in this property. Before getting this property, you can call the
Refresh method to ensure the control’s caches are up-to-date.
286 Value
ClearBasic Control Reference
List Box control
event Click
Description The Click event handler for your list box is called when the user presses and releases
the mouse button over the control. A Click event usually indicates the selection of an
item from the control’s list. However, this event does not distinguish between the
selection of a new item or of the same item.
You can use the Click event handler to perform other actions based on the selection
of an item.
Click 287
ClearBasic Control Reference
List Box control
event DblClick
Description The DblClick event handler for your list box is called when the user double-clicks
the mouse button over the same item in the list box. This event is preceded by a
Click event.
288 DblClick
ClearBasic Control Reference
Multiline Text Box control
Description The multiline text box control provides the user with an area for entering multiple
lines of text. This control is similar to the text box control, except for the way it
processes KeyPress events. When the user presses the Enter key in a multiline text
box, the control automatically adds a line termination character to the end of the
current line and moves the cursor to the next line. Other controls interpret the Enter
key as a button click in the form’s default button.
This control does not include a label automatically. To add a label, create a label
control and place it next to this control.
Context-Sensitive This control supports the display of a context-sensitive menu. The control
Menu Support automatically provides several control-related menu items to allow the user to cut,
copy, and paste text. You may add additional menu items using the methods of this
control.
If you add context-sensitive menu items to a control, you must provide an event
handler to respond to the selection of your menu items. The ContextMenu_Select
event handler lets you handle the selection of all your context-sensitive menu items.
You may also implement a ContextMenuDisplaying event handler to modify the
state of your menu items immediately before the menu is displayed.
Referring to You cannot create control objects using ClearBasic code. You must associate controls
Multiline Text Box with a form, frame, or tab using the User Interface Editor. When the form, frame, or
Controls tab is subsequently displayed, the corresponding control object is created
automatically.
If you need to refer to a control object explicitly, such as when passing a control object
as a method parameter, use a variable of type Control to refer to the control object.
For example, you would use the following code to obtain a reference to the multiline
text box control called YourMTextBoxControl:
Dim YourControl As Control
Set YourControl = YourMTextBoxControl
Source This control does not support the use of a source contextual object.
Destination The destination contextual object of a multiline text box control stores the text entered
either by the user or by your ClearBasic code. This contextual object must specify a
string data type.
Methods This object supports the following methods. Methods marked with [C} are
documented with the Control object.
■ AppendContextMenu method
■ ClearContextMenu method
■ SetContextMenuEnabled method
■ SetContextMenuVisible method
■ Refresh method [C]
■ SetFocus method [C]
Properties This object supports the following properties. Properties marked with [C} are
documented with the Control object.
■ BackColor property
■ ControlType property [C]
■ Enabled property [C]
■ ForeColor property
■ Height property [C]
■ hWnd property [C]
■ Id property [C]
■ Left property [C]
■ MaxLength property
■ MultiLine property
■ Name property [C]
■ Parent property
■ Required property
■ RequiredColor property
■ SelLength property
■ SelStart property
■ SelText property
■ Tag property
■ Text property
■ Top property [C]
■ Value property
■ Visible property [C]
■ Width property [C]
290
ClearBasic Control Reference
Multiline Text Box control
Events This object supports the following events. Events marked with [C} are documented
with the Control object.
■ Click event
■ ContextMenuDisplaying event
■ ContextMenu_Select event
■ GotFocus event [C]
■ KeyPress event
■ LostFocus event [C]
Deprecated Events The following event has changed. The old event is still supported for compatibility
but its use is discouraged. Use the new event instead.
291
ClearBasic Control Reference
Multiline Text Box control
method AppendContextMenu
Description The AppendContextMenu method adds a new menu item to the end of the control’s
context-sensitive menu. You can use this method to supplement the menu items
specified using the User Interface Editor.
In addition to adding menu items, you can use this method to add a separator after an
existing menu item. To add a separator, specify True for the Separator parameter.
The menu items you add using this method are enabled and visible initially. To
change the appearance of an item, call the SetContextMenuEnabled or
SetContextMenuVisible method. You can also add code to a
ContextMenuDisplaying event handler to update the appearance of menu items
dynamically.
292 AppendContextMenu
ClearBasic Control Reference
Multiline Text Box control
Example The following example adds two new items to the context-sensitive menu associated
with a multiline text box control. The new items allow the user to select all of the text
in the control and to deselect whatever is currently selected.
Sub Form_Load
Dim numSelItems As Integer
Dim numTotalItems As Integer
End Sub
AppendContextMenu 293
ClearBasic Control Reference
Multiline Text Box control
method ClearContextMenu
Syntax YourControl.ClearContextMenu
Description The ClearContextMenu method removes custom menu items from the control’s
context-sensitive menu. This method removes only menu items that were added
using the AppendContextMenu method of the control. This method does not remove
application-specific menu items or menu items added in the User Interface Editor.
Parameters None
294 ClearContextMenu
ClearBasic Control Reference
Multiline Text Box control
method SetContextMenuEnabled
You can call this method from a ContextMenuDisplaying event handler to adjust
the appearance of the items in the menu. The enabled state of the item does not
change until you call this method again.
You may use this method to modify both permanent menu items and those added
using the AppendContextMenu method. To set the default enabled state of a
permanent menu item, you must modify the item’s entry in the Clarify User Interface
Editor.
SetContextMenuEnabled 295
ClearBasic Control Reference
Multiline Text Box control
method SetContextMenuVisible
You can call this method from a ContextMenuDisplaying event handler to adjust
the appearance of the items in the menu. The visible state of the item does not change
until you call this method again.
You may use this method to modify both permanent menu items and those added
using the AppendContextMenu method. To set the default visible state of a
permanent menu item, you must modify the item’s entry in the Clarify User Interface
Editor.
296 SetContextMenuVisible
ClearBasic Control Reference
Multiline Text Box control
property BackColor
Description The BackColor property allows you to set the background color of a control. You can
set this property directly for the control, or indirectly by setting the property on the
contextual object that is linked to the control.
Before using this property, you must establish a color scheme using either the
CreateColorScheme or SetColorScheme method.
IMPORTANT: Before you can set back or fore colors, you must first create a color scheme (see
CreateColorScheme) that maps available system colors to labels. Then you must use
SetColorScheme to assign that color-to-label mapping to the form where you want to
perform the coloring. The reason for this is that you must specify the label, not the system
color, when you set BackColor or ForeColor.
If you perform color operations on controls that do not support color, no errors are
generated; the controls simply won’t be colored. This may be useful information if
you want to use multiplatform color operations where color may not be universally
supported for a given control type. For example, the Command Button may be
colored in UNIX, but not on the Macintosh.
Setting Description
ColorLabel You must specify a label that is mapped to a valid system color. The label
must be in the color scheme that is currently in effect for the form in
which you are performing color operations. (See CreateColorScheme
and SetColorScheme.)
Example The following code illustrates how you use color in ClearBasic. (You are not required
to set color in the form load event procedure.)
Before you set the color properties, you must create a color scheme and set it into
effect, as shown in the example. Only then can you color the object you want to color.
In this example, the foreground of the label and the multiline text box are assigned the
same color: red; the background color for the multiline text box is set to cyan.
Sub Initialize_App
Dim LabelList1 As New List
Dim ColorList1 As New List
LabelList1.AppendItem "Urgent", _
"Important", "Weak"
ColorList1.AppendItem "red", _
BackColor 297
ClearBasic Control Reference
Multiline Text Box control
"cyan", "blue"
App.CreateColorScheme "Form2020", _
LabelList1,ColorList1
End Sub
Sub Form_Load
App.SetColorScheme "Form2020"
TextBox1_Label.ForeColor = "Urgent"
TextBox1.ForeColor = "Urgent"
TextBox1.BackColor = "Important"
End Sub
See Also CreateColorScheme method (App object in the ClearBasic Object Reference)
SetColorScheme method (App object in the ClearBasic Object Reference)
298 BackColor
ClearBasic Control Reference
Multiline Text Box control
property ForeColor
Description The ForeColor property allows you to set the color of the control label text. You can
set this property directly for the control, or indirectly by setting the property on the
contextual object that is linked to the control.
Before using this property, you must establish a color scheme using either the
CreateColorScheme or SetColorScheme method.
IMPORTANT: Before you can set back or fore colors, you must first create a color scheme (see
CreateColorScheme) that maps available system colors to labels. Then you must use
SetColorScheme to assign that color-to-label mapping to the form where you want to
perform the coloring. The reason for this is that you must specify the label, not the system
color, when you set BackColor or ForeColor.
If you perform color operations on controls that do not support color, no errors are
generated; the controls simply won’t be colored. This may be useful information if
you want to use multiplatform color operations where color may not be universally
supported for a given control type. For example, the Command Button may be
colored in UNIX, but not on the Macintosh.
Setting Description
ColorLabel You must specify a label that is mapped to a valid system color. The label
must be in the color scheme that is currently in effect for the form in
which you are performing color operations. (See CreateColorScheme
and SetColorScheme.)
Example The following code illustrates how you use color in ClearBasic. (You are not required
to set color in the form load event procedure.)
Before you set the color properties, you must create a color scheme and set it into
effect, as shown in the example. Only then can you color the object you want to color.
In this example, the foreground of the label and the multiline text box are assigned the
same color: red; the background color for the multiline text box is set to cyan.
Sub Initialize_App
Dim LabelList1 As New List
Dim ColorList1 As New List
ForeColor 299
ClearBasic Control Reference
Multiline Text Box control
End Sub
Sub Form_Load
App.SetColorScheme "Form2020"
TextBox1_Label.ForeColor = "Urgent"
TextBox1.ForeColor = "Urgent"
TextBox1.BackColor = "Important"
End Sub
See Also CreateColorScheme method (App object in the ClearBasic Object Reference)
SetColorScheme method (App object in the ClearBasic Object Reference)
300 ForeColor
ClearBasic Control Reference
Multiline Text Box control
property MaxLength
Description The MaxLength property contains a long integer indicating the maximum number of
bytes that may be displayed by the control. The value of this integer must be between
0 and 32000. (For UNIX-only implementations, this value may be between 0 and
64000.) This property is readable and writable.
You can use this property to obtain the initial design-time value specified in the User
Interface Editor. You may also change this value by assigning a new value to the
property. Any value you specify remains in effect until you change the property again
or until the current session ends.
MaxLength 301
ClearBasic Control Reference
Multiline Text Box control
property MultiLine
Description The MultiLine property contains a boolean indicating whether the control is a
multiline control. For multiline text boxes, this property always contains the value
True.
302 MultiLine
ClearBasic Control Reference
Multiline Text Box control
property Parent
Description The Parent property contains the form object that owns the control. You can use this
property in to retrieve a reference to the form object containing the control.
Parent 303
ClearBasic Control Reference
Multiline Text Box control
property Required
Description The Required property contains a boolean value indicating whether or not the user
must enter a value in the text box before dismissing the form. This property contains
the value True if the control is required, otherwise False.
This property is read-only. You must set this property at design time using the User
Interface Editor.
304 Required
ClearBasic Control Reference
Multiline Text Box control
property RequiredColor
Description The RequiredColor property contains a color label indicating the background color
of a required textbox. Before setting this property, you must use
CreateColorScheme and SetColorScheme to create and set a color scheme for
the form in which the textbox is located.
This property is readable and writable. This property only applies to multiline text
box controls whose Required property is set to True. If the Required property is not
set to True, this property is ignored.
RequiredColor 305
ClearBasic Control Reference
Multiline Text Box control
property SelLength
Description The SelLength property contains a long integer value indicating the number of
characters in the current selection. This property is readable and writable.
Changing the value in this property changes the length of the current selection. You
can use this property in combination with the SelStart property to select text in the
control. When selecting text that spans multiple lines, newline characters count as 1
character.
306 SelLength
ClearBasic Control Reference
Multiline Text Box control
property SelStart
Description The SelStart property contains a long integer value indicating the location of the
current insertion point. Text typed by the user or entered programmatically is entered
before the character at the specified index. Indexes are 1 based, that is, the first
character is at index 1, the second at index 2, and so on.
If the SelLength property contains a value greater than 0, this property indicates the
beginning of a text selection. You can use this property in combination with
SelLength to select text in the control.
SelStart 307
ClearBasic Control Reference
Multiline Text Box control
property SelText
Description The SelText property contains a string with the text of the current selection. Getting
this property returns the selected text, setting it replaces the selected text with the
string you specify.
If no text is selected, this property contains an empty string (""). To determine if any
text is selected, check the SelLength property for a non-zero value.
308 SelText
ClearBasic Control Reference
Multiline Text Box control
property Tag
Description The Tag property contains a custom string that you assign at runtime. You can use
this string to identify the control internally to your application. You can also use this
property to store extra information about the control.
Tag 309
ClearBasic Control Reference
Multiline Text Box control
property Text
Description The Text property contains the complete text displayed by the multiline text box
control. The text in this property is stored in the destination contextual object linked to
the control.
This property is readable and writable. Setting this property replaces the text
currently in the control with the new string you specify. It also updates the contents of
the destination contextual object.
NOTE: This property behaves the same way as the Value property of the multiline text box
control.
310 Text
ClearBasic Control Reference
Multiline Text Box control
property Value
Description The Value property contains the complete text displayed by the multiline text box
control. The text in this property is stored in the destination contextual object linked to
the control.
This property is readable and writable. Setting this property replaces the text
currently in the control with the new string you specify. It also updates the contents of
the destination contextual object.
Value 311
ClearBasic Control Reference
Multiline Text Box control
event Click
Description The Click event handler for your multiline text box is called when the user presses
and releases the mouse button over the control. A Click event usually indicates the
positioning of the insertion point or the selection of text. You can use this event in
combination with the SelStart and SelLength properties to determine the new
selection.
312 Click
ClearBasic Control Reference
Multiline Text Box control
event ContextMenuDisplaying
Description The ContextMenuDisplaying event notifies your control that its context-sensitive
menu is about to be displayed. Use this event to update the appearance of the menu
and its items. You can enable or disable items, set the visibility of items, or add items
to the menu as appropriate.
The control sends this event in response to a user request to display the context-
sensitive menu. The event is sent before the menu is displayed.
ContextMenuDisplaying 313
ClearBasic Control Reference
Multiline Text Box control
event ContextMenu_Select
Description The ContextMenu_Select event notifies your application that the user chose an
item from the control’s context-sensitive menu. In your event handler, perform the
task associated with the menu item.
You must provide an event handler for each menu item you define in the context-
sensitive menu. You can define menu items at design time using the Clarify User
Interface Editor or at runtime using the AppendContextMenu method.
314 ContextMenu_Select
ClearBasic Control Reference
Multiline Text Box control
event KeyPress
Description The KeyPress event occurs when the user presses an ASCII key or an extended
ASCII key in the control (when the control has the focus). Event handlers for this
event can perform tasks such as checking for valid characters.
The parameter YourKey returns the ASCII keycode for the key that was pressed. To
convert the parameter YourKey from ASCII into a character, use the function Chr:
Char = Chr (YourKey)
Example The following code is part of an event procedure for a textbox that handles the
keypress for a plus "+" key event.
Sub SUB_BILLEXP_MOD_KeyPress(KeyAscii As Integer)
Dim increment As Boolean
increment = False
KeyPress 315
ClearBasic Control Reference
Multiline Text Box control
316 KeyPress
ClearBasic Control Reference
Option Button control
Description The option button control implements a two-state button that you use in groups to
represent a set of mutually exclusive choices. Within a group of option buttons, only
one button at a time may be selected. The other buttons are automatically deselected.
You can use the option button control to obtain information about the state of an
option button on a form. The Value property contains an integer indicating the
current state of the control. You can read the value in this property to get the current
state or assign a new value to change the state of the control. Changing the state of an
option button affects the other option buttons in the group.
You can also use this control to change some of the option button settings. For
example, you can enable the control or change its visibility on the form. You can also
change the caption text associated with the control.
Referring to Option You cannot create control objects directly using ClearBasic code. You must associate
Button Controls controls with a form, frame, or tab using the User Interface Editor. When the form,
frame, or tab is subsequently displayed, the corresponding control object is created
automatically.
If you need to refer to a control object explicitly, such as when passing a control object
as a method parameter, use a variable of type Control to refer to the control object.
For example, you would use the following code to obtain a reference to the option
button control called YourOptionBtnControl:
Dim YourControl As Control
Set YourControl = YourOptionBtnControl
Source At design time, you have the option of linking a source contextual object to this
control. This contextual object must contain a string data type. When a form
containing the option button is displayed, the control obtains the option button label
from this contextual object. If you do not assign a source contextual object, the control
uses the label assigned to it at design time.
Using a source contextual object is advantageous in situations where you may want
the label of the option button control to change dynamically. For example, you could
assign a contextual object whose contents contained the value in a particular database
field. As the value in that field change, so does the control label.
NOTE: Whether you use a source contextual object or a fixed text label, you can always change
the control label programmatically by modifying the control’s Caption property.
Destination At design time, you must link a destination contextual object to the control to store the
value for that control. The destination contextual object must contain a String value.
When the option button is selected, it stores the name of the selected option in this
contextual object.
Methods This object supports the following methods. Methods marked with a [C] are
documented with the Control object.
■ Refresh method[C]
■ SetFocus method [C]
Properties This object supports the following properties. Properties marked with [C] are
documented with the Control object.
■ Caption property
■ ControlType property [C]
■ DataChanged property
■ Enabled property [C]
■ Height property [C]
■ hWnd property [C]
■ Id property [C]
■ Left property [C]
■ Name property [C]
■ Parent property
■ Tag property
■ Top property [C]
■ Value property
■ Visible property [C]
■ Width property [C]
Events The following event is supported for this events. Events marked with a [C] are
documented with the Control object.
■ Click event
■ GotFocus event [C]
■ LostFocus event [C]
318
ClearBasic Control Reference
Option Button control
property Caption
Description The Caption property contains a string with the label currently displayed by the
option button control. You assign the initial value for this property at design time by
modifying the values on the control’s property sheet. If the control uses a source
contextual object, the initial value for this property is obtained from that object.
You can change the control’s label at runtime by assigning a new string value to this
property. If you plan to change the control’s label at runtime, set the AutoSize
property of the control to Yes in the User Interface Editor. The AutoSize property
expands the control size to accommodate the new label.
If the control uses a source contextual object for the label, getting this property returns
the value in the contextual object. Assigning a value to this property changes the
value in the source contextual object. If the source contextual object is linked to a
database field, the value in that field is also updated to reflect the changes.
IMPORTANT: On some platforms, your caption changes may not persist when you display or
redisplay the form. If this happens, modify the corresponding Form_Load event procedure
and have it set the caption for the control explicitly.
Caption 319
ClearBasic Control Reference
Option Button control
property DataChanged
Description The DataChanged property contains a boolean value indicating whether the user
modified the contents of this control. This value only indicates whether modifications
were made by the user; it does not reflect changes made to the control by your
ClearBasic code.
If you modify the control programmatically, you can set this property to reflect your
changes. Set this property to True to indicate you made modifications; otherwise, set it
to False to indicate the control is unchanged.
320 DataChanged
ClearBasic Control Reference
Option Button control
property Parent
Description The Parent property returns the form that contains the control. This property is read-
only.
Parent 321
ClearBasic Control Reference
Option Button control
property Tag
Description The Tag property contains a custom string that you can assign at runtime. You can
use this string to identify the object internally in your application. You can also use
this property to store extra information about the object.
322 Tag
ClearBasic Control Reference
Option Button control
property Value
Description The Value property contains a long integer indicating the current state of the option
button control. This value corresponds to the option button state seen by the user. The
value in this property is 1 if the control is selected, otherwise 0.
NOTE: The value in this property may not coincide with the value currently in the control’s
destination contextual object. You can call the control’s Refresh method to synchronize the
two values.
You can assign a new value to this property to change the current state of the control.
Setting this property to 1 selects this option button and deselects the other option
buttons in the group. Setting this property to 0 deselects this option button (if it was
selected) and selects the next option button in the group. Changing the value in this
property also changes the value in the associated destination contextual object.
Value 323
ClearBasic Control Reference
Option Button control
event Click
Description The Click event occurs when the user presses and releases the mouse button with
the cursor on or in the control. You can use this event to respond to user interactions
with the control.
324 Click
ClearBasic Control Reference
ProgressBar control
Description A progress bar control displays the progress of a lengthy operation. The control
consists of an empty rectangular area that is gradually filled during the course of the
operation. At any given time, the amount of the rectangle that is currently filled
represents the percentage of the operation that is complete.
Your application is responsible for defining the duration of the current operation and
for setting the progress of that operation. The Min and Max properties contain integer
values that define the start and end points of the operation. The current progress is
measured using the Value property of the control. At runtime, the control uses these
three properties to calculate the percentage of the operation that is complete.
At runtime, you must update the Value property to reflect the current progress of the
operation. If you associate the progress bar control with a contextual object, the
control automatically retrieves the value for this property from that object. However,
you can also modify the Value property programmatically as needed.
Referring to You cannot create control objects directly using ClearBasic code. You must associate
Progress Bar controls with a form, frame, or tab using the User Interface Editor. When the form,
Controls frame, or tab is subsequently displayed, the corresponding control object is created
automatically.
If you need to refer to a control object explicitly, such as when passing a control object
as a method parameter, use a variable of type Control to refer to the control object.
For example, you would use the following code to obtain a reference to the progress
bar control called YourProgressControl:
Dim YourControl As Control
Set YourControl = YourProgressControl
Properties This object supports the following properties. Properties marked with [C] are
documented with the Control object.
■ Height property [C]
■ Id property [C]
■ Left property [C]
■ Max property
■ Min property
■ Name property [C]
■ Top property [C]
■ Value property
■ Visible property [C]
■ Width property [C]
326
ClearBasic Control Reference
ProgressBar control
property Max
Description The Max property contains an integer value representing the end of the operation.
This property is used in conjunction with the Min property to define the duration of
the operation.
This property is readable and writable. The value in this property must be greater
than the value in the Min property. By default, this property contains the value 100.
When the value in the Value property matches this value, the operation is complete.
Max 327
ClearBasic Control Reference
ProgressBar control
property Min
Description The Min property contains an integer value representing the beginning of the
operation. This property is used in conjunction with the Max property to define the
duration of the operation.
This property is readable and writable. The value in this property must be less than
the value in the Max property. By default, this property contains the value 0.
The progress bar control assigns the value in this property to the Value property at
the beginning of the operation.
328 Min
ClearBasic Control Reference
ProgressBar control
property Value
Description The Value property contains an integer value representing the current progress of the
operation. The value in this property must lie within the range specified by the Min
and Max properties.
The progress bar control uses the value in this property to determine how much of the
display rectangle to fill. When the control is initialized, this property is assigned the
value in the Min property.
This property is readable and writable. At runtime, if the control is associated with a
contextual object, the control retrieves updated values for this property from the
contextual object.
Value 329
ClearBasic Control Reference
ProgressBar control
330 Value
ClearBasic Control Reference
Select CBX control
Description The Select CBX control extends the functionality of your ClearBasic forms by
providing integrated querying capabilities. A Select CBX control is a special type of
control that coordinates the interactions among the contextual objects, database
records, and other controls on the form. Using a Select CBX control, you do not have
to write any ClearBasic code to query the database.
The Select CBX control coordinates the behavior of its constituent controls and uses
them to gather query parameters from the user and to display the query results. The
Select CBX control provides basic functionality to search the database using the
information provided by the user. You can customize the Select CBX and its associated
controls to modify this behavior as needed for your application.
User Interface You add a Select CBX control to a parent or child form just as you would add any
other control. As with other controls, you can access the methods and properties of
the Select CBX control from the form’s ClearBasic routines.
At runtime, the Select CBX control does not display a visible interface in the form
window. Instead, it coordinates the interactions among its associated visible controls.
Figure 5: shows a form containing the controls needed by the Select CBX control.
You create these four controls using the User Interface Editor just as you would create
any other form controls. You may place the controls on the same form as the Select
CBX control, or you may place them on a child form or tab. However, you may not
place these controls on a parent form of the Select CBX control.
NOTE: For detailed information about how to create and set up Select CBX controls, refer to
the User Interface Editor Guide.
Driving Object When the Select CBX control performs a query, it limits the scope of its search to
Types records belonging to the driving object type of the control. You specify the driving
object type on the property sheet of the Select CBX control when you create it in the
User Interface Editor.
The Select CBX control also has a property for the display object type. This property
specifies the record or view type displayed by the Select List grid. If you specify a
view type for this property, the unique field of the view must be the objid field of the
driving object type. If you specify a record type, you must specify the driving object
type.
332
ClearBasic Control Reference
Select CBX control
Filters The Select CBX control uses filters to define search criteria. A filter compares the value
in one field of a record to a fixed value. The user creates filters using the Filter Set
window and selects them using the Filter Select list. Selecting a filter copies the filter’s
search criteria to the adhoc row of the grid. If the adhoc row is displayed, the user can
modify the information before running the filter. Clicking the Find button runs the
query and returns the resulting records to the Select List grid.
Before users can create their own filters, you must configure the Select CBX control
with the fields you want to make available for filtering. Every filter is made up of
three elements:
■ a path
■ a value
■ a comparison operator
The path specifies the location of the desired field in the database. You must specify
the fields you want available for user filters and you must specify the location of those
fields using paths. By default, paths always start at the database table specified by the
driving object type of the Select CBX control. To create a path to a field in the driving
object type, specify only the field name. To build a path to fields in other tables, use
database relations.
To build a path using database relations, you must start with the relations of the
driving object type. You can then navigate from table to table until you reach the table
with the desired field. Each relation must be followed by a colon and a field must be
the last element on the end of the path. For example, you can build a path from the
case table to the city field of the address table using the path
“case2address:city”.
The comparison operator specifies how a field is compared to the specified value.
Filters support a variety of complex comparison operators, which are listed in Table 7.
Table 7 Supported filter operators
Operator Description
"greater than" The field contains a numeric value greater than the value.
"greater than or equal to" The field contains an numeric value greater than or equal to the
value.
"less than" The field contains an numeric value less than the value.
"less than or equal to" The field contains an numeric value less than or equal to the
value.
“is equal to” The field must match the value exactly.
"is not equal to" The field does not match the value.
“starts with” The field must begin with the specified value.
“ends with” The field must end with the specified value.
“contains” The field contains the specified value. The field may
additionally start with or end with the specified value.
“is in” The field is in the specified range of values.
"between" The field contains an integer or date that is between the
specified values.
“does not start with” The field does not start with the specified value.
“does not end with” The field does not end with the specified value.
“does not contain” The field does not contain the specified value.
333
ClearBasic Control Reference
Select CBX control
Operator Description
"not between" The field contains an integer or date that is not between the
specified values.
“is not in” The field is not in the specified range of values.
"sounds like" The field text is included in the specified value.
"exists" The field contains a value.
"does not exist" The field does not contain a value.
"today" The field specifies today’s date.
"yesterday" The field specifies yesterday’s date.
"within last (days)" The field specifies a date within the number of days specified
by value.
"within last (hours)" The field specifies a time within the number of hours specified
by value.
If the field matches the specified value using the comparison operator, the Select CBX
control displays the record in the Select List grid.
Adhoc Filtering In addition to the Filter Set window, the user may also specify search criteria using a
technique called adhoc filtering. With adhoc filtering, the user enters search
information into a special row—called the adhoc row—of the Select List grid. The user
may specify search criteria for any of the fields displayed by the grid. When the user
clicks the Find button (or presses the Enter key), the Select CBX control uses the
specified information to perform the search.
If the user selects a filter from the Filter Select list, the adhoc row displays the search
values for the currently-selected filter. The user may use the specified values or type
in new values before clicking the Find button. Because users can type data values
directly into the adhoc row of the Select List grid, adhoc filtering is more convenient
than modifying filters using the Filter Set window. However, the values entered by
the user in the adhoc row are not saved permanently to the database.
Prefilters In addition to user-defined filters, you may define additional filters programmatically.
The filters you define are called prefilters and are applied before any user filters. As a
result, the user filters see only the records allowed through by your prefilters. You can
use prefilters to limit the scope of a query and prevent the user from accessing
particular records.
Sorting The Filter Set window contains an additional tab that allows the user to specify the
sort criteria for records in the Select List grid. The user chooses one or more fields to
use when sorting the records and chooses whether records should be sorted in
ascending or descending order.
334
ClearBasic Control Reference
Select CBX control
If the user does not specify a sort criteria, your application may supply a default sort
criteria. To specify a default sort criteria, you must call the AppendDefaultSort
method of the Select CBX control before the query is initiated. You may call
AppendDefaultSort multiple times to specify more than one sort criteria. The
Select CBX control applies sort criteria in the order they are added. To remove a sort
criteria, call the ResetDefaultSort method.
Paging When the Select CBX control performs a query, it does not always load the entire
results of the query into memory. If a query returns a large number of records, the
control uses paging to load a subset of the records into the Select List grid’s contextual
object. The remaining records are loaded into memory as needed.
The Select CBX control keeps two pages of records in memory at any given time. By
default, each page contains 50 records. To change this setting, modify the PAGE_SIZE
variable in the clarify.env file of your client applications.
Paging is normally transparent to the user. However, there are some situations where
methods may not behave as expected. The following is a list of these behaviors and
the situations in which you might encounter them.
■ Record indexes are always relative to the beginning of the currently loaded
pages.
■ A selection containing more than one record cannot extend over page
boundaries.
■ The contents of the select-list grid can only be sorted by performing a new
query.
Support for Multiple For most operations, the Select CBX control only needs to refer to records from one
Contextual Objects database table. However, the Select CBX provides support for changing the current
database table at runtime. A Select CBX control that supports the switching of
contextual objects at runtime is called a multiCBX control.
To enable multiple contextual object support for the Select CBX control, you must set
the appropriate options on the control’s property sheet in the User Interface Editor.
When you enable multi-contextual object support, the Select CBX control retrieves
database type information from its current extended contextual object. When a form
containing your multiCBX control is posted, your Form_Load routine must set the
control’s initial extended contextual object using the SetCObj method. The GetCObj
method returns the name of the extended contextual object currently in use.
When you set the extended contextual object for a multiCBX control, the control
automatically loads the new information into memory and updates the contents of the
Select List grid and Filter-Select list. During the context switch, data in the previous
extended contextual object is cached for future use. When you switch to an extended
contextual object with cached data, the multiCBX control automatically displays the
cached data.
Select CBX and When you associate a Select CBX with a grid, the Select CBX takes over many aspects
Grids of the grid operation. In particular, the Select CBX coordinates the storage of the
records in the grid and the updates needed to display those records.
335
ClearBasic Control Reference
Select CBX control
The Select CBX control defines several methods for retrieving grid information. If you
need to retrieve or set some grid data, call the appropriate Select CBX method instead
of the corresponding grid method whenever possible. Calling the Select CBX method
ensures that any Select CBX state information is updated appropriately.
Referring to the When you want to refer to a Select CBX control in ClearBasic code, you must use the
Select CBX Control control’s instance name, prepended with the string “Cbx_”. Notice that this name is
in Your Code not the same as the control name you assign on the Select CBX property sheet. The
control name and instance name are separate entries. For example, to call the
Regenerate method of a Select CBX control whose control name is “MyCBX” and
whose instance name is “SelectTerritory”, you would use the following code:
Cbx_SelectTerritory.Regenerate
336
ClearBasic Control Reference
Select CBX control
337
ClearBasic Control Reference
Select CBX control
■ SetSelectedById method
■ UnSelect method
■ UpdateItem method
338
ClearBasic Control Reference
Select CBX control
method AppendAdhocFilter
Description The AppendAdhocFilter method assigns a filter value to the adhoc row. This
method adds the specified filter criteria to the adhoc row of the Select List grid. If the
specified field is not displayed in the grid, the filter condition is added but is not
visible to the user.
IMPORTANT: If the Select CBX control is a multiCBX, you must use this method in place of
the SetAdhocCellText method when adding filters to the control.
See Filters on page 333 for information on specifying paths and operators.
AppendAdhocFilter 339
ClearBasic Control Reference
Select CBX control
method AppendDefaultSort
Description The AppendDefaultSort method adds the specified criteria to the default sort
criteria of the Select CBX control. If the user initiates a query using a filter that does
not contain any sort criteria, the Select CBX control applies the default sort criteria.
You may call this method multiple times to specify a sort order based on multiple
columns of the Select List grid. With each invocation, this method adds the specified
criteria to the end of the default sort criteria list. The criteria in this list are applied in
the order they were added to the list.
Example The following code snippet adds two sort criteria to the default sort order. When this
default order is applied, the Select CBX control sorts entries by “Site Name” and then
by “Bin Name.”
Cbx_SelectInvCnt.AppendDefaultSort "Sort1", _
"Site Name", "Ascending"
Cbx_SelectInvCnt.AppendDefaultSort "Sort2", _
"Bin Name", "Descending"
340 AppendDefaultSort
ClearBasic Control Reference
Select CBX control
method AppendItem
Description The AppendItem method adds one or more records to the end of the Select List grid.
This method does not save the specified records to the database; you must do that in
your ClearBasic code. The type of the records you specify must be the same as the
driving object type of the Select CBX control.
You can use this method to add existing database records or newly created records to
the list. Because the Select List grid displays records temporarily, you must save
newly created records to the database if you want to retain their data. If you use an
editable grid control for the Select List grid, you must similarly save changes to
existing records using the grid control interface.
This method adds the new items to the last page of the Select List grid’s result set. If
the page containing the new items is not currently displayed, the control scrolls that
page into view. If you are adding new items, call the SaveAnyChanges method of the
Select List grid to save the new items to the database.
Example The following example shows the Click routine associated with a command button.
This routine retrieves several records from the database and then uses the
AppendItem method to add them to the Select CBX control whose instance name is
“SelectTerritory.”
AppendItem 341
ClearBasic Control Reference
Select CBX control
The first set of calls retrieve the records from the database. The second set of calls gets
the returned list of records and adds them to the Select List grid. Because the grid is
associated with a Select CBX control, the records must be added through the Select
CBX.
Sub btn_AppendItem_Click
’Set up required variables
Dim recList As List
Dim myBulk As New BulkRetrieve
342 AppendItem
ClearBasic Control Reference
Select CBX control
method AppendPreFilter
Description The AppendPreFilter method adds a prefilter to the Select CBX control. Prefilters
limit the set of records passed to user-defined filters. You can use this method to
prevent the retrieval of any irrelevant or unwanted records. The prefilters you add
with this method take effect the next time you run the query using the Regenerate
method.
You can call this method multiple times to specify multiple prefilters. Each call adds
the specified prefilter to the end of the Select CBX control’s current list of prefilters.
During a query, the prefilters are applied in order, with subsequent filters operating
on the records retrieved by earlier filters.
To remove a specific prefilter from the Select CBX control, call the ClearPreFilter
method. To remove all of the control’s prefilters, call the ResetPreFilter method
See Filters on page 333 for more information about paths and comparison operators.
AppendPreFilter 343
ClearBasic Control Reference
Select CBX control
Example The following subroutine demonstrates the use of the AppendPreFilter method. In
this example, the SetFilter button’s Click event handler adds several prefilters to the
form’s Select CBX object, called SelectTerritory. In particular, this example sets up the
following prefilters:.
■ nameFilter filters records based on a specific name (Terri)
■ regionFilter filters records based on a specific geographic region (Florida)
■ branchFilter filters records based on a specific branch office (Miami)
Sub btn_SetFilter_Click
' Set up and append a prefilter, which is
' ANDed with the filter selected in the
' current select window and any other
' prefilters specified for the same Select
' CBX object elsewhere in the form module.
344 AppendPreFilter
ClearBasic Control Reference
Select CBX control
method ClearAdhocRow
Syntax Cbx_InstanceName.ClearAdhocRow
Description The ClearAdhocRow method clears the contents of each cell in the adhoc row. You
can use this method to reset the adhoc row when the form is posted or when the user
wants to clear the current search parameters.
Parameters None.
ClearAdhocRow 345
ClearBasic Control Reference
Select CBX control
method ClearAll
Syntax Cbx_InstanceName.ClearAll
Description The ClearAll method clears the results of the last query and clears the items
displayed in the Select List grid. This method also resets the current record, as
assigned by the SetCurrent, GetNext, and GetPrevious methods.
After calling this method, you can call the Regenerate method to retrieve an
updated set of records. This method does not trigger any events.
Parameters None.
346 ClearAll
ClearBasic Control Reference
Select CBX control
method ClearPreFilter
Description The ClearPreFilter method removes one or more prefilters from the Select CBX
control. You may use this method to remove only the prefilters you added with the
AppendPreFilter method; you cannot use this method to remove any user-defined
filters.
If you specify values for both the FilterName and Path parameters, the values must
refer to the same prefilter. If you specify an empty string for the Path parameter, this
method removes all prefilters whose name matches the value in the FilterName
parameter. If you specify an empty string for the FilterName parameter, this method
removes all prefilters whose path relation matches the value in the Path parameter. If
you specify empty strings for both parameters, this method does nothing.
NOTE: Removing a prefilter does not alter the currently displayed list of records. You must
call the Regenerate method to update the list of records.
Example The following example illustrates the use of the btn_ClearPreFilter method. In
this example, when the user clicks the btn_ClearPreFilter button, the subroutine
removes all prefilters named “nameFilter” and removes all filters whose path relation
is “name”.
Sub btn_ClearPreFilter_Click
' Clear the prefilter named "nameFilter"
' associated with the Select CBX instance
' SelectTerritory
Cbx_SelectTerritory.ClearPreFilter _
"nameFilter",""
ClearPreFilter 347
ClearBasic Control Reference
Select CBX control
348 ClearPreFilter
ClearBasic Control Reference
Select CBX control
method EnableAdhoc
Description The EnableAdhoc method enables or disables the availability of the adhoc row in the
Select List grid. You also use this method to set the visibility of the adhoc row. The
adhoc row lets the user enter query values for each field in the grid using the grid
interface. When enabled and visible, the adhoc row is the first row in the grid.
When you enable the adhoc row, the grid makes the row available to the user. The
user may show the row or hide the row at runtime using the grid interface. You can
also use this method to show or hide the row by specifying a value for the Show
parameter.
If you disable the adhoc row, the grid makes the adhoc row inaccessible to the user.
The user cannot toggle the display of the row in any way. You must enable the row
using this method to make the row available again.
When the user selects a filter from the Filter Select list, the Select CBX control displays
the filter information in the adhoc row. If the adhoc row is disabled, the information is
applied to queries but is not visible to the user.
EnableAdhoc 349
ClearBasic Control Reference
Select CBX control
method GenerateSQL
Description The GenerateSQL method generates an SQL string and returns it in a record of type
query. You can execute the returned SQL string by calling the Execute method of the
SQLDB object.
The returned SQL string incorporates the information indicated by the Options
parameter. You can use this parameter to specify which filters to include in the SQL
string. When gathering user-defined filter information, this method uses only those
filters created in the Filter Set window. This method does not use information entered
into the adhoc row by the user.
Return Values Returns a Record object representing the query table. The sql_statement field of
this record contains the SQL string for the query.
350 GenerateSQL
ClearBasic Control Reference
Select CBX control
method GetAdhocRow
Description The GetAdhocRow method returns the query information entered by the user into the
cells of the adhoc row. For each non-empty cell, this method returns the name of the
corresponding field and the value in the cell.
The items in the FieldNameList and DataList parameters are ordered in parallel. That
is, for each field name in the FieldNameList parameter, the corresponding cell data is
at the same index in the DataList parameter. For example, the data at index 0 in the
DataList parameter belongs to the cell whose field name is at index 0 in the
FieldNameList parameter.
Return Values Returns True if the data was retrieved successfully, otherwise False.
GetAdhocRow 351
ClearBasic Control Reference
Select CBX control
method GetChangedCell
Description The GetChangedCell method returns information about the most recently changed
cell in the adhoc row. Call this method only from an AdhocCellChanged event
handler.
This method returns the field name of the cell that changed and returns the new value
of the cell. You can use this information to validate the contents of the cell. For
example, you could check to see if the specified value lies within a valid range of
values.
Return Values Returns True if the data was retrieved successfully, otherwise False.
352 GetChangedCell
ClearBasic Control Reference
Select CBX control
method GetCObj
Description The GetCObj method returns the name of the contextual object currently associated
with the Select CBX control. You can pass this string to other methods to obtain
additional information about the properties and methods of the contextual object.
This method applies only to Select CBX controls that support multiple contextual
objects. For information on creating Select CBX controls that support multiple
contextual objects, see the User Interface Editor Guide.
Parameters None
Return Values Returns a String containing the name of the ContextualObject currently associated
with the Select CBX control. The returned string does not include the "Cobj_" prefix
normally added when referring to the contextual object in code.
GetCObj 353
ClearBasic Control Reference
Select CBX control
method GetCount
Description The GetCount method returns the number of rows returned by the most recent
query. For Select CBX controls that support only one contextual object, this method
returns the number of rows in the Select List grid’s source contextual object. For
multiCBX controls, this method returns the number of rows in the specified
contextual object. If you do not specify a contextual object name, this method returns
the number of rows in the current contextual object.
Due to paging restrictions, the value returned by this method may be less than the
total number of rows that match the query search criteria.
Return Values Returns a Long integer indicating the number of rows in the specified contextual
object.
354 GetCount
ClearBasic Control Reference
Select CBX control
method GetList
Description The GetList method returns the list of records currently in the source contextual
object of the associated Select List grid. For Select CBX controls, these records
correspond to the most recent set of records retrieved by the user using the query
mechanisms of the Select CBX control. For multiCBX controls, these records
correspond to the records in the specified contextual object.
This method supports Select CBX controls with multiple contextual objects. If you
specify a value for the CObjName parameter, this method returns the records in the
specified contextual object. If you omit the CObjName parameter, this method returns
the records for the current contextual object.
Because of paging restrictions, this method returns only the records currently in
memory. For large result sets, this list may contain only a portion of the total records.
For more information about paging, see Paging on page 335.
GetList 355
ClearBasic Control Reference
Select CBX control
method GetNext
Description The GetNext method increments the position of the current record by one. On return,
this method returns information about the new current record in the specified
parameters. If the current record is set to the last record in the Select List grid, this
method wraps around and makes the first record the current record.
Normally, you call the SetCurrent method to set the current record before calling
this method. If you do not call SetCurrent, the current record is set to the first
record in the Select List grid by default.
Return Values Returns the Record object representing the new current record.
356 GetNext
ClearBasic Control Reference
Select CBX control
Example The following example implements a Click event handler that displays information
about the record immediately after the selected record. This method uses the
SetCurrent and GetNext methods to get the record immediately after the selected
record.
Sub btn_SetCurRec_Click
'Set up required variables
Dim nextRecord As New Record
Dim selRecord as New Record
Dim recIndex As Long
Dim recObjId As Long
Dim recTotal As Long
Dim myResult As Boolean
GetNext 357
ClearBasic Control Reference
Select CBX control
method GetObjIds
Description The GetObjIds method returns the list of object IDs from the specified result set.
Each result set contains a list of object IDs returned by the most recent query. For
Select CBX controls that support only one contextual object, this method always
returns the object IDs from the current result set.
If the Select CBX control supports multiple contextual objects, the control maintains
separate result sets for each associated contextual object. You can request object IDs
from a different result set by specifying the name of the corresponding contextual
object in the CObjName parameter. If you do not specify the name of a contextual
object, this method returns the object IDs from the current contextual object’s result
set.
This method is not affected by paging. The list returned by this method contains the
object IDs for every record in the retrieved result set, including those records on pages
not in memory.
Return Values Returns a List object containing zero or more long integers. Each long integer
contains the value in the objid field of a record in the specified contextual object.
358 GetObjIds
ClearBasic Control Reference
Select CBX control
method GetPageSize
Description The GetPageSize method returns the maximum number of records possible on a
single page. The Select CBX control uses paging to improve the performance of the
grid. See Paging on page 335 for more information.
The value returned by this method corresponds to the value assigned to the
PAGE_SIZE variable in the user’s clarify.env file. The default page size value is
50.
Parameters None
Return Values Returns a long integer indicating the maximum number of records possible on a
single page.
GetPageSize 359
ClearBasic Control Reference
Select CBX control
method GetPrevious
Description The GetPrevious method decrements the position of the current record by one. On
return, this method returns information about the new current record in the specified
parameters. If the current record is set to the first record in the Select List grid, this
method wraps around and makes the last record the current record.
Normally, you call the SetCurrent method to set the current record before calling
this method. If you do not call SetCurrent, the current record is set to the first
record in the Select List grid by default.
Return Values Returns the Record object representing the new current record.
360 GetPrevious
ClearBasic Control Reference
Select CBX control
Example The following example displays information about the record immediately before the
selected record. This method uses the SetCurrent and GetPrevious methods to
get the record immediately after the selected record.
Sub btn_SetCurRec_Click
'Set up required variables
Dim prevRecord As New Record
Dim selRecord as New Record
Dim recIndex As Long
Dim recObjId As Long
Dim recTotal As Long
Dim myResult As Boolean
GetPrevious 361
ClearBasic Control Reference
Select CBX control
method GetSelCount
Description The GetSelCount method returns the number of selected rows in the specified
contextual object. For Select CBX controls that support only one contextual object, this
method returns the number of rows in the Select List grid’s source contextual object.
For multiCBX controls, this method returns the number of selected rows in the
specified contextual object. If no contextual object is specified, this method uses the
current contextual object.
Return Values Returns a Long integer indicating the number of selected rows in the specified
contextual object.
362 GetSelCount
ClearBasic Control Reference
Select CBX control
method GetSelected
Description The GetSelected method returns the currently selected record from the Select List
grid. If more than one record is selected, this method returns only the first record in
the selection.
This method supports Select CBX controls with multiple contextual objects. If you
specify a value for the CObjName parameter, this method returns the selected records
in the specified contextual object. If you omit the CObjName parameter, this method
returns the selected records for the current contextual object.
Call this method only if the Select List grid supports the selection of one record at a
time. If the grid supports the selection of multiple records, use the SelectedList
method to retrieve the current selection.
Example The following code snippet illustrates the use of the GetSelected method:
Dim myRecord As New Record
Dim myResult As Boolean
GetSelected 363
ClearBasic Control Reference
Select CBX control
364 GetSelected
ClearBasic Control Reference
Select CBX control
method InsertItem
Description The InsertItem method inserts one or more records into the Select List grid. This
method adds the specified records to the grid’s current list of items but does not add
the records to the database. The type of the records you specify must be the same as
the driving object type of the Select CBX control.
The ReferenceRecord and Position parameters let you specify the location at which to
insert the records. If you omit these parameters, this method inserts the records at the
top of the Select List grid.
You can use this method to insert existing database records or newly created records
into the Select List grid. Because the Select List grid displays records temporarily, you
must save newly created records to the database if you want to retain their data.
After it inserts the records, this method refreshes the list displayed by the Select List
grid. This method does not generate any events.
InsertItem 365
ClearBasic Control Reference
Select CBX control
Example The following example demonstrates the Click event handler for a button. When the
user clicks the button, this method retrieves some “territory” records and attempts to
insert them into the Select List grid. If a record is currently selected in the Select List
grid, this routine inserts the retrieved records before the selected record. If no record is
selected, this method inserts the retrieved records at the top of the list.
Sub btn_InsertRec_Click
'Set up required variables
Dim selRecord As New Record
Dim recList As New List
Dim myBulk As New BulkRetrieve
Dim selObjID As Long
366 InsertItem
ClearBasic Control Reference
Select CBX control
method OwnsGrid
Description The OwnsGrid method returns a boolean indicating whether the Select CBX owns the
associated grid. Use this method for Select CBX controls that support multiple
contextual objects. The Select CBX owns the grid when it has a valid contextual object
and is displaying that object’s data in the grid.
Call this method before manipulating the contents of the grid. If this method returns
True, you must manipulate the grid contents through the Select CBX control. If this
method returns False, you may call the methods of the grid control directly.
Parameters None
Return Values Returns True if the Select CBX control owns the associated grid, otherwise returns
False.
OwnsGrid 367
ClearBasic Control Reference
Select CBX control
method RefreshItem
Description The RefreshItem method refreshes one or more records in the select-list grid with
information from the database. If you make temporary changes to one or more
records in a grid without saving the changes, you can use this method to restore the
original contents of those records.
When you call this method, you may specify a object ID or a list of object IDs. If a
given object ID does not correspond to a known record in the grid, this method does
nothing for that object ID.
368 RefreshItem
ClearBasic Control Reference
Select CBX control
method Regenerate
Syntax Cbx_InstanceName.Regenerate
Description The Regenerate method uses the current filters and sort criteria to perform a new
query and refresh the contents of the Select List grid. Calling this method is equivalent
to the user clicking the Select CBX control’s Find button.
If the adhoc row is currently enabled, this method uses the information in that row to
perform the query. If the adhoc row is disabled, this method performs the query using
the currently selected filter.
CAUTION: This method does not save changes to the database before running the new query. If
the records in the Select List grid contain changes you want to retain, you must save those
records to the database before calling this method.
After performing the query, this method clears the current selection and resets the
current record to the first record in the list. (This method does not clear the contents of
the adhoc row.) To change the current record, use the SetCurrent, GetNext, and
GetPrevious methods. To set the current selection, use the SetSelected or
SetSelectedById method.
Parameters None
Example The following example demonstrates the Click event handler of a button. When the
user clicks the button, this event handler refreshes the Select List grid associated with
the Select CBX instance SelectOpportunity.
Sub btn_RefreshList_Click
Cbx_SelectOpportunity.Regenerate
End Sub
Regenerate 369
ClearBasic Control Reference
Select CBX control
method RejectAdhocCellEntry
Description The RejectAdhocCellEntry method lets you abort the changes to a cell in the
adhoc row before they are saved to the grid’s contextual object. Depending on the
value you specify for the DialogType parameter, you can abort the changes directly or
let the user decide whether or not to abort them.
This method operates only on the most recently changed cell in the adhoc row. You
must call this method only from an AdhocCellChanged event handler. If you
specified a dialog type of cbAbortDisplayOK or cbAbortDisplayYesNo, the
control waits for your event handler to exit before posting the dialog. As a result, you
should always call this method at the end of your event handler.
If you abort the changes directly, or if the user chooses to abort the changes, this
method restores the original value of the cell. Restoring the original value does not
generate a new AdhocCellChanged event.
Example The following example implements the AdhocCellChanged event handler of the
grid called SelectGrid. If the user tries to specify a negative value in the quantity field
of the grid, this method rejects the change and notifies the user that the quantity must
be a positive value.
Sub SelectGrid_AdhocCellChanged
dim rowNum as Integer
dim fieldName as String
dim fieldData as String
370 RejectAdhocCellEntry
ClearBasic Control Reference
Select CBX control
RejectAdhocCellEntry 371
ClearBasic Control Reference
Select CBX control
method RemoveItem
Description The RemoveItem method removes one or more records from the Select List grid and
updates the grid display. When calling this method, you must specify the object ID of
the records you want to remove. (You should not use this method to remove the
currently-selected records; use the RemoveSelected method instead.)
Calling this method does not delete the records from the database; it simply removes
them from the Select List grid. Running the same query again (by calling the
Regenerate method) reinstates the records in the Select List grid.
Example The following example removes the first ten records in the Select List grid. The
example implements a Click event handler for a button. When clicked, the button
obtains the object IDs of the records and calls RemoveItem. If there are fewer than 10
records in the Select List grid, this method removes as many records as exist in the
grid.
Sub btn_RemoveRecord_Click
'Set up required variables
Dim recObjIdList As New List
Dim recordList as List
Dim tempRec as New Record
Dim recObjId As Long
Dim numItems As Long
372 RemoveItem
ClearBasic Control Reference
Select CBX control
numItems = recordList.Count
recObjIdList.AppendItem recObjId
Next
RemoveItem 373
ClearBasic Control Reference
Select CBX control
method RemoveSelected
Syntax Cbx_InstanceName.RemoveSelected
Description The RemoveSelected method removes the currently-selected records from the
Select List grid and updates the grid display.
Calling this method does not delete the records from the database; it simply removes
them from the Select List grid. Running the same query again (by calling the
Regenerate method) reinstates the records in the result set and in the Select List
grid.
Parameters None
Example The following example subroutine removes all records currently selected in the Select
List grid associated with the Select CBX instance SelectContract.
You realize the above functionality when you click the button whose internal name is
btn_RemSel.
Sub btn_RemSel_Click
Cbx_SelectContract.RemoveSelected
End Sub
374 RemoveSelected
ClearBasic Control Reference
Select CBX control
method ReplaceSelected
Description The ReplaceSelected method replaces the data in the currently selected record
with the data in the Record parameter. You can use this method to update the contents
of the selected record all at once rather than call the SetCellText method for each
field you want to change.
There must be only one record selected when you call this method. This method
replaces the values in the fields of the selected record with the corresponding values
from the Record parameter. All of the fields are replaced, with the exception of the
objid field.
NOTE: The method replaces the information in the Select List grid’s contextual object but does
not update the database. If you want to retain the changes, you must save the information to
the database in your code.
Example The following example gets the currently selected case record, adds the keyword
“Clarify” to the keywords field, and replaces the record.
Sub btn_AddKeyword_Click
'Set up required variables
Dim myRecord As New Record
Dim myRecList As New List
Dim myKeywords as String
myRecord.SetField(“keywords”, myKeywords)
ReplaceSelected 375
ClearBasic Control Reference
Select CBX control
376 ReplaceSelected
ClearBasic Control Reference
Select CBX control
method ResetDefaultSort
Syntax Cbx_InstanceName.ResetDefaultSort
Description The ResetDefaultSort method clears all of the sort criteria that were set using the
AppendDefaultSort method. You can use this method to clear any old sort criteria
before installing new sort criteria using the AppendDefaultSort method.
Parameters None
Example The following example shows the Click event handler for a button. The event
handler clears the sorting criteria associated with the Select CBX instance
SelectInvCnt. After clearing the criteria, the event handler runs the query again, at
which time the records are displayed in the order they were returned from the
database.
Sub btn_ResetDefSort_Click
Cbx_SelectInvCnt.ResetDefaultSort
CBX_SelectInvCnt.Regenerate
End Sub
ResetDefaultSort 377
ClearBasic Control Reference
Select CBX control
method ResetPreFilter
Syntax Cbx_InstanceName.ResetPreFilter
Description The ResetPreFilter method clears all of the prefilters associated with the Select
CBX instance. This method does not clear any filters the user created in the Filter Set
window or in the adhoc row.
To selectively remove one or more filters, use the ClearPreFilter method instead.
Parameters None
Example The following example implements a Click event handler that removes the prefilters
associated with the Select CBX control. This event handler clears the prefilters and
then runs the query again, displaying the unfiltered records in the Select List grid.
Sub btn_ResetPreFil_Click
Cbx_SelectInvCnt.ResetPreFilter
Cbx_SelectInvCnt.Regenerate
End Sub
378 ResetPreFilter
ClearBasic Control Reference
Select CBX control
method SelectedList
Description The SelectedList method returns a list containing zero or more record objects.
Each record in the list is a copy of a selected record in the Select List grid. Because
each record is a copy of the original, changes to the returned records do not affect the
data in the grid’s contextual object.
This method supports Select CBX controls with multiple contextual objects. If you
specify a value for the CObjName parameter, this method returns the selected records
in the specified contextual object. If you omit the CObjName parameter, this method
returns the selected records for the control’s current contextual object.
NOTE: Because of paging restrictions, the selection returned by this method never extends
beyond page boundaries.
If the Select List grid supports the selection of only one record at a time, you may use
the GetSelected method to retrieve the current selection instead.
Return Values This method returns a list of the currently selected records. Each record in the list is a
copy of the original record.
Example The example subroutine shown below copies the records currently selected in the
Select List grid associated with the Select CBX instance SelectContract to the list
variable myRecList
Sub btn_GetSelList_Click
'Set up required variables
Dim myRecList As List
Set myRecList = Cbx_SelectContract.SelectedList
SelectedList 379
ClearBasic Control Reference
Select CBX control
380 SelectedList
ClearBasic Control Reference
Select CBX control
method SetAdhocCellReadOnly
Description The SetAdhocCellReadOnly method sets the read-only status of a cell in the adhoc
row. You can use this method to prevent the user from entering search criteria for
specific fields.
The read-only status of a cell remains until the form is dismissed or until you change
it again using this method.
SetAdhocCellReadOnly 381
ClearBasic Control Reference
Select CBX control
method SetAdhocCellText
Description The SetAdhocCellText method sets the value for the specified cell in the adhoc
row, even if the cell is not editable. After setting the new value, this method generates
an AdhocCellChanged event.
The length of the new data string must not exceed the maximum length allowed by
the cell’s field. You may set the cell text to the empty string, even if the field’s
Required property is set to True. Setting the cell text to the empty string eliminates
the field from the search criteria.
Return Values Returns one of the following values to indicate the result of the operation:
Value Result
0 The method successfully set the value of the cell.
1 The method was unable to set the text of the cell because the cell is not
currently visible.
2 The method was unable to set the text of the cell because the specified
cell could not be found or the control ID was invalid.
382 SetAdhocCellText
ClearBasic Control Reference
Select CBX control
method SetCObj
Description The SetCObj method sets the contextual object used by the Select CBX control and its
Select List grid. The contextual object you specify must be a source contextual object
for the Select List grid. The name you specify for the CObjName parameter must
match the name of an existing contextual object on the same form as the Select CBX
control. If no contextual object with the given name exists, this method generates a
runtime error.
This method applies only to Select CBX controls that support multiple contextual
objects. For information on creating Select CBX controls that support multiple
contextual objects, see the User Interface Editor Guide.
SetCObj 383
ClearBasic Control Reference
Select CBX control
method SetCurrent
Description The SetCurrent method marks a record as the “current,” or “reference,” record in
the Select List grid. You can use this method in conjunction with the GetNext and
GetPrevious methods to navigate the list of records in the Select List grid.
NOTE: By default, the first record in the Select List grid is marked as the current record.
The current record does not necessarily correspond to the selected record. Your
application uses the current record as an internal marker, whereas the selected record
is refers to which row is highlighted in the user interface. However, if you specify True
for the SelectRecord parameter, this method selects the current record in the user
interface.
If you provide variables for the RecordIndex and RecordsInList parameters, this
method returns the index of the current record and the total number of records in
those parameters.
384 SetCurrent
ClearBasic Control Reference
Select CBX control
Example The following example displays information about the record immediately after the
selected record. This method uses the SetCurrent and GetNext methods to get the
record immediately after the selected record.
Sub btn_SetCurRec_Click
'Set up required variables
Dim nextRecord As New Record
Dim selRecord as New Record
Dim recIndex As Long
Dim recObjId As Long
Dim recTotal As Long
Dim myResult As Boolean
SetCurrent 385
ClearBasic Control Reference
Select CBX control
method SetSelected
Description The SetSelected method selects the record at the specified index in the Select List
grid. Normally, the user selects records using the interface of the Select List grid, but
you can use this method to set the selection programmatically.
Example The following example implements a Click event handler that iterates through the
first 8 records in the grid. For each record, the example selects the record and
performs
Sub btn_SetSelRec_Click
'Set up required variables
Dim recIndex As Long
Dim myResult As Long
For i= 1 to 8
Cbx_SelectTerritory.SetSelected i
386 SetSelected
ClearBasic Control Reference
Select CBX control
method SetSelectedById
Description The SetSelectedById method selects the record with the specified object ID in the
Select List grid. Normally, the user selects records using the interface of the Select List
grid, but you can use this method to set the selection programmatically.
Example The following example changes the selection to the next current record. It gets this
record using the GetNext method and then uses the object ID of the record to set the
selection.
Sub btn_SelRecById
Dim nextRecord as Record
Dim recObjId as Long
Dim recIndex as Long
Dim recTotal as Long
Cbx_SelectTerritory.SetSelectedById recObjId
SetSelectedById 387
ClearBasic Control Reference
Select CBX control
method UnSelect
Syntax Cbx_InstanceName.UnSelect
Description The UnSelect method deselects all currently selected records in the Select List grid.
Parameters None
Example The following sample subroutine deselects all currently selected records in the multi-
Select List grid associated with the Select CBX instance SelectOpportunity.
You realize the above functionality when you click the button whose internal name is
btn_NoSelect.
Sub btn_NoSelect_Click
Cbx_SelectOpportunity.UnSelect
End Sub
388 UnSelect
ClearBasic Control Reference
Select CBX control
method UpdateItem
Description The UpdateItem method updates one or more records in the select-list grid. This
method modifies only the contents of the grid and does not update the record
information stored in the database.
When you call this method, you may specify a single record or a list of records. This
method uses the object ID of each specified record to locate the corresponding record
in the grid. If a record with the specified ID does not exist in the grid, this method
does nothing.
This method updates every field of the record in the grid. If you want to change the
value of only one or two fields, get the original record from the grid and modify it
directly.
Example The following example updates the Name field of the selected record in the select-list
grid.
Sub btn_UpdateSelected_Click
Dim myRec as New Record
Dim bItemFound as Boolean
bItemFound = CBX_myCBXInst.GetSelected(myRec)
UpdateItem 389
ClearBasic Control Reference
Select CBX control
390 UpdateItem
ClearBasic Control Reference
Slider control
Description A slider control lets the user select a discrete value or consecutive set of values from
within a fixed range. The control consists of a rectangular area (with optional tick
marks) and a slider which indicates the currently selected value. The user can move
the slider by dragging it, by clicking to either side of it, or by using the keyboard
arrows when the control has the focus.
When the user moves the slider using the mouse or keyboard, the Slider control sends
two events to the underlying form: a Scroll event and a Change event. The Scroll event
indicates that the slider moved, either due to a mouse action or a key press. The
subsequent Change event then reports the new value of the Slider control.
You set the appearance and orientation of the Slider control using the User Interface
Editor. You can set the minimum and maximum values of the slider and you can set
the type and frequency of tick marks displayed along the axis of the control.
Referring to Slider You cannot create control objects directly using ClearBasic code. You must associate
Controls controls with a form, frame, or tab using the User Interface Editor. When the form,
frame, or tab is subsequently displayed, the corresponding control object is created
automatically.
If you need to refer to a control object explicitly, such as when passing a control object
as a method parameter, use a variable of type Control to refer to the control object.
For example, you would use the following code to obtain a reference to the slider
control called YourSliderControl:
Dim YourControl As Control
Set YourControl = YourSliderControl
Source You can link a Slider to a contextual object to get the current value of the slider. The
slider obtains its initial value from the destination contextual object you specify using
the User Interface Editor.
You can also set the initial value of the slider using ClearBasic code by assigning a
value to the Value property of the slider control.
Destination When the user changes the value of the slider, the Slider control updates the value in
the destination contextual object. If no contextual object is associated with the slider,
you can obtain the resulting value from the slider’s Value property.
Methods This object supports the following methods. Methods marked with a [C] are
documented with the Control object.
■ Refresh method [C]
■ SetFocus method [C]
Properties This object supports the following properties. Properties marked with [C] are
documented with the Control object.
■ ControlType property [C]
■ Enabled property [C]
■ Height property [C]
■ hWnd property [C]
■ Id property [C]
■ Left property [C]
■ Max property
■ Min property
■ Name property [C]
■ Top property [C]
■ Value property
■ Visible property [C]
■ Width property [C]
Events This object supports the following events. Events marked with a [C] are documented
with the Control object.
■ Change event
■ GotFocus event [C]
■ LostFocus event [C]
■ Scroll event
392
ClearBasic Control Reference
Slider control
property Max
Description The Max property contains a Long value representing the maximum value applicable
to the slider control.
This property is readable and writable. The value in this property must be greater
than the value in the Min property.
Max 393
ClearBasic Control Reference
Slider control
property Min
Description The Min property contains a Long value representing the minimum value applicable
to the slider control.
This property is readable and writable. The value in this property must be less than
the value in the Max property.
394 Min
ClearBasic Control Reference
Slider control
property Value
Description The Value property contains a long integer value representing the current value
assigned to the control. You can set the value of the slider programmatically by
modifying the value in this property. This value must lie between the minimum and
maximum values you specified on the control’s property sheet using the User
Interface Editor.
This property is readable and writable. At runtime, if the control is associated with a
contextual object, the control copies this value to the contextual object.
Value 395
ClearBasic Control Reference
Slider control
event Change
Description The Change event occurs when the value associated with the Slider control changes.
When you receive this event, you can check the current value of the control and
respond to the change.
To set a new value for the slider, assign a new value to the slider’s Value property.
Example In the following example, Change events to the Slider control are intercepted for
debugging purposes. When the position of the slider changes, the new value is
printed.
Sub Slider1_Change()
DIM lnum as long
Debug.Print "Slider Change"
lnum = Slider1.Value
Debug.Print lnum
End Sub
396 Change
ClearBasic Control Reference
Slider control
event Scroll
Description The Scroll event occurs when the user moves the slider using either the mouse or
keyboard. This event only indicates that the slider moved and does not imply that the
value of the control changed.
Example In the following example, Scroll events to the Slider control are intercepted for
debugging purposes. When the position of the slider changes, the value of the control
is printed and then assigned to the TextBox1 control.
Sub Slider1_Scroll()
DIM lnum as long
Debug.Print "Slider Scroll"
lnum = Slider1.Value
Debug.Print lnums
TextBox1.Value = lnum
End Sub
Scroll 397
ClearBasic Control Reference
Slider control
398 Scroll
ClearBasic Control Reference
Tab Button control
Description The tab button control coordinates the display of a child window from a parent
window. When you design a parent form, you must add a tab button for each child
window you plan to display. The tab button contains information about the position
of the tab window relative to its parent and also controls aspects of the tab’s display,
such as its style and visibility.
When you add a tab button to a form, you must specify the form ID for the window
you want to associate with the tab. The form you specify must be a child form of the
parent form.
At runtime, you can use the properties of the tab button control to access information
about the position and settings of the tab. You can also use the control’s Value
property to select the tab using ClearBasic code.
Referring to Tab You cannot create control objects directly using ClearBasic code. You must associate
Button Controls controls with a form, frame, or tab using the User Interface Editor. When the form,
frame, or tab is subsequently displayed, the corresponding control object is created
automatically.
If you need to refer to a control object explicitly, such as when passing a control object
as a method parameter, use a variable of type Control to refer to the control object.
For example, you would use the following code to obtain a reference to the slider
control called YourSliderControl:
Dim YourControl As Control
Set YourControl = YourSliderControl
Methods This object supports the following methods. Methods marked with [C] are
documented with the Control object.
■ Refresh method [C]
Properties This object supports the following properties. Properties marked with [C] are
documented with the Control object.
■ ControlType property [C]
■ DataChanged property
■ Enabled property [C]
■ Height property [C]
■ hWnd property[C]
■ Id property [C]
■ Left property [C]
■ Name property [C]
■ Parent property
■ Tag property
■ Top property [C]
■ Value property
■ Visible property [C]
■ Width property [C]
Events This object supports the following events. Events marked with [C] are documented
with the Control object.
■ Click event
400
ClearBasic Control Reference
Tab Button control
property DataChanged
Description The DataChanged property contains a boolean value indicating whether the user
modified the contents of this control. This value only indicates whether modifications
were made by the user; it does not reflect changes made to the control by your
ClearBasic code.
If you modify the control programmatically, you can set this property to reflect your
changes. Set this property to True to indicate you made modifications; otherwise, set it
to False to indicate the control is unchanged.
DataChanged 401
ClearBasic Control Reference
Tab Button control
property Parent
Description The Parent property returns the form that contains the control. This property is read-
only.
402 Parent
ClearBasic Control Reference
Tab Button control
property Tag
Description The Tag property contains a custom string that you can assign at runtime. You can
use this string to identify the object internally in your application. You can also use
this property to store extra information about the object.
Tag 403
ClearBasic Control Reference
Tab Button control
property Value
Description The Value property contains a long integer indicating whether the tab is currently
active. If the value is 1, the tab is active. If the value is 0, the tab is not active.
Assigning the value 1 to this property makes the tab active. You must use this
property to activate tab buttons that do not have a title banner (because there is no tab
for the user to click).
404 Value
ClearBasic Control Reference
Tab Button control
event Click
Description The Click event occurs when the user presses and releases the mouse button with
the cursor on or in the control. You can use this event to respond to user interactions
with the control.
Click 405
ClearBasic Control Reference
Tab Button control
406 Click
ClearBasic Control Reference
Text Box control
Description This control allows the user to view or input a single line of text information. (The text
box control is similar to the multiline text box control except that the multiline control
accepts/displays more than one line of text and supports scrolling.)
You use this control to display a single line of text, accept a single line of text from the
user, or accept user input in order to process the information and display a response.
Referring to Text You cannot create control objects directly using ClearBasic code. You must associate
Box Controls controls with a form, frame, or tab using the User Interface Editor. When the form,
frame, or tab is subsequently displayed, the corresponding control object is created
automatically.
If you need to refer to a control object explicitly, such as when passing a control object
as a method parameter, use a variable of type Control to refer to the control object.
For example, you would use the following code to obtain a reference to the text box
control called YourTextBoxControl:
Dim YourControl As Control
Set YourControl = YourTextBoxControl
Context-Sensitive This control supports the display of a context-sensitive menu. The control
Menu Support automatically provides several control-related menu items to allow the user to cut,
copy, and paste text. You may add additional menu items using the methods of this
control.
If you add context-sensitive menu items to a control, you must provide an event
handler to respond to the selection of your menu items. The ContextMenu_Select
event handler lets you handle the selection of all your context-sensitive menu items.
You may also implement a ContextMenuDisplaying event handler to modify the
state of your menu items immediately before the menu is displayed.
Destination The text supplied by the user or programmatically supplied by your code is returned
to the destination contextual object.
Control Label This control does not contain a label. You may create a label control and place it next
to this control.
Methods This object supports the following methods. Methods marked with [C} are
documented with the Control object.
■ AppendContextMenu method
■ ClearContextMenu method
■ SetContextMenuEnabled method
■ SetContextMenuVisible method
■ Refresh method [C]
■ SetFocus method [C]
Properties This object supports the following properties. Properties marked with [C} are
documented with the Control object.
■ BackColor property
■ ControlType property [C]
■ DataChanged property
■ Enabled property [C]
■ ForeColor property
■ Height property [C]
■ hWnd property [C]
■ Id property [C]
■ Left property [C]
■ MaxLength property
■ MultiLine property
■ Name property [C]
■ Parent property
■ Required property
■ RequiredColor property
■ SelLength property
■ SelStart property
■ SelText property
■ Tag property
■ Text property
■ Top property [C]
■ Value property
■ Visible property [C]
408
ClearBasic Control Reference
Text Box control
Events This object supports the following events. Events marked with [C} are documented
with the Control object.
■ Click event
■ ContextMenuDisplaying event
■ ContextMenu_Select event
■ GotFocus event [C]
■ KeyPress event
■ LostFocus event [C]
Deprecated Events The following event has changed. The old event is still supported for compatibility
but its use is discouraged. Use the new event instead.
409
ClearBasic Control Reference
Text Box control
method AppendContextMenu
Description The AppendContextMenu method adds a new menu item to the end of the control’s
context-sensitive menu. You can use this method to supplement the menu items
specified using the User Interface Editor.
In addition to adding menu items, you can use this method to add a separator after an
existing menu item. To add a separator, specify True for the Separator parameter.
The menu items you add using this method are enabled and visible initially. To
change the appearance of an item, call the SetContextMenuEnabled or
SetContextMenuVisible method. You can also add code to a
ContextMenuDisplaying event handler to update the appearance of menu items
dynamically.
410 AppendContextMenu
ClearBasic Control Reference
Text Box control
Example The following example adds two new items to the context-sensitive menu associated
with a text box control. The new items allow the user to select all of the text in the
control and to deselect whatever is currently selected.
Sub Form_Load
Dim numSelItems As Integer
Dim numTotalItems As Integer
End Sub
AppendContextMenu 411
ClearBasic Control Reference
Text Box control
method ClearContextMenu
Syntax YourGrid.ClearContextMenu
Description The ClearContextMenu method removes custom menu items from the control’s
context-sensitive menu. This method removes only menu items that were added
using the AppendContextMenu method of the control. This method does not remove
application-specific menu items or menu items added in the User Interface Editor.
Parameters None
412 ClearContextMenu
ClearBasic Control Reference
Text Box control
method SetContextMenuEnabled
You can call this method from a ContextMenuDisplaying event handler to adjust
the appearance of the items in the menu. The enabled state of the item does not
change until you call this method again.
You may use this method to modify both permanent menu items and those added
using the AppendContextMenu method. To set the default enabled state of a
permanent menu item, you must modify the item’s entry in the Clarify User Interface
Editor.
SetContextMenuEnabled 413
ClearBasic Control Reference
Text Box control
method SetContextMenuVisible
You can call this method from a ContextMenuDisplaying event handler to adjust
the appearance of the items in the menu. The visible state of the item does not change
until you call this method again.
You may use this method to modify both permanent menu items and those added
using the AppendContextMenu method. To set the default visible state of a
permanent menu item, you must modify the item’s entry in the Clarify User Interface
Editor.
414 SetContextMenuVisible
ClearBasic Control Reference
Text Box control
property BackColor
Description The BackColor property allows you to set the background color of a control. You can
set this property directly for the control, or indirectly by setting the property on the
contextual object that is linked to the control.
Before using this property, you must establish a color scheme using either the
CreateColorScheme or SetColorScheme method.
IMPORTANT: Before you can set back or fore colors, you must first create a color scheme (see
CreateColorScheme) that maps available system colors to labels. Then you must use
SetColorScheme to assign that color-to-label mapping to the form where you want to
perform the coloring. The reason for this is that you must specify the label, not the system
color, when you set BackColor or ForeColor.
If you perform color operations on controls that do not support color, no errors are
generated; the controls simply won’t be colored. This may be useful information if
you want to use multiplatform color operations where color may not be universally
supported for a given control type. For example, the Command Button may be
colored in UNIX, but not on the Macintosh.
Setting Description
ColorLabel You must specify a label that is mapped to a valid system color. The label
must be in the color scheme that is currently in effect for the form in which
you are performing color operations. (See CreateColorScheme and
SetColorScheme.)
Example The following code illustrates how you use color in ClearBasic. (You are not required
to set color in the form load event procedure.)
Before you set the color properties, you must create a color scheme and set it into
effect, as shown in the example. Only then can you color the object you want to color.
In this example, the text box label and the textbox foreground text are assigned the
same color, red, and the background color for the text box is set to cyan.
Sub Initialize_App
Dim LabelList1 As New List
Dim ColorList1 As New List
LabelList1.AppendItem "Urgent", _
"Important", "Weak"
BackColor 415
ClearBasic Control Reference
Text Box control
ColorList1.AppendItem "red", _
"cyan", "blue"
App.CreateColorScheme "Form2020", _
LabelList1,ColorList1
End Sub
Sub Form_Load
App.SetColorScheme "Form2020"
TextBox1_Label.ForeColor = "Urgent"
TextBox1.ForeColor = "Urgent"
TextBox1.BackColor = "Important"
End Sub
416 BackColor
ClearBasic Control Reference
Text Box control
property DataChanged
Description The DataChanged property contains a boolean value indicating whether the user
modified the contents of this control. This value only indicates whether modifications
were made by the user; it does not reflect changes made to the control by your
ClearBasic code.
If you modify the control programmatically, you can set this property to reflect your
changes. Set this property to True to indicate you made modifications; otherwise, set it
to False to indicate the control is unchanged.
DataChanged 417
ClearBasic Control Reference
Text Box control
property ForeColor
Description The ForeColor property allows you to set the color of the control label text. You can
set this property directly for the control, or indirectly by setting the property on the
contextual object that is linked to the control.
Before using this property, you must establish a color scheme using either the
CreateColorScheme or SetColorScheme method.
IMPORTANT: Before you can set back or fore colors, you must first create a color scheme (see
CreateColorScheme) that maps available system colors to labels. Then you must use
SetColorScheme to assign that color-to-label mapping to the form where you want to
perform the coloring. The reason for this is that you must specify the label, not the system
color, when you set BackColor or ForeColor.
If you perform color operations on controls that do not support color, no errors are
generated; the controls simply won’t be colored. This may be useful information if
you want to use multiplatform color operations where color may not be universally
supported for a given control type. For example, the Command Button may be
colored in UNIX, but not on the Macintosh.
Setting Description
ColorLabel You must specify a label that is mapped to a valid system color. The label
must be in the color scheme that is currently in effect for the form in which
you are performing color operations. (See CreateColorScheme and
SetColorScheme.)
Example The following code illustrates how you use color in ClearBasic. (You are not required
to set color in the form load event procedure.)
Before you set the color properties, you must create a color scheme and set it into
effect, as shown in the example. Only then can you color the object you want to color.
In this example, the text box label and the textbox foreground text are assigned the
same color, red, and the background color for the text box is set to cyan.
Sub Initialize_App
Dim LabelList1 As New List
Dim ColorList1 As New List
418 ForeColor
ClearBasic Control Reference
Text Box control
End Sub
Sub Form_Load
App.SetColorScheme "Form2020"
TextBox1_Label.ForeColor = "Urgent"
TextBox1.ForeColor = "Urgent"
TextBox1.BackColor = "Important"
End Sub
ForeColor 419
ClearBasic Control Reference
Text Box control
property MaxLength
Description The MaxLength property contains a long integer indicating the maximum number of
bytes that may be displayed by the control. The value of this integer must be between
0 and 32000. (For UNIX-only implementations, this value may be between 0 and
64000.) This property is readable and writable.
You can use this property to obtain the initial design-time value specified in the User
Interface Editor. You may also change this value by assigning a new value to the
property. Any value you specify remains in effect until you change the property again
or until the current session ends.
420 MaxLength
ClearBasic Control Reference
Text Box control
property MultiLine
Description The MultiLine property contains a boolean indicating whether the control is a
multiline control. For text boxes, this property always contains the value False.
MultiLine 421
ClearBasic Control Reference
Text Box control
property Parent
Description The Parent property contains the form object that owns the control. You can use this
property in to retrieve a reference to the form object containing the control.
422 Parent
ClearBasic Control Reference
Text Box control
property Required
Description The Required property contains a boolean value indicating whether or not the user
must enter a value in the text box before dismissing the form. This property contains
the value True if the control is required, otherwise False.
This property is read-only. You must set this property at design time using the User
Interface Editor.
Required 423
ClearBasic Control Reference
Text Box control
property RequiredColor
Description The RequiredColor property contains a color label indicating the background color
of a required textbox. Before setting this property, you must use
CreateColorScheme and SetColorScheme to create and set a color scheme for
the form in which the textbox is located.
This property is readable and writable. This property only applies to multiline text
box controls whose Required property is set to True. If the Required property is not
set to True, this property is ignored.
424 RequiredColor
ClearBasic Control Reference
Text Box control
property SelLength
Description The SelLength property contains a long integer value indicating the number of
characters in the current selection. This property is readable and writable.
Changing the value in this property changes the length of the current selection. You
can use this property in combination with the SelStart property to select text in the
control.
SelLength 425
ClearBasic Control Reference
Text Box control
property SelStart
Description The SelStart property contains a long integer value indicating the location of the
current insertion point. Text typed by the user or entered programmatically is entered
before the character at the specified index. Indexes are 1 based, that is, the first
character is at index 1, the second at index 2, and so on.
If the SelLength property contains a value greater than 0, this property indicates the
beginning of a text selection. You can use this property in combination with
SelLength to select text in the control.
426 SelStart
ClearBasic Control Reference
Text Box control
property SelText
Description The SelText property contains a string with the text of the current selection. Getting
this property returns the selected text, setting it replaces the selected text with the
string you specify.
If no text is selected, this property contains an empty string (""). To determine if any
text is selected, check the SelLength property for a non-zero value.
SelText 427
ClearBasic Control Reference
Text Box control
property Tag
Description The Tag property contains a custom string that you assign at runtime. You can use
this string to identify the control internally to your application. You can also use this
property to store extra information about the control.
428 Tag
ClearBasic Control Reference
Text Box control
property Text
Description The Text property contains the complete text displayed by the text box control. The
text in this property is stored in the destination contextual object linked to the control.
This property is readable and writable. Setting this property replaces the text
currently in the control with the new string you specify. It also updates the contents of
the destination contextual object.
NOTE: This property behaves the same way as the Value property of the text box control.
Text 429
ClearBasic Control Reference
Text Box control
property Value
Description The Value property contains the complete text displayed by the text box control. The
text in this property is stored in the destination contextual object linked to the control.
This property is readable and writable. Setting this property replaces the text
currently in the control with the new string you specify. It also updates the contents of
the destination contextual object.
430 Value
ClearBasic Control Reference
Text Box control
event Click
Description The Click event handler for your multiline text box is called when the user presses
and releases the mouse button over the control. A Click event usually indicates the
positioning of the insertion point or the selection of text. You can use this event in
combination with the SelStart and SelLength properties to determine the new
selection.
Click 431
ClearBasic Control Reference
Text Box control
event ContextMenuDisplaying
Description The ContextMenuDisplaying event notifies your control that its context-sensitive
menu is about to be displayed. Use this event to update the appearance of the menu
and its items. You can enable or disable items, set the visibility of items, or add items
to the menu as appropriate.
The control sends this event in response to a user request to display the context-
sensitive menu. The event is sent before the menu is displayed.
432 ContextMenuDisplaying
ClearBasic Control Reference
Text Box control
event ContextMenu_Select
Description The ContextMenu_Select event notifies your application that the user chose an
item from the control’s context-sensitive menu. In your event handler, perform the
task associated with the menu item.
You must provide an event handler for each menu item you define in the context-
sensitive menu. You can define menu items at design time using the Clarify User
Interface Editor or at runtime using the AppendContextMenu method.
ContextMenu_Select 433
ClearBasic Control Reference
Text Box control
event KeyPress
Description The KeyPress event occurs when the user presses an ASCII key or an extended
ASCII key in the control (when the control has the focus). Event handlers for this
event can perform tasks such as checking for valid characters.
The parameter YourKey returns the ASCII keycode for the key that was pressed.
To convert the parameter YourKey from ASCII into a character, use the function Chr:
Char = Chr (YourKey)
Example The following code is part of an event procedure for a textbox that handles the
keypress for a plus "+" key event.
Sub SUB_BILLEXP_MOD_KeyPress(KeyAscii As Integer)
Dim increment As Boolean
increment = False
434 KeyPress
ClearBasic Control Reference
TreeView control
Description A TreeView control displays a hierarchical list of nodes and provides an interface for
manipulating those nodes. Each node consists of a label and an optional bitmap. If a
node has subnodes, the node can be expanded to display its subnodes and collapsed
to hide them again.
You use the methods of the TreeView control to add and remove nodes from the
hierarchical list. The control also defines methods for retrieving information about a
particular node and for assigning images to the nodes.
The TreeView control responds to clicks by calling one of several user-defined event
handlers. You can define a NodeClick event handler to respond to general clicks in
the control. If you want to know when a node is expanded or collapsed, define
Expand and Collapse event handlers, respectively.
Node Images In addition to displaying a text label, each node in the TreeView control can display a
custom icon. You can use icons to provide additional information about the content of
the node. For example, you can use a folder icon to represent a node that contains
other items.
The TreeView control loads individual icons from an image list that you specify using
the SetImageList method. You refer to an individual icon by referring to its index
in the image list.
You can associate two permanent icons with each node at design time. These two
icons represent the node when it is unselected and when it is selected. At runtime, you
can overlay additional icons on top of these permanent icons to add highlights.
Keyboard In addition to using the mouse, users can use the keyboard to navigate the list of
Navigation nodes in a TreeView control. The Up and Down arrow keys let you navigate around
all of the visible nodes, that is, all top-level nodes and the contents of all expanded
nodes. Typing one of these arrow keys moves the current selection up or down by one
entry.
If a collapsed node is currently selected, the user can expand the node by typing the
Right arrow key. Similarly, typing the Left arrow key on an expanded node, collapses
that node.
Users can jump to a node by typing the first letter of its label. Subsequent presses of
the same key cycle through all of the nodes beginning with that letter.
Referring to You cannot create control objects directly using ClearBasic code. You must associate
Treeview Controls controls with a form, frame, or tab using the User Interface Editor. When the form,
frame, or tab is subsequently displayed, the corresponding control object is created
automatically.
If you need to refer to a control object explicitly, such as when passing a control object
as a method parameter, use a variable of type Control to refer to the control object.
For example, you would use the following code to obtain a reference to the treeview
control called YourTreeviewControl:
Dim YourControl As Control
Set YourControl = YourTreeviewControl
Methods This object supports the following methods. Methods marked with a [C] are
documented with the Control object.
■ Add method
■ Clear method
■ Expand method
■ GetItemText method
■ GetSelectedItem method
■ Key method
■ Remove method
■ SetFocus method [C]
■ SetImageList method
■ SetItemOverlayImage method
■ SetItemText method
■ SetOverlayImage method
■ SetSelectedItem method
Properties This object supports the following properties. Properties marked with [C] are
documented with the Control object.
■ ControlType property [C]
■ Enabled property [C]
■ Height property [C]
■ hWnd property [C]
■ Id property [C]
■ Left property [C]
■ Name property [C]
■ Top property [C]
■ Visible property [C]
■ Width property [C]
436
ClearBasic Control Reference
TreeView control
Events This object supports the following events. Events marked with a [C] are documented
with the Control object.
■ Collapse
■ Expand
■ GotFocus [C]
■ LostFocus [C]
■ NodeClick
437
ClearBasic Control Reference
TreeView control
method Add
Applies To TreeView
Description The Add method adds a node to the TreeView control. When you call this method,
specify a label and an optional bitmap image to represent the node. If you assign a key
value to the node, you can use that value to identify the node later.
If you specify values for the relative and relationship parameters, this method adds
the node at the specified position in the hierarchy. If you do not specify these
parameters, the node is added immediately after (and at the same level as) the
previously added node.
The bitmap images you associate with a node must reside in the control’s current
image list. To assign an image list to the control, call the SetImageList method.
438 Add
ClearBasic Control Reference
TreeView control
The relative and relationship parameters work together to specify the position
of the new node in the TreeView control. The relative parameter contains the key
or ID of a node previously added to the treeview control. The following table lists the
acceptable values for the relationship parameter:
The image and selectedImage parameters are indexes into the image list
associated with the control. You associate an image list with the control by calling the
SetImageList method.
Return Values Returns a Long value containing the ID of the node that was added.
Example The following example initializes the TreeView control of the form by adding several
nodes. In this example, there is a top-level node with the label "Parent" and 3
subnodes. Two of those subnodes ("Child1" and "Child2") are direct children of
"Parent" while "Child3" is a subnode of "Child2".
Sub Form_Load()
Dim colorval, iconResId as Long
Me.DoDefault
colorval =16711935
iconResId = 180
num = 1
Cobj_test.Fill num
'Tree.SetImageList iconResId,16711935, 16
nodX = Tree.Add(, , "r", "Parent",1,2)
nodX = Tree.Add("r", 4, "child1",
"Child1",3,4)
nodX = Tree.Add("r", 4, "child2",
"Child2",5,6)
nodX = Tree.Add(nodX, 4, "child3",
"Child3",7,8)
End Sub
Add 439
ClearBasic Control Reference
TreeView control
method Clear
Syntax YourControl.Clear
Applies To TreeView
Description The Clear method removes all of the nodes from the TreeView control.
Parameters None
440 Clear
ClearBasic Control Reference
TreeView control
method Expand
Applies To TreeView
Description The Expand method expands or collapses the specified node. If the specified node
does not have any children—or is already in the given state—this method does
nothing.
In addition to simply expanding or collapsing a node, you can toggle its state by
specifying the value 3 for the options parameter. When you specify this option, this
method collapses an already expanded node or expands a collapsed node.
Return Values Returns True if the node’s state was successfully modified, otherwise False.
Expand 441
ClearBasic Control Reference
TreeView control
method GetItemText
Applies To TreeView
Description The GetItemText method returns the text string associated with a node. This text
string corresponds to the string the user sees in the control display.
Return Values Returns a String containing the text of the specified item. If the specified item cannot
be found, this method returns an empty string ("").
442 GetItemText
ClearBasic Control Reference
TreeView control
method GetSelectedItem
Syntax YourControl.GetSelectedItem
Applies To TreeView
Description The GetSelectedItem method returns the ID of the currently selected node.
Parameters None
Return Values Returns a Long value, which corresponds to the ID of the currently selected node. You
can pass this value to other methods to identify the given node.
GetSelectedItem 443
ClearBasic Control Reference
TreeView control
method Key
Applies To TreeView
Description The Key method returns the key string associated with a node. You would typically
use this method in conjunction with the GetSelectedItem method to determine the
key of the selected node.
Return Values Returns the string that uniquely identifies the node. This string is the same string that
you supplied in the key parameter of the Add method.
444 Key
ClearBasic Control Reference
TreeView control
method Remove
Applies To TreeView
Description The Remove method removes the specified node from the TreeView control. If the
node contains any children, those nodes are removed as well.
Return Values Returns True if the node was removed, otherwise it returns False.
Remove 445
ClearBasic Control Reference
TreeView control
method SetImageList
Applies To TreeView
Description The SetImageList method associates an image list with the TreeView control. The
control uses this image list to obtain the bitmaps associated with each node.
The image list you associate with the control is itself a bitmap image. You can obtain
this bitmap image either from the resource file that shipped with the CeFO
application or you can specify a separate bitmap file.
The image list itself is a series of icon bitmaps arranged horizontally in the bitmap file.
The width and height of each icon must be identical to the value in the size parameter.
The TreeView control assigns each icon an index number corresponding to its order in
the bitmap. The first icon is at index 0, the second at index 1 and so on.
The TreeView control creates a mask bitmap for each icon in the image list. The control
uses these bitmaps to highlight the currently selected node. When applied to an icon,
the mask inverts some of the icon pixels to give the icon the appearance of being
selected.
The size of each mask bitmap is identical to the size of each icon bitmap. That is, the
size parameter specifies both the horizontal and vertical dimensions of the mask
bitmap. The pixels in the mask bitmap can be either black or white.
446 SetImageList
ClearBasic Control Reference
TreeView control
The pixel values for each mask bitmap are calculated using the corresponding icon
bitmap and the color value specified in the mask parameter. All mask pixels are set to
the value 0 by default. If the color of an icon pixel matches the color specified in the
mask parameter, the corresponding mask pixel is set to 1. When the mask is applied to
the icon, the color of that icon pixel is set to black.
To specify a color value in the mask parameter, you must assign values for each red,
green, and blue component of the color. Each value must be between 0 and 255. You
can use the following equation to add the color values together and obtain the mask
color:
color = (blue * 65536) +
(green * 256) +
(red * 1)
For example, a shade of purple whose red and blue component values are 128 and
whose green component value is 0 would result in the mask value of 8388736, as
shown by the following calculations:
(128 * 65536) + (0 * 256) + (128 * 1) = 8388736
Example The following example initializes the TreeView control of the form by adding several
nodes. Before adding any nodes to the form’s TreeView control, this method assigns
an image list to that control. The color value specified in the colorval parameter
corresponds to an RGB value.
Sub Form_Load()
Dim colorval, iconResId as Long
Me.DoDefault
num = 1
Cobj_test.Fill num
SetImageList 447
ClearBasic Control Reference
TreeView control
method SetItemOverlayImage
Applies To TreeView
Description The SetItemOverlayImage method adds an overlay image to the icon of the
specified node. This method places the overlay image directly on top of the existing
node icon. The overlay image remains on top of the node icon until you call this
method again and specify the value 0 for the OverlayIndex parameter.
Before calling this method, you must register one or more overlay images with the
control. See the SetOverlayImage for information on how to register overlay
images.
Return Values Returns True if the node text was successfully set; otherwise, returns False to indicate
an error occurred.
448 SetItemOverlayImage
ClearBasic Control Reference
TreeView control
method SetItemText
Applies To TreeView
Description The SetItemText method assigns a new text string to the specified node. This text
string corresponds to the string the user sees in the control display.
Return Values Returns True if the node text was successfully set; otherwise, returns False to indicate
an error occurred.
SetItemText 449
ClearBasic Control Reference
TreeView control
method SetOverlayImage
Applies To TreeView
Description The SetOverlayImage method registers an existing image in the control’s image list
as an overlay image. Typically, you call this method several times from a Form_Load
procedure to establish which icons in the image list are to be used as overlay icons.
You must call this method before applying an overlay icon with the
SetItemOverlayImage method.
Return Values Returns True if the node text was successfully set; otherwise, returns False to indicate
an error occurred.
Example The following example initializes the TreeView control of the form and adds several
nodes. In addition to setting the image list used by the nodes, this routine also
registers every third icon in the image list as an overlay icon.
Sub Form_Load()
Dim colorval, iconResId as Long
Dim ret As Bool
Me.DoDefault
450 SetOverlayImage
ClearBasic Control Reference
TreeView control
SetOverlayImage 451
ClearBasic Control Reference
TreeView control
method SetSelectedItem
Applies To TreeView
Description The SetSelectedItem method selects the specified node of the TreeView control.
The TreeView control highlights the specified node and displays its selected image
icon as appropriate.
Return Values Returns True if the operation was successful, otherwise False.
452 SetSelectedItem
ClearBasic Control Reference
TreeView control
event Collapse
Description The Collapse event occurs when the user collapses a node in the TreeView control.
You can use this event notification to perform any additional tasks related to the
collapse of the node. You do not need to collapse the node yourself as that is handled
automatically by the ClarifyCRM eFrontOffice application.
Parameters The control passes the following parameter to your event handler:
Collapse 453
ClearBasic Control Reference
TreeView control
event Expand
Description The Expand event occurs when the user expands a node in the TreeView control.
You can use this event notification to perform any additional tasks related to the
expansion of the node. You do not need to expand the node yourself as that is handled
automatically by the CeFO application.
Parameters The control passes the following parameter to your event handler:
454 Expand
ClearBasic Control Reference
TreeView control
event NodeClick
Description The NodeClick event occurs when the user clicks on a node in the TreeView control.
You can use this event notification to perform any additional tasks related to selecting
the node. You do not need to select the node yourself as that is handled automatically
by the CeFO application.
Parameters The control passes the following parameter to your event handler:
NodeClick 455
ClearBasic Control Reference
TreeView control
456 NodeClick
ClearBasic Control Reference
UpDown control
Description The UpDown control consists of a pair of arrow buttons that the user clicks to
increment or decrement a value. Normally, you associate an UpDown control with
another control, called a "buddy control". When the user clicks on the arrows of the
UpDown control, the value in the buddy control is incremented or decremented
accordingly.
If an UpDown control does not have an associated buddy control, the UpDown control
functions as a simplified scroll bar. You use the events sent by the control to respond
to clicks in the control. For example, you can use an UpDown control on a form to
scroll additional tabs into view.
Referring to You cannot create control objects directly using ClearBasic code. You must associate
UpDown Controls controls with a form, frame, or tab using the User Interface Editor. When the form,
frame, or tab is subsequently displayed, the corresponding control object is created
automatically.
If you need to refer to a control object explicitly, such as when passing a control object
as a method parameter, use a variable of type Control to refer to the control object.
For example, you would use the following code to obtain a reference to the UpDown
control called YourUpDownControl:
Dim YourControl As Control
Set YourControl = YourUpDownControl
Methods This object supports the following methods. Methods marked with a [C] are
documented with the Control object.
■ SetFocus method [C]
Properties This object supports the following properties. Properties marked with [C] are
documented with the Control object.
■ ControlType property [C]
■ Enabled property [C]
■ Height property [C]
■ hWnd property [C]
■ Id property [C]
■ Left property [C]
■ Max property
■ Min property
■ Name property [C]
■ Top property [C]
■ Value property
■ Visible property [C]
■ Width property [C]
Events This object supports the following events. Events marked with a [C] are documented
with the Control object.
■ Change event
■ DownClick event
■ GotFocus event [C]
■ LostFocus event [C]
■ UpClick event
458
ClearBasic Control Reference
UpDown control
property Max
Description The Max property contains a long integer representing the maximum value applicable
to the UpDown control.
This property is readable and writable. The value in this property must be greater
than the value in the Min property.
Max 459
ClearBasic Control Reference
UpDown control
property Min
Description The Min property contains a long integer representing the minimum value applicable
to the UpDown control.
This property is readable and writable. The value in this property must be less than
the value in the Max property.
460 Min
ClearBasic Control Reference
UpDown control
property Value
Description The Value property contains a long integer representing the current value assigned
to the control. You can set the value of the UpDown control programmatically by
modifying the value in this property. If the control is associated with a buddy control,
setting this value also sets the value of the buddy control.
Value 461
ClearBasic Control Reference
UpDown control
event Change
Description The Change event reports an updated value for the UpDown control. This event is
generated after an UpClick or DownClick event, even if clicking one of those
buttons does not result in a change to the control’s value.
The UpDown control automatically updates the contents of the buddy control upon
receipt of this event. You can use this event to perform any additional tasks required
by your application.
462 Change
ClearBasic Control Reference
UpDown control
event DownClick
Description The DownClick event occurs when the user clicks the control’s down button. If the
UpDown control does not have a buddy control, you can use this event to trigger
additional events. For example, you can use this event to scroll through the tabs of a
form.
DownClick 463
ClearBasic Control Reference
UpDown control
event UpClick
Description The UpClick event occurs when the user clicks the control’s up button. If the
UpDown control does not have a buddy control, you can use this event to trigger
additional events. For example, you can use this event to scroll through the tabs of a
form.
464 UpClick
ClearBasic Control Reference
Appendix A
Supported Methods,
Properties, and Events
In This Chapter
Control and Method Matrix . . . . . . . . . . . . . . . . . . . 466
Control and Property Matrix . . . . . . . . . . . . . . . . . . 469
Control and Event Matrix. . . . . . . . . . . . . . . . . . . . . 471
Grid/Custom List
Option Button
ProgressBar
Select CBX
Tab Button
Check Box
Animation
TreeView
Text Box
UpDown
List Box
Control
Bitmap
Graph
Slider
Label
Object or Control >
Method
AbortCellChange •
AbortRowChange •
Add •
AppendAdhocFilter •
AppendContextMenu • • •
AppendDefaultSort •
AppendItem • • • • •
AppendPreFilter •
Clear • • • • •
ClearAdhocRow •
ClearAll •
ClearContextMenu • • •
ClearData •
ClearPreFilter •
Close •
ColorCells •
Contains • • • •
Down • • • •
EnableAdhoc •
Expand •
GenerateSQL •
GetAdhocRow •
GetChangedCell • •
GetChangedRow •
GetChoiceList •
GetChoiceListDefault •
GetChoiceListUserData •
GetCObj •
GetColumnControlType •
GetColumnMaxLength •
GetColumnNames •
GetCount •
GetItemText •
Grid/Custom List
Option Button
ProgressBar
Select CBX
Tab Button
Check Box
Animation
TreeView
Text Box
UpDown
List Box
Control
Bitmap
Graph
Slider
Label
Object or Control >
Method
GetLabel •
GetLastError
GetLegend •
GetList • • • • •
GetNext •
GetPoint •
GetPrevious •
GetSelCount •
GetSelected • • • • •
GetSelectedColumns •
GetSelectedItem •
HideColumn •
InsertItem •
IsColumnEditable •
IsColumnRequired •
Key •
Open •
OwnsGrid •
Play •
Refresh • • • • • • • • • • • • •
RefreshItem •
Regenerate •
RejectAdhocCellEntry •
Remove •
RemoveByItem • • • •
RemoveItem • • • • •
RemoveSelected • • • • •
ReplaceItem • • • •
ReplaceSelected •
ResetDefaultSort •
ResetPreFilter •
SaveAnyChanges •
SelectedIndexes • • • •
SelectedList • • • • •
SetAdhocCellReadOnly •
SetAdhocCellText •
Grid/Custom List
Option Button
ProgressBar
Select CBX
Tab Button
Check Box
Animation
TreeView
Text Box
UpDown
List Box
Control
Bitmap
Graph
Slider
Label
Object or Control >
Method
SetCellColoring •
SetCellFocus •
SetCellReadOnly •
SetCellText •
SetCObj •
SetContextMenuEnabled • • •
SetContextMenuVisible • • •
SetCurrent •
SetEditStates •
SetFocus • • • • • • • • • • • •
SetImageList •
SetItemOverlayImage •
SetItemText •
SetLabel •
SetLegend •
SetNewRowIndicator •
SetOverlayImage •
SetPoint •
SetRowReadOnly •
SetSelected • • • • •
SetSelectedById •
SetSelectedItem •
Stop •
UndoRowChanges •
UnSelect • • • • •
Up • • • •
UpdateItem •
Grid/Custom List
Option Button
ProgressBar
Select CBX
Tab Button
Check Box
Animation
TreeView
Text Box
UpDown
List Box
Control
Bitmap
Graph
Slider
Label
Object or Control >
Property
AppendRows R
BackColor • • • • •
BackStyle •
BorderStyle •
Caption • • • •
CObj •
ControlType R R R R R R R R R R R R R R R R R
DataChanged • • • • • • • • •
Default •
Dirty R
Enabled • • • • • • • • • • • • • • • •
ForeColor • • • •
GraphType •
Height R R R R R R R R R R R R R R R R R R
hWnd R R R R R R R R R R R R R R R
Id R R R R R R R R R R R R R R R R R R
Left R R R R R R R R R R R R R R R R R R
LegendPos •
ListCount R R R R
ListIndex R R R R
Max • • •
MaxLength • •
Min • • •
Multiline R R
MultiSelect • R
Name R R R R R R R R R R R R R R R R R R
NewIndex R R R R
NumSets R
PagingEvent R
Parent R R R R R R R R R R R R
ParentKey
Grid/Custom List
Option Button
ProgressBar
Select CBX
Tab Button
Check Box
Animation
TreeView
Text Box
UpDown
List Box
Control
Bitmap
Graph
Slider
Label
Object or Control >
Property
PromptOnSave R
Required R R
RequiredColor • •
SelCount R R
Selected R R R R
SelLength • •
SelStart • •
SelText • •
ShowLegend •
Sorted R R R R
Tag • • • • • • • • • • • •
Text • •
Top R R R R R R R R R R R R R R R R R R
TopIndex • •
TotalRows R
UserData R R
Value • W • • • • • • • • • •
Visible • • • • • • • • • • • • • • • • •
Width R R R R R R R R R R R R R R R R R R
Grid/Custom List
Option Button
ProgressBar
Select CBX
Tab Button
Check Box
Animation
TreeView
Text Box
UpDown
List Box
Control
Bitmap
Graph
Slider
Label
Object or Control >
Events
AdhocCellChanged •
Cell_Btn_Click •
CellChanged •
Cell_Click •
Cell_List_Select •
Change • •
Click • • • • • • • • • • •
Collapse •
ContextMenuDisplaying • • •
ContextMenu_Select • • •
DblClick • •
DoAdhocQuery •
DownClick •
Expand •
GotFocus • • • • • • • • • • • • •
KeyPress • •
LostFocus • • • • • • • • • • • • •
NewRow •
NodeClick •
Refresh •
RowChanged •
Scroll •
SortColumn •
UpClick •
474 Index
ClearBasic Control Reference
Up method 113 GetLabel method 131
UserData property 122 GetLegend method 132
Value property 123 GetList method 72, 102, 179, 262, 355
GetNext method 356
E GetPoint method 133
EnableAdhoc method 349 GetPrevious method 360
Enabled property 53 GetSelCount method 362
events GetSelected method 74, 104, 180, 264, 363
adhoc cell changes 227 GetSelectedColumns method 182
adhoc query 238 GetSelectedItem method 443
cell change 230 GotFocus event 62
cell click 232 Graph control
context-sensitive menu display 235 described 125–128
context-sensitive menu select 236 BackColor property 137
double-click 237 BackStyle property 139
grid click 234 BorderStyle property 140
grid column sort 243 ClearData method 129
grid control clicks 228 GetLabel method 131
grid control select 233 GetLegend method 132
grid row change 241 GetPoint method 133
keypress 315, 434 GraphType property 141
new grid row 239 LegendPos property 143
refresh 240 NumSets property 144
Expand event 454 SetLabel method 134
Expand method 441 SetLegend method 135
F SetPoint method 136
ShowLegend property 145
Field Array control, See Grid control
GraphType property 141
filter operators 333
Grid control
filters
described 147–154
defined 333
AbortCellChange method 155
prefilters 334
AbortRowChange method 157
focus
AdhocCellChanged event 227
getting 62
AppendContextMenu method 159
losing 63
AppendItem method 161
setting 50
AppendRows property 210
ForeColor property 39, 250, 299, 418
Cell_Btn_Click event 228
G Cell_Click event 232
GenerateSQL method 350 Cell_List_Select event 233
GetAdhocRow method 351 CellChanged event 230
GetChangedCell method 169, 352 Clear method 162
GetChangedRow method 171 ClearContextMenu method 163
GetChoiceList method 173 Click event 234
GetChoiceListDefault method 174 CObj property 211
GetChoiceListUserData method 175 ColorCells method 164
GetCObj method 353 Contains method 167
GetColumnControlType method 176 ContextMenu_Select event 236
GetColumnMaxLength method 177 ContextMenuDisplaying event 235
GetColumnNames method 178 DataChanged property 212
GetCount method 354 DblClick event 237
GetItemText method 442 Dirty property 213
Index 475
ClearBasic Control Reference
DoAdhocQuery event 238 UnSelect method 208
Down method 168 Up method 209
GetChangedCell method 169
GetChangedRow method 171
H
GetChoiceList method 173 Height property 54
GetChoiceListDefault method 174 HideColumn method 183
GetChoiceListUserData method 175 hWnd property 55
GetColumnControlType method 176 I
GetColumnMaxLength method 177
Id property 56
GetColumnNames method 178
InsertItem method 365
GetList method 179
IsColumnEditable method 184
GetSelected method 180
IsColumnRequired method 185
GetSelectedColumns method 182
HideColumn method 183 K
IsColumnEditable method 184 Key method 444
IsColumnRequired method 185 KeyPress event 315, 434
ListCount property 214 keypress events, handling 315, 434
ListIndex property 215
MultiSelect property 216 L
NewIndex property 217 Label control
NewRow event 239 described 245–246
PagingEvent property 218 BackColor property 247
Parent property 219 Caption property 249
PromptOnSave property 220 Click event 254
Refresh event 240 ForeColor property 250
RemoveByItem method 186 Parent property 252
RemoveItem method 187 Tag property 253
RemoveSelected method 188 Left property 57
ReplaceItem method 189 LegendPos property 143
RowChanged event 241 List Box control
SaveAnyChanges method 190 described 255–257
SelCount property 221 AppendItem method 258
Selected property 222 Clear method 259
SelectedIndexes method 191 Click event 287
SelectedList method 192 Contains method 260
SetCellColoring method 193 DataChanged property 274
SetCellFocus method 196 DblClick event 288
SetCellReadOnly method 197 Down method 261
SetCellText method 198 GetList method 262
SetContextMenuEnabled method 199 GetSelected method 264
SetContextMenuVisible method 200 ListCount property 275
SetEditStates method 201 ListIndex property 276
SetNewRowIndicator method 204 MultiSelect property 277
SetRowReadOnly method 205 NewIndex property 278
SetSelected method 206 Parent property 279
SortColumn event 243 RemoveByItem method 265
Sorted property 223 RemoveItem method 266
Tag property 224 RemoveSelected method 267
TopIndex property 225 ReplaceItem method 268
TotalRows property 226 SelCount property 280
UndoRowChanges method 207 Selected property 281
476 Index
ClearBasic Control Reference
SelectedIndexes method 269 NodeClick event 455
SelectedList method 270 NumSets property 144
SetSelected method 271
Sorted property 282
O
Tag property 283 Open method 20
TopIndex property 284 Option Button control
UnSelect method 272 described 317–318
Up method 273 Caption property 319
UserData property 285 Click event 324
Value property 286 DataChanged property 320
ListCount property 85, 115, 214, 275 Parent property 321
ListIndex property 86, 116, 215, 276 Tag property 322
LostFocus event 63 Value property 323
OwnsGrid method 367
M
Max property 327, 393, 459
P
MaxLength property 301, 420 paging, in grids 149, 335
Min property 328, 394, 460 PagingEvent property 218
multiCBX control Parent property 29, 41, 88, 118, 219, 252, 279, 303,
321, 402, 422
defined 335
paths, specifying 333
getting the contextual object 353
Play method 21
setting the contextual object 383
prefilters
MultiLine property 302, 421
See Also filters
Multiline Text Box control
adding 343
described 289–291
defined 334
AppendContextMenu method 292
ProgressBar control
BackColor property 297
described 325–326
ClearContextMenu method 294
Max property 327
Click event 312
Min property 328
ContextMenu_Select event 314
Value property 329
ContextMenuDisplaying event 313
PromptOnSave property 220
ForeColor property 299
KeyPress event 315 R
MaxLength property 301 Refresh event 240
MultiLine property 302 Refresh method 49
Parent property 303 RefreshItem method 368
Required property 304 Regenerate method 369
RequiredColor property 305 RejectAdhocCellEntry method 370
SelLength property 306 Remove method 445
SelStart property 307 RemoveByItem method 75, 105, 186, 265
SelText property 308 RemoveItem method 76, 106, 187, 266, 372
SetContextMenuEnabled method 295 RemoveSelected method 77, 107, 188, 267, 374
SetContextMenuVisible method 296 ReplaceItem method 78, 108, 189, 268
Tag property 309 ReplaceSelected method 375
Text property 310 Required property 304, 423
Value property 311 RequiredColor property 305, 424
MultiSelect property 216, 277 ResetDefaultSort method 377
ResetPreFilter method 378
N
RowChanged event 241
Name property 58
NewIndex property 87, 117, 217, 278
NewRow event 239
Index 477
ClearBasic Control Reference
S SetCellColoring method 193
SaveAnyChanges method 190 SetCellFocus method 196
Scroll event 397 SetCellReadOnly method 197
SelCount property 221, 280 SetCellText method 198
Select CBX control SetCObj method 383
described 331–338 SetContextMenuEnabled method 199, 295, 413
AppendAdhocFilter method 339 SetContextMenuVisible method 200, 296, 414
AppendDefaultSort method 340 SetCurrent method 384
AppendItem method 341 SetEditStates method 201
AppendPreFilter method 343 SetFocus method 50
ClearAdhocRow method 345 SetImageList method 446
ClearAll method 346 SetItemOverlayImage method 448
ClearPreFilter method 347 SetItemText method 449
EnableAdhoc method 349 SetLabel method 134
GenerateSQL method 350 SetLegend method 135
GetAdhocRow method 351 SetNewRowIndicator method 204
GetChangedCell method 352 SetOverlayImage method 450
GetCObj method 353 SetPoint method 136
GetCount method 354 SetRowReadOnly method 205
GetList method 355 SetSelected method 81, 111, 206, 271, 386
GetNext method 356 SetSelectedById method 387
GetPrevious method 360 SetSelectedItem method 452
GetSelCount method 362 ShowLegend property 145
GetSelected method 363 Slider control
InsertItem method 365 described 391–392
OwnsGrid method 367 Change event 396
RefreshItem method 368 Max property 393
Regenerate method 369 Min property 394
RejectAdhocCellEntry method 370 Scroll event 397
RemoveItem method 372 Value property 395
RemoveSelected method 374 SortColumn event 243
ReplaceSelected method 375 Sorted property 90, 120, 223, 282
ResetDefaultSort method 377 Stop method 22
ResetPreFilter method 378
T
SelectedList method 379
Tab Button control
SetAdhocCellReadOnly method 381
described 399–400
SetAdhocCellText method 382
Click event 405
SetCObj method 383
DataChanged property 401
SetCurrent method 384
Parent property 402
SetSelected method 386
Tag property 403
SetSelectedById method 387
Value property 404
UnSelect method 388
Tag property 30, 42, 91, 121, 224, 253, 283, 309, 322,
UpdateItem method 389 403, 428
Selected property 89, 119, 222, 281 Text Box control
SelectedIndexes method 79, 109, 191, 269 described 407–409
SelectedList method 80, 110, 192, 270, 379 AppendContextMenu method 410
SelLength property 306, 425 BackColor property 415
SelStart property 307, 426 ClearContextMenu method 412
SelText property 308, 427 Click event 431
SetAdhocCellReadOnly method 381 ContextMenu_Select event 433
SetAdhocCellText method 382
478 Index
ClearBasic Control Reference
ContextMenuDisplaying event 432 UpClick event 464
DataChanged property 417 Value property 461
ForeColor property 418 UserData property 122, 285
KeyPress event 434
MaxLength property 420
V
MultiLine property 421 Value property 31, 43, 92, 123, 286, 311, 323, 329, 395,
Parent property 422
404, 430, 461
Visible property 60
Required property 423
RequiredColor property 424 W
SelLength property 425 Width property 61
SelStart property 426
SelText property 427
SetContextMenuEnabled method 413
SetContextMenuVisible method 414
Tag property 428
Text property 429
Value property 430
Text property 310, 429
Top property 59
TopIndex property 225, 284
TotalRows property 226
TreeView control
described 435–437
Add method 438
Clear method 440
Collapse event 453
Expand event 454
Expand method 441
GetItemText method 442
GetSelectedItem method 443
Key method 444
NodeClick event 455
Remove method 445
SetImageList method 446
SetItemOverlayImage method 448
SetItemText method 449
SetOverlayImage method 450
SetSelectedItem method 452
U
UndoRowChanges method 207
UnSelect method 82, 112, 208, 272, 388
Up method 83, 113, 209, 273
UpClick event 464
UpdateItem method 389
UpDown control
described 457–458
Change event 462
DownClick event 463
Max property 459
Min property 460
Index 479
ClearBasic Control Reference
480 Index
ClearBasic Control Reference