2017년 6월 7일 수요일

Expecting TextBox component but got a YailList instead


I am using App Inventor 2/Windows 7/Chrome/32.0.1700.107 m

I created a profile screen with many textboxes and checkboxes and I store the settings in a TinyDB. (using standard elements I had this working for a few text/check boxes)
To make it easier to manage a large number of entries I want to use the Any TextBox and Any Checkbox components.

1. I created variables initialized as an empty list for AllTextBoxes and AllCheckBox
2. In the screen initialization I add each TextBox to the list AllTextBoxes (same for checkboxes)
3. When the user clicks Apply I run a procedure "updateDatabase" 

"updateDatabase" is supposed to cycle through each TextBox in AllTextBoxes and do the following:
⦁ First it determines if the textbox text is empty. It either stores the value "none" or the existing value to a variable called text
⦁ Then it sets the TextBox.Hint = text
⦁ Next it adds "text" to a new list called StoreValue
⦁ Last it sets the TextBox.Text to " "
Then it should go through the rest of the AllTextBoxes list before running a similar process for AllCheckboxes and the finally storing to the TinyDB.

When I try this I get the following error:

Problem with application 
Property getter was expecting a TextBox component but got a YailList instead.

Please SEARCH in this forum before posting your question.   There's a good chance your question has already been asked.

If you are asking for technical help, you must provide the following information:
- Are you using MIT App Inventor Classic, MIT App Inventor 2, or something else (what?)
- What OS are you using? (e.g, MacOS 1.8, Windows 8, ...)
- What browser are you using (e.g, Chrome version 30, Firefox 24, IE 8, ...)
Also provide as much information as you can, such as screenshots and instructions that will let others duplicate the issue.

--
Your problem is that in the "do" part of your "for each item in list" block, you are using "get globalAllTextBoxes" in four occurrences where you really want to use "get item".  The former refers to a list of components, while the later refers to one of the components in the list in each iteration of the loop. 

--
THANKS!!  That was it! I didn't realize I needed to hover over item to use it. It seems to be working great now and so much better than calling each text/checkbox individually.  I wish I had used this method in other apps.

--

댓글 없음:

댓글 쓰기