2017년 6월 18일 일요일

Spinner component lacks many properites #211


The Spinner needs properties added:
⦁ enabled
⦁ background color
⦁ font bold/italic/size/typeface/color
⦁ text alignment
⦁ height
⦁ BeforeSelecting event and handler
The most critical is probably the BeforeSelecting handler, which will allow elements to be set when the Spinner is pressed. The ListPicker has this feature.

--
BTW, #132 needs to be done as well when these other items are added, or before. That's a pretty annoying issue too...

--
I'm going to look into this! I'm Jay from Open Academy '15.

--
Thanks!

--
Jay... I'm one of he people that brought this up... if you need some
testing on this set of thing, email me...

--
Would like to add a property to this please! A count of total items in spinner list...

--

--
added to confirm label because some work has been done on this, but not sure what was or was not merged.

--
--

Spinner AfterPicking invoked even when no item selected


Spinner AfterPicking immediately invoked even if it has not been opened.
Steps:
Drop Spinner component onto designer
For its ElementsFromString, enter csv values such as a,b,c,d,e
Add in a label; e.g. Label1
From BlocksEditor, Select, Spinner1.AfterPicking handler
In there, set Label1.Text to Spinner1.Selection.
Connect the companion and you'll notice that immediately Label1.Text will be set to a

--


--
should this issue be closed now?

--
Jeff said he tested and merged PR 134, but I'm not sure if this is fixed. I asked him but haven't heard back yet... It's a pain though... I've been working a lot with spinners lately and this AfterPicking, and when it's triggered is really annoying.

--
Jeff, Did you fix this as part of working on PR 134?

--
Yes, this is fixed. Keep in mind that it isn't in the release yet, just in the master branch.

--
Great... Yes, I know merged and released... I'm still content it's merged
as it means we'll see it fairly soon... Thanks Jeff... Another one off the
list... congrats!

--
Thanks! I thought that might be the case.

--

Spinner bug - Single item lists fail to update Selection or trigger After Select


I believe this is a bug in the Spinner component.

When presented with a list of only one Element, it will allow
you to click on the one item in its Elements list,
but ignore that selection.

A list with only one element in it is still a list,
and should be treated no differently than a list with
more than one element.

I am working around this by adding code to check for
Spinners with single choices, and heading off their misbehavior
by disabling them.

--
I can see the behaviour. The problem seems to be that the spinner believes that the only element is already selected, and that's why it does not trigger the event. I don't know if this is by design, but I'll have a look at the Spinner in the SDK and see what I can find out.
That is the normal behavior.
Recommendation is to have first item something like:
"Make Selection"

--

If the first element is supposed to be the prompt,
what is the function of the Prompt attribute of the Spinner?
(See attached Designer screen shot)

--
If the Spinner is designed around a particular usage,
(expecting a Title element as the first element,
and assuming it is to be ignored), the documentation
for the Spinner should mention that, perhaps in a
Usage section.  It is not at all obvious, and alternative
usages are entirely plausible to the uninitiated.

The easiest fix here would probably be to the documentation and
tool tips.

--
The prompt is what gets displayed as title
--
Thank you for posting about this. I was trying to use the spinner to select items from a list to be deleted and this behavior confused me a lot. 

--

New option "Settings" in the menu


I have seen, there is a new settings option available in the menu, which is empty after selecting
how can we access or modify that?
I did not find any new properties in Screen1?

--
Is that in the Companion only? Or can you see it when you build an app?

--
In any case, there's no way to access it or program it, at least for now. But I believe it's just a glitch in the Companion.

--
This is a hack for the Companion. The whole menu itself is setup in Form.java. The extra settings option is defined in ReplForm.java. It interacts with the hidden PhoneStatus block, which itself contains a lot of the Companion magic...

At some point we could use a real menu component.

--
So could we maybe add those manually in those files?

--
FWIW, I noticed the Settings menu option yesterday as well.  However, once I loaded the app to my phone, it was no longer available.  It may only show up when connected using the companion app.

--

Menu options in app inventor


When clicking a MENU button on the phone with our developed app
  
the menu items will be displayed and its operations are performed well

The requirement look like  attached pictures



--
this is not available in MIT App Inventor, but in the personal servers

Image not visible


Why not see the button?
picture size 512х512


--
Try adding it on Screen.Initialize ?

Difficult to know without seeing blocks and how the app loads....

-- 
Make a smaller image between 32-64 px for that area


-- 
I made picture 50px.
but to no avail.
may have another solution?

-- 
try this one
-- 
Thank you, Boban Stojmenovic.

but it didn't help (((


-- 
* Tim Carter


-- 
Do you see this only on your phone, or also in the emulator? If you see it in both, then you may be tripping on a bug that we have fixed for the release coming later tonight. Try exporting your AIA and importing it to the server at http://rc.appinventor.mit.edu and use the associated companion app (see Help > Companion Information to get the download URL).

-- 
This also happens on my phone Samsung S3 in both companion and apk, works perfectly on RC server....

-- 
Oddly, i also had problems earlier today viewing images (button images worked but arrangement and screen images didn't) in my Genymotion emulator for HTC One phone. Switched to Nexus 7 emulator and it worked

-- 
*Еvan Patton





-- 
not visible on a smartphone

-- 
strange for me it worked, did you install the associated companion app

-- 
Yes, of course
visible on an Emulator (associated companion app)



-- 
can someone help to fix


-- 
Works in my Genymotion emulator using a Nexus 7 (Ai2 Companion), and also on my smartphone (HTC One) using AI2 Companion.

One thing I noticed, Clock2 is set to always fire on start of app, this is related to BtnMove?

--
opposite impact for me, companion crashed on two of my four phones

this is a killing image for phones/tablets with higher device density than 1, I suggest you read how images works in App Inventor.


-- 
@Tim Carter
when my app start clock2 is false.

when I use the emulator image visible.
when I use the .apk file on my smartphone pictures are not visible.

@Boban Strojmenovic
Pictures reduced to 100 pixels
but the problem persists on a smartphone or a tablet (not the emulator or AI2 Companion)

app inventor page is not opening


I have been trying to open tha app inventor page and its not opening since this morning. look at this link
http://ai2.appinventor.mit.edu/. why is this happening?

--
this is the screenshot of it. PLease help!


-- 
I checked in other systems. Its opening in them. Its not opening only in my system.

-- 
If you know it's your computer, then have you tried resetting Chrome to default settings? Did you try Firefox? Checked for malware? Reset your router?

-- 
Looking at the text in the image, it looks like you may have Kaspersky Anti-Virus (third line, roughly middle of the page) and it is garbling the response from the server. Try disabling any Kaspersky extensions in Chrome temporarily to see if it resolves the issue, or try another browser as Italo suggested. You can also try private browsing mode in Chrome.

-- 
Shiva Kumar replied by private email:
I made it work. I just had to clear all the history and cookies. It opened after that. 
In the future, please reply in the forum and not by private email. 

-- 

Fusion Tables updating problem


I had made a reporting app which updates the feilds in fusion tables problems:-
1) I am trying to update 2 fusion tables in a single app. although through different screens. 
2) I had created two different service account key and linked to respective fusion table and initializes global variable in different screens of apps.
3) First screen is working and fusion table gets updated as I hit submit .
4) But when submit in second screen is hit it is asking for signing on ?
5) can one service account and p12 key be assuciated to both fusion table and screens of the app.
Please help.

--
My two tables have seperate table url, table id and p12 key . I had initialized this separately in their individual screens but first screen is working second is not.

-- 
Screen shots of the blocks of two different screen in one app



-- 
Show us the properties of the all the Fusion Table components,
in each screen.
(See attached for example.)

Also show us how you are processing the .GotResult events,
and show the error message screen shots to help ID the exact error.

See the Fusion Tables section of this FAQ for diagnostic help ...



-- 

ABG for response resolved the problem as I was not initialising the service account in the second screen I had the problem now its working well tx.

-- 

nEW PROBLEMS ARISING NOW i HAD CREATED A SEPERATE APP FOR ADMIN TO VEIW THE FILTERED OUTPUTS BUT IN VERY FIRST STEP THIS ERROR OCCURED . I AM TRYING TO SORT IT OUT BU ANY HELP WOULD BE APPRECIABLE .

-- 

Loop wthin a loop only integrating once- think I have it in the wrong place?


I'm working on an app that creates a triangle using text.  The app can either create a right angle triangle from astericks, or an isosceles triangle that is inverted and NOT a right angle.

The user inputs the length of a/the triangle side.

I'm getting everything to function, except the space used to center the triangle only iterates once, stumped on why my placement is incorrect.  Including screen shots and aia.





--
To get indentation of the triangle,  you have to change the JOIN used to add a '*'.
Add an extra layer to the inner JOIN, to make a 3 layer sandwich:
  a blank,
  the variable,
 a star.

By the way, you can rename the loop variable, for clarity's sake.

-- 
Are we talking three layers like a sandwich, or three layers all inside each other, like a turducken? ;)

-- 
Tried this out and it places all the spaces at the front of the triangle....

Clearly I need more than two hours of sleep and half a cup of coffee.....



-- 
Oops, sorry - I gave you bad advice.

My advice would cause the triangle to skew.

For an isosceles triangle you would need the indentation to increase as the width of the triangle decreases.

The width of the triangle would need to change at twice the rate of the indentation, otherwise it would be a right triangle.

You can verify this with a piece of graph paper.

There is a handy segment block in the text blocks that can be used with a long string of blanks or stars to create arbitrarily long strings of blanks or stars,
to eliminate the need for nested loops.

Given that, all you need is a pair of formulas for the number of blanks (for indentation) and stars 
based on the height up (or down) the triangle of that row.
The formulas should be linear.

-- 

General Issues with developing apps


My students are all completing coursework and are experiencing various issues with using App Inventor, it seems that when the students create large programs, the app does not load, or will load and then they click on a button / switch screens and the apps crash once more. I'm having real difficulties with this program when playing the app, simple code will load one time, then will crash. The errors are so erroneous that I can't put my finger on any single one. Are there any hints, tips or tricks / help that I can use to solve these problems?

--
The tips and tricks are mostly in these resources, they help developers to use the AI2 tools  A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook   http://www.appinventor.org/book2 ... the links are at the bottom of the Web page.  The book 'teaches' users how to program with AI2 blocks.

There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro  and the aia files for the projects in the book are here:  http://www.appinventor.org/bookFiles  

How to do a lot of basic things with App Inventor are described here:  http://www.appinventor.org/content/howDoYou/eventHandling  .

Most frustration occurs when developers violate one of AI's basic rules which include:
1) Always check for coding errors (the red and yellow triangles on the lower left of the Block screen)
2) Save aia files frequently (and with different names) and ensure the aia is smaller in size then 5Mb.
3) Do not use more than ten screens ever and use only one if you can using Horizontal and Vertical Layouts and setting the Visible property to true or false to show or hide them.
4) Streaming video or music while developing make the blocks work slower; lots of open browser windows do the same.
5) When you have lots of blocks and objects, disconnect from live development (WIFI/emulator/USB) and make changes to graphics having a little faith in the Designer, then go back to live development.  App Inventor wants to refresh when text is changed in a label or button or you change a color and the device or emulator graphics refresh...sometimes this is like the doldrums.  Disconnecting and coding 'blind' greatly ameliorates the 'bad' graphic refresh issues.

Developers most frequently have the following issues that create issues when live developing or creating the apk (compiling)

1)  You have coding errors in your blocks.  In the Blocks editor, look in the lower 
left corner of the window for the yellow and red triangle icons. If the red icon has a value larger than 0, 
you have a serious coding error.  Find the block in your code that has a red triangle and 
fix it.   Red triangles always inhibit creating an apk or running a project in the 
emulator or possibly creating an aia file.     Yellow triangles are more forgiving, 
however, sometimes, these need to be fixed because they trip an internal warning and not filling puzzle piece sockets that are left un-filled can sometimes cause issues if the app needs a value that is not filled.

2) Your source file (the aia file) is larger than the 5Mb limit allowed in AI2 (the aia can not be larger than 5Mb). You may have put images or other resources in your Media (resources) that you do not use in the app.  All the images and sounds in resources count toward the 5Mb limit along with the source code.    You can program apps larger than 5Mb in the browser, but the apps will not compile and might not run in the emulator or the project may not save as an aia. If this is the case you need to reduce the size of your image and/or sound files.   Most image files can be made quite small by resizing them using a photo manipulation program on your PC to less than 50Kb each.

3)  You might have more than 10 Screens in your app.  AI2 becomes unstable when more than ten screens are used.  Projects CAN be built with slightly more screen but then you should expect your app to occasionally behave erratically.

4) You might have set a Screen icon in the Designer Properties for your project that is too large. Use an image size of 48x48 px  instead and only use jpg or png images.  *.ico files are not supported.  The 'icon' (actually an image) Google Play requires when posting needs to be 520x520 for their display.  The smaller 'icons' work for the app's icon (the one shown on the device's screen that is pressed to activate the app.

5) You did not code the entire project using App Inventor 2.   If you used one of the third-party AI2 clones,you might not be able to load a Project into the AI2 compiler or create an apk with the standard AI2.

6) If you incorrectly modified the project's Manifest files using a third-party tool, you may have issues returning to MIT App Inventor.

7)  Sometimes, if you have LOTS of Layouts on a single screen,  the apk might not compile. How many is a lot?  I do not know, keep adding layouts and buttons, compile and try again...when the server crashes, you got a lot.

8)  The network you use may be overloaded (possibly a school network), or you have other applications running in the background on your computer, or your virus checker is doing a scan.  Sometimes, just trying to access the MIT server a few minutes later will give you a more favorable response.

9) Do you have BlueStacks on your PC (BlueStacks is a special emulator that allows Android apps to run on a PC)?  The Google emulator on AI2 cannot run unless BlueStacks is disabled and all of the BlueStacks processes are shut down.  On a Windows PC, you use the Task Manager to 'kill' running processes.

10)  Are you using Sensor controls (except for the clock)?   Most Sensor controls or controls related to sms or the phone do not work in the emulators.  This includes the LocationSensor and Accellerometer.  These components need to be tested on a device.

11) If this is an issue about the Project loading slowly on your device or on the emulator:  Be aware, the more images, layouts, components you have on a screen, the longer it takes for the emulator and Companion to render the graphical screen.  How fast the emulator renders is partially a function of your hardware...how much ram you have, your cpu clock speed etc. Sometimes, with lots of graphics, the emulator will just give up.   Can you develop live using WIFI or using USB? These options almost always render faster than the emulator but will not be at lightning speed if you have lots of graphics.  Be patient.

12) We have seen instances where it is probable the Google Cloud messed up; other instances where an older PC has had memory issues and caused file corruption of the Project and instances where a user is using a very slow Internet connection (like dial-up) and it is just too slow.

13)  Do you have an AVG, Eset or AVAST virus checker.  Some versions of these products have been reported inhibit running the emulator unless (in the case of AVG) the Advanced Link settings on the software are set to allow AI2 communication.

14) Do you get the error:  The blocks area did not load properly. Changes to the blocks for screen xxxxxxx_Screen1 will not be saved.  One user had this error, the problem was he had too many comment boxes exposed at once for the browser to handle.  Try minimizing all blocks, and opening in another browser,like Chrome or Firefox.

16)  Having issues getting AI to run at all, perhaps your firewall is blocking.  Don't turn your firewall off, just allow AI2 to pass unhindered..some firewalls have the ability to allow or deny certain urls.

17)  If you get a build server busy ... It is possible the buildservers may just well be busy! If you get this message, just try the build again.  MIT currently runs 3 buildservers all the time. They occasionally add a 4th or even a 5th. There is a load balancer which distributes work to the buildservers. If you get the "busy" message, either the load balancer could not find a buildserver with available resources or the the buildserver it assigned the request to decided it was too busy.  The solution is to just try again, either immediately or in a few minutes.  If this message persists, then something might be broken and you can report it on the forum.   If something IS broken, MIT will find out about it soon enough!

18)  If you have excessive resources, you can look at what is in the emulator. In both in the Companion via WiFi and in the emulator, with the emulator "up" you should be able to go to: http://127.0.0.1:8001/ on the PC running the emulator. Going to that url should show you a small (possibly empty) directly listing (it will be a list of the assets that are used in the emulator).

19)  You might have used an alpha character in the app's Version number.  The version number must be all numerical digits.  Use of an alpha character will spawn a generic error message on attempting to compile.

If the connection times out, that is a problem! The aiStarter program uses the "adb" program (in the "commands-for-AppInventor" folder) to setup "tcp port forwarding" from the PC to the emulator on port 8001. This command could be failing for you. Make sure you don't have security software that is blocking the action of the "adb" command.

19)  The problem could be something else, like running an old version of Companion ...if this is the case the cure might be:   Projects > Hard Reset.  If there are Companion issues, a pop up should appear (if no issues, nothing will happen...just smile). However, sometimes you need to close your browser and reload your project to update Companion.  When the pop up appears, follow the instructions very carefully, then reboot your PC and try again.

20) If this is a connection issue with WIFI: If the device is set up to be used with USB, the Android cannot be used with WIFI unless the Settings > [developers options]  in the Android  box next to  USB debugging is unchecked.  
  
Some users try to use their phones BOTH with USB and WIFI.  That can be done.  To use the live development USB option the developer must have the USB debugging box checked.  If developer later wants to use WIFI the USB debugging box should NOT be checked.   If you switch from USB and then to WIFI, you may have to close and restart your browser to release cache items that tell App Inventor your are connected to USB or WIFI when that is not the case.

21) Parse Error:  The most common cause of a parse error is the device has run out of storage.   Do you have  lot of apps on your emulator? or Device? Try freeing up space there (clear the TinyDB perhaps-TinyDB.ClearAll), and see if that helps.

A second type of parse error may occur while attempting to update the emulator:  When I got the "parse error" message in the emulator, I fixed it by..
- uninstalling the tools via the Control Panel
- rebooting
- re-running the install file, but this time by right-clicking on it and running as an administrator
   
22)  Do you have lots of Windows open on your browser or are you streaming music or video?

23) Large bmp files ( 1 to 2 MB in size, 800 x 1500 pixesl)loaded into a button the is 50 x70 pixels will cause Companion to fail when loading a project.  The issue is AI2 must compress these to the small size to make them fit in the small area.  The solution is to make these files 50 x70 pixels (or however large they must be in on the Android).

24) ai2 reports "Server error. Could not save one or more files."
Clear your browser's cache.  Close the browser, then load it again.  Try to build again.  Sometimes switching from Chrome to Firefox or the reverse performs a miracle and corrects an issue related to the browser cache.

25) for extension developers: The current best practice is to have a package per extension that contains all classes required for the extension so you may want to split up your classes accordingly. 

Several very different things seem to evoke the package installer has stopped message.1) Using a app icon larger than 48 x 48 pixels (the png or jpg image you use to identify your app on a device set on the Designer screen). will evoke this issue.  Use a 48 x 48 jpg or png image. This is a very frequent issue that evokes the error.2) Removing unused files from Media (even though the aia is less than 5Mb) has cured the issue.3) If the apk installs on other phones, but not this one perhaps there isn't sufficient space on the phone.  If the apk installs on other phones, it is not an issue with the  apk. You may have too many apps on your device.
:
Hope this helps.   Others on the forum probably have other 'suggestions.".

--
Wow, This should be a sticky. Great compilation Steve.

--
I agree.   Great list, Steve.

--
Thank you so very much for this extensive list, the time you have taken to reply... I am very grateful! I am going to look through my students' projects and use these to diagnose issues.
All the very best regards,

--

Blocks won't load!


I don't know what to do! I keep getting this error message when I try to do anything!
The blocks area did not load properly. Changes to the blocks for screen 6080492099862528_Screen1 will not be saved.

--
is this a large project? how many screens do you have? loads of blocks?
you project seems to be corrupted somehow
import your latest backup and restart from there

see the following general tips and in your case especially #3 and #6

1. Use different screens wisely
Before starting to create another screen, first you should think about is it really necessary? See also Building apps with many screens and SteveJG's post about advantages/disadvantagesbecause in only one screen you also can use vertical arrangements to simulate different screens, just set the arrangements to visible = true/false as needed... See also Martyn_HK's example about how to use Tabs in AppInventor and another example from Cyd


2. App Inventor works best if you use images whose size matches the size you want them to appear on your screen. If you import larger images into your app, your app may run out of system memory. Using Images with App Inventor

3. Avoid redundancy
Probably it helps to read chapter 19 - 21 in Dave's book http://www.appinventor.org/book2 to get an idea how to do DRY programming with App Inventor - Don't repeat yourself 




-- 
Also make sure that you are using Chrome, Firefox, or Safari. Currently we do not support Internet Explorer or Edge, and you will get this error every time if that's the case.

--