I have a TEXT constant of the window labeled TA_INFO
This code results in an error message:
[quote]Dim axOneLine() As Text
axOneLine = Self.TA_INFO.Split(EndOfLine)[/quote]
The line
axOneLine = Self.TA_INFO.Split(EndOfLine) throws an error message
Error Message:
There is more than one item with this name and it’s not clear to which this refers.
After stumbling around trying to understand what this error message is trying to tell me, I can “fix” this problem with the code below
[quote]Dim axOneLine() As Text
Dim LF_Text as Text
Dim LF_String As String
LF_String = EndOfLine
LF_Text = LF_String.ToText
axOneLine = Self.TA_INFO.Split(LF_Text)[/quote]
But I still not not understand what that error message is all about and why the line
"But I still not not understand what that error message is all about and why the line
throws an error"
Ultimately the reason for the error is that someText.Split(someParameter) expects someParameter to be Text not a String. EndOfLine returns a String. You have to make sure that what you pass is a Text variable not a String.
You might think that you could get away with passing EndOfLine.ToText but you cannot. EndOfLine is itself a Class and not a String variable and the construct EndOfLine.ToText is not allowed.
It is possible, as Lefebvre pointed out, to pass EndOfLine.Unix.ToText because EndOfLine.Unix is a String and EndOfLine.Unix.ToText makes it Text.
So we have established that
is erroneous.
The actual error message that you are given to work with is
“There is more than one item with this name and it is not clear to which this refers”
That is not a very helpful error message. At least for me.
did not you define another Split function ( using an extends keyword or for another data type) ?
this messages occurs sometimes when I have such multi definition for the same method.
[quote]did not you define another Split function ( using an extends keyword or for another data type) ?
this messages occurs sometimes when I have such multi definition for the same method.[/quote]
No, nothing like that. It is simply the presence of a String variable as a parameter when Xojo expected a Text variable that triggers this error message in this case.