Custom Textfield: Join custom Text() Property


I created a custom Textfield with a Text-Array “mErrors”. After validating, i wanna show a Messagebox with all Errors. Because of the main Text Property of Textfield the following Code is not working. How to fix ist?

[code]Dim mErrors() As Text = Array(“First Error”, “Second Error”)
Dim mOutput As Text = Text.Join(mErrors, EndOfLine.Operator_Convert.ToText)

MsgBox mOutput[/code]

What is the error?

Type “String” has no member named “Join”

Text.Join thinks i mean Textfield.Text, but i mean Text.Join

What is Text() ?

Text is the Text Type of the new Xojo Framework (look at the Join sample at the End)

I already encountered last week an issue with EndOfLIne, which appears not to be a string, but to be a class. So ToText does not work.

I think it is necessary to go through an intermediate string, such as :

Dim endof as string = EndOfLine dim EOL as Text = endof.ToText Dim mErrors() As Text = Array("First Error", "Second Error") Dim mOutput As Text = Text.Join(mErrors, EOL)

It’s not working. Try by yourself:

  1. create Subclass “Test” of TextField
  2. add Property mErrors() As Text
  3. add some Entries to mErrors
  4. try your Code

Text.Join thinks, Text = TextFields.Text, but it is Text of new Framework :confused:

This is a naming conflict and I don’t see a way to specify the Text type over the Text property.

You could create your own Join wrapper for Text type in a Module.

Function Join(extends items() As Text, seperator As Text) As Text return Text.Join(items, seperator) End Function

Use like

Dim mOutput As Text = mErrors.Join(EndOfLine.Operator_Convert.ToText)

Thanks Will and Michael, that’s a working Solution for me.

You are right, the compiler does think Text is the string property.

I would try creating the class on a ContainerControl so the confusion could not happen, since TextArea would be just a control, and the code would be attached to the ContainerControl.