2016년 11월 20일 일요일

Taifun File Extension


The problem is that if you use the Taifun File extension in a screen other thatn Screen1, and Screen1 just opens another screen immediately (althouth I am not really sure this is relevant, but in my own app that is what is happening too), then there is a compile error on Screen1.
There is an easy workaround by adding the extension in Screen1.
Here is a link to a user app that has other problems, but also this one: https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/mitappinventortest/Fk3ubR-Y8Aw/ieR39xLsBwAJ
I have an app with this problem too, but it would take work to share it. It should be easy to recreate though.
Anyway, GREAT and useful extension!
Cheers, Ghica.



-- 
I'm glad, that you like my extension.

I just tested this and it works fine for me (see attached test project)

Please prepare an example as small as possible, which demonstrates this issue and add the project (aia file) into this thread together with exact instructions for how to elicit the error, so I can take a look

Taifun

Trying to push the limits of App Inventor! SnippetsTutorials and Extensions from Pura Vida Apps by Taifun. 




-- 

Open your project. Start the companion. It will jump immediately to Screen2 and give this runtime error.
Cheers, Ghica.

-- 
I now used another device to test this and can confirm the issue there
this seems to be a companion app issue...
just try to build the app and the issue should be gone.

@Jeff?

Taifun

-- 
I have been able to reproduce this problem using one of my own extensions. The problem is limited to the Companion and is a pretty degenerate case. I'll investigate (though it isn't my highest priority issue...).

-Jeff

-- 

uploading Apache (Xampp) PHP file with app inventor



I have trying to upload a PHP code using WEB tag, Below is my PHP code.

<?php
$userName = $_GET['userName'];
$answer = "Hello from the web page sideee !!!!". $userName;

echo '$answer';
?>


I just want the username to be displayed in the label present in my app.
I have been getting this error which I attached. Also I have attached my blocks code. 

I'm using XAMPP control panel  v3.2.2. Is it the issue with my PHP code ? should I add permission request to the php code for XAMPP ??.

Please help!

web.PNG 표시 중
 error.png

--
I think its a problem with the url.
Upload the php file to a webserver and than write again the new url in the urltext.

--
So, in order for this to work, you must have your PHP code (hello.php) located at c:xampp/htdocs/tutorial/ or similar
If you have that, point your browser to http://localhost/tutorial/hello.php?userName=John
What do you see?

If this works as expected, try your app again. If your name could contain blanks or special characters, you have to encode the URL before you use it to send to the server.
Use the Web UriEncode block for this:


text UriEncode(text text)
Encodes the given text value so that it can be used in a URL.

Cheers, Ghica. 

-- 
as Mika said, it's a problem with the url
localhost in this case is your device itself, but not your computer, see also here  https://en.wikipedia.org/wiki/Localhost
use the ip address of your computer instead, this usually starts with 192.168.x.x

Taifun

-- 
Thank you so much guys, 

I made few changes and I achieved my desired output! 
Thank you Taifun I added my computer IP and it worked. 
Also I made mistake in my PHP code i.e when I echoed my $answer it was in underscore. 

It works!!!!

-- 

How to use gennymotion emulator?[URGENT NEEDED]


 I had already install the gennymotion emulator. The emulator also go out.But how to connect it with app inventor? When i press emulator it will show up the stock emulator. Please help me...........
-- 
For App Inventor you need another emulator.

Click on the appropriate Link to download AiStarter:

If AiStarter is installed, follow the instructions in the following website: http://appinventor.mit.edu/explore/ai2/setup-emulator.html 

To connect Emulator with website, launch AiStarter, go on the website to the Connect menu and click Emulator.
Nico


-- 
Just treat the genymotion android guest like a real device, so use the companion app to connect. You may have to bridge the network adapter (open up settings via virtualbox) in order to get onto the same network

-- 
Yes i had install all virtual box and follow the instruction.Like in the link .Gennymotion for personal use.It is free. Awesome. Thanks again everyone.MIT apps is awesome.

-- 

app works only at one device


I have an app that is complete it works great on the emulator, and which test the phone 5x honor5 and n7. when I make apk of it the time it works only on the n7 but not in the other device .. why? is there a setting somewhere? app is simple click on the button 1 display screen 1, key 2 Screen 2, etc

-- 
When you say it doesn't work on any other device, what do you mean? Do you get an error message, you don't see what you expect? You see nothing? Be more specific please.

-- 
app crashes without notice or everything will be black and returns to the phone's main page.

-- 
Did you try it in another device besides those two?
What Android version has the device that didn't work?
Is that device's ram enough?
Do you have any other apps running and which ones?


--
• works on Nexus 7 Android 6.0.1 

• MOB30X does not work on females 5 Android 6.0.1 EMUI 4..0 (See Google Drive link) 

• does not work on nexus 5x Android 7.1.1 NPF10C (1 message app crashes) 

• app is 3mb, it consists of 15 keys that refer to 4 images (4screens) no advance app 

• there is plenty of free RAM, and no other apps running in the experiment device.

-- 
yes i fix it.
something with size on picture..

-- 

Two major problems: Change buttons text with button clicks


See text in attached file.
blocks (2).png 표시 중
-- 
I do not see anywhere where you are testing to make the textfields visible or not. Maybe I do not understand well enough what you want to do, it should be possible, but probably you are missing the right if-s.
So, what really happens and why is it not OK?
Cheers, Ghica.

-- 
That's because I had no clue on how to do it correctly. I give it a shot here (see attached file)

The outcome of this is: All buttons become visible. That's not what I want, I want only the first one to become visible, but no clue on how.
Skärmbild_2016-11-20_15-06-56.png
-- 
you need additionally an index variable, which increments inside the for each loop to get 1, 2 or 3 inside the loop
it might help to take a look again at these examples
Thank you. I will read them thouroughly and try to do it... Advanced features are hard :(

-- 
Ok.. so what I need is:

When ADD.longclick
set global split to split text: Textbox1.text at ,           <------- this is where the textlist is created.
for each component in list: get global buttons
set Button.text of component: get component
to: select list item, list: get global split
index: get index of global buttons corresponding to global split

I need a way to do the bold stuff. I can't find a index = component... See attachments aswell.

any suggestions?
Namnlös.png 표시 중
Skärmbild_2016-11-20_18-06-46.png 표시 중


-- 
Look agan at Taifun's reply. You set a global index to 0, outside the loop and within the loop you add 1 to it and use its value as the index to the list of buttons.
Cheers, Ghica


--
Yeah, I've tried that, cant get it to work... Guess I've hit my roof.

--
Look agan at Taifun's reply. You set a global index to 0, outside the loop and within the loop you add 1 to it and use its value as the index to the list of buttons.



what about providing an updated scxreenshot after trying what we suggested?
Taifun

-- 
Will do, but I've shut the pc off. I'll be back tomorrow.

Im tremendously thankful for all the help.


--

Ok, so I made two different projects for my two problems. I've uploaded screenshots and aiafiles to both. Please note they are two different problems.

1. ONEBYONE
I want the text in the text box to be added to the next text box which is visible.false. I have no clue... Am I even on the right track? Right now alla buttons get visible and get the text.

2. LIST
I want the list entered in the text box to be the text of the buttons, so index 1 of textbox list = text to button 1, index 2 of textbox list = text to button 2, etc, for the length of the list, but maximum the number of items in the button list. I've added the problem notification of this too.
BLOCKSLIST.png 표시 중

BLOCKS - ONEBYONE.png 표시 중
LISTproblem.png 표시 중

TexttobuttonLIST.aia

TexttobuttonONEBYONE.aia

-- 
WOW, I FIGURED OUT ONEBYONE! HOORAY! Now it's only LIST left. HOORAY, so happy right now!

-- 
 Snap17.png
Congratulations!
Here is the solution to the list problem.
One point to note: if you would enter 1,,2 the text for the button b would be an empty string, I think that is better than invisible, but of course you could have your if statement back and make B invisible in that case..
Cheers, Ghica.


-- 
thank you thank you thank you thank you! I had almost all the right components, just at the wrong places.

-- 
Ok, so now that I know how to do this, I've been working on how to make the buttons visible to be the next batch of buttons. Example:

APP.click (first time) - list is 3 indexes long

Button 1-3 become visible

APP.click (second time) - list is 4 indexes long

Button 4-7 become visible and gets the text, not 1-4. 1-3 stays what it was before.

I've tried to do this, see attached file. Why doesn't it work? 
blocks (2).png 표시 중
-- 
Because:
You are iterating over the button list twice, once via the component number and once using a for each. Take out the for each, and address the button in the list via an index.
You will need two indexes now. One that keeps the position in the button list, and one that you reset each time when ADD is clicked, for the split list.
(by the way, settin gobal index to get index is rather useless, you set the value of the global to the value it already has).
I am sure you can figure this out now!
Cheers, Ghica.

-- 
Haha, don't be so sure. English is not my first language, and this is the first time ever I've been programming, so I'm figuring it out as I go, and I love it.

"address the button in the list via an index" - what does that mean? which block?

Should I remove both For each?

"One that keeps the position in the button list" - how do I?

I do thank you though, for using your precious time on me :) I am lost, but learning so much.


-- 
I have somewhat of a feeling that this would work to?
Namnlös.png 표시 중
-- 

Snap19.png.
If you would make the list in a proper way, maybe. Now you are making a list of one element??
But look at the attached blocks. I think they should work, but I have no time to try right now.
Cheers, Ghica.

-- 
Thank you! Your blocks didn't work right away, but it gave me a push in the right direction. Now it does exactly what I want, but I get two error messages (see attached files). The first is every time I add a list and the second is when the length of the buttonindex exceeds the length of the button list. Maybe there is a way to get rid of them, I gave it a try with the logic and block you see to the right.


1.png 표시 중


2.png 표시 중

3.png 표시 중
-- 
This is because you are trying to read past the end of the list, as the error message says. In my blocks, that was not possible, so why it did not work?
You should set the button component within the if, (after you have tested that the index is within bounds)
Cheers, Ghica.


--
Hmm, I really don't know why yours didn't work, I double checked the blocks, but it didn't give the wanted result :S

Ok, I set the button component within the if, it stopped the error message number 2, with the big list. Error message number 1 still shows. And the button index keeps increasing, this is not good, if I wanna add another list.


--
 Snap20.png
Shame on my face. There were indeed some problems. 
I did not increase the splitindex, I should have used number to use as button index, and save the buttonindex only when the button will be visible.
It works now, I tested it.
I made some changes and therefore I add the .aia: I made the screen scrollable, so  you can see the last buttons. And I made a reset button, so you can start over without restarting the app.
Cheers, Ghica.

--  
Thank you :) This is fantastic. 

Ooooooone last problem with this. IF:



This is only a small part of a bigger app I'm building. When it's done I could send you a copy so you'll see what I needed it for :)

-- 
 Snap22.png
There is indeed a slight problem here if you want to be able to reuse the list.
The button index is increased at the beginning of the ADD.Click event, because you want the text to be placed in the next button.
But you do not want to do that when the button index already has its maximum value, i.e. buttonindex >= lenth of list buttonlist.

Now for your second question. This is more difficult than you think!
First you must make clear for yourself what you really want to happen.

Assume that I click on H, E and C in that order. They had text and are now made invisible.
Next I click ADD with 1,2,3. What is the result? H=1, E=2 and C=3, or C=1, E=2 and H=3?
Anyway, you must make separate click events for all buttons. Very unfortunately there is no event for all buttons, where you could use the any blocks.

Cheers, Ghica

-- 
OK, I figured I don't need that anyways... I can always just make more buttons.


"Anyway, you must make separate click events for all buttons. Very unfortunately there is no event for all buttons, where you could use the any blocks."


So - you mean if I want to change the text color of a single button of the 12, but just set one rule for it, there's no way I can do that? I need to set a .click event for all the buttons separately?

Hope you got the gift I sent you, if not, please give me your paypal address.


-- 
You need to have a click event for all the buttons separately, but from then on you could call a generalized procedure that has the button clicked as an input argument.
By the way, you cannot make new buttons dynamically, but maybe that it not what you meant by "I can always make more buttons".
Cheers, Ghica.


-- 
Thanks
No, I meant in the designer


--