Suppressing the Clear Button in MobileTextField

Does anyone know of a way to suppress the clear button (the little ‘x’) that appears when editing a MobileTextField?

You can’t turn it off.

Save the contents in a variable and when the TextChanged event fires and the contents are empty, restore the textfield text from the variable.

uh, you can turn it off with a declare…

In the control’s Opening event:

Declare Sub setClearButtonMode Lib "Foundation" Selector "setClearButtonMode:" (obj As ptr, mode As Integer)

setClearButtonMode(Me.Handle, 0)

Modes are:
0 = Never
1 = While Editing
2 = Unless Editing
3 = Always

1 Like