First crack at Xojo. Doing the Web QuickStart to build YouTubePlayer. Followed all the instructions. On run, get an error PlayerPage.LoadVideoButton.Action, line 1"Can’t call something that isn’t a function" IDField.Text
What’s wrong?
First crack at Xojo. Doing the Web QuickStart to build YouTubePlayer. Followed all the instructions. On run, get an error PlayerPage.LoadVideoButton.Action, line 1"Can’t call something that isn’t a function" IDField.Text
What’s wrong?
isn’t a function… its an event.
it is called automatically when you click on the “PlayerPage.LoadVideoButton”
Still lost. The instructions say: “Now you need to load the video and there are two parts to this:
The video ID that the user typed is stored in a property of the Text Field class called Text. You access property values by specifying the name of the class, followed by a . and then the name of the property. In this case the Text Field is called IDField so you write: IDField.Text”
I did that. Followed by You need a convert this ID into an actual YouTube video URL and tell the YouTubePlayer to load it. You can do that with this code:
YouTubePlayer.URL = “https://www.youtube.com/watch?v=” + IDField.Text
I did that.
Follow by Click the Run button in the toolbar to run your project. The web app opens in the default web browser.
I did that and got the error PlayerPage.LoadVideoButton.Action, line 1"Can’t call something that isn’t a function" IDField.Text
Are the instructions wrong?
Is IDField the name of a textField?
Did you miss a step?
[quote]Setting the Properties for the Text Field
The Text Field is where your user will enter the location to display. You want to change the following properties: Name and Locking
The only code you need is:
YouTubePlayer.URL = "https://www.youtube.com/watch?v=" + IDField.Text
You don’t need to put IDField.Text as a separate line of code as it is incorporated into the above line.
Thanks Dave, Jim and Paul. I removed the line of code: IDField.Text and ran it. it works now.
I took the instruction “In this case the Text Field is called IDField so you write: IDField.Text” very literally. I think the tutorial should say: In this case the Text Field is called IDField written as IDField.Text. You can use that in the following code: YouTubePlayer.URL = “https://www.youtube.com/watch?v=” + IDField.Text
Now that you have explained it, it seems that the code to be written is always in that gray box, but to a neophyte, that wasn’t obvious. It just seemed to me that Xojo might have required a declaration of IDField.text before it could actually use it. But that isn’t the case.
Hard to start from zero. Good there are people here to help.
Thanks to all!
Ah! I do see how that could be misleading. Glad you got it working.
I’ll tweak the wording.
IDField.Text consists of two parts. IDField is the name of the control on the layout, so that is where is is declared. The “.Text” part refers to a property of IDField.