Freddy Conrad

unread,
Dec 10, 2016, 12:58:48 PM12/10/16
to MIT App Inventor Forum
Hi,

I use an image (gr_Pkt_Z2_li), that only shows a green point.  This image I want to switch on (it's visibel)  or off (it is'nt visibel) by touching the button  "lenken_STOPP".

With this block it works well  to switch the picture off. But if I change false to true it don't work, the picture isn't to see.   What is wrong?

The parameter Visible I can't use, because the image is in a field of a TableArrangement. If I switch Visible off, than the other parts off this row move to left.


SteveJG

unread,
Dec 10, 2016, 8:59:46 PM12/10/16
to mitappinv...@googlegroups.com
What you could do is provide a second image that is the same size as gr_{lt_Z72_li but is entirely white and set the Picture of the button to that image?  That is, why not switch between two images, one your green point and another image that is entirely white?  One for ON one for OFF?

Incidentally for your block set gr_Pkt_Z2_li. Picture  (which I think might be an Image control), should possibly be not Picture but Visible = false  ??   (set gr_Pkt_Z2_li.Visible to false ) if you want to hide it and to true if you want to show it.  and Yes, if you hide an image in a TableArrangement , it is true that one switch Visible off by hiding the image , than the other parts off this row move to left, so if you are going to work like this, use TWO images.

If you haven't seen the free online AI2 book by Prof. Wolber (  http://www.appinventor.org/book2 ) you might want to read it.   It will help you to program.

Regards,
Steve


Freddy Conrad

unread,
Dec 11, 2016, 8:28:06 AM12/11/16
to MIT App Inventor Forum
Hallo Steve,

thanks for your answer.

But it isn't possible to put 2 images into the same field of the TableArrangement. So I have to add one column??  Is that correct?

regards

FreddyConrad

SteveJG

unread,
Dec 11, 2016, 9:27:51 AM12/11/16
to MIT App Inventor Forum
I think you can place two images into the same field of the TableArrangement.   Make one image's   visible property  true, the other false; when you want to switch which shows, make the first false and the second true.  I am fairly certain this works.  Try it and let us know how it works.


Alternatively, yes, you could add another column, however instead you can write code to replace the green image with a different image of the same size.   Several different images can be displayed on an Image component by writing  if .. then code.


Try some different solutions Freddy and let us know what works for you in your App.

-- Steve

Taifun

unread,
Dec 11, 2016, 11:45:38 AM12/11/16
to MIT App Inventor Forum
what about using only one image component and change the picture property of the image accordingly?
Taifun

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

Freddy Conrad

unread,
Dec 11, 2016, 6:02:13 PM12/11/16
to MIT App Inventor Forum
Hi,

that version don't work:


it ever shows the Picture "blaues_Feld", even if I click  "Pfeil_S_li"


And I don't know how to use in this case the if...than code.

And I don't know how to change the picture property of an imagee.


FredyConrad

Taifun

unread,
Dec 11, 2016, 6:26:30 PM12/11/16
to MIT App Inventor Forum
And I don't know how to change the picture property of an imagee.

set Image.Picture to "blau.jpg"

and somewhere else in your blocks

set Image.Picture to "weiss.jpg"

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  .

Also do the tutorials http://appinventor.mit.edu/explore/ai2/tutorials.html to learn the basics of App Inventor, then try something and follow the
 Top 5 Tips: How to learn  App Inventor

You will not find a tutorial, which does exactly what you are looking for. But doing the tutorials (not only reading a little bit) help you to understand, how things are working. This is important and this is the first step to do.

Taifun

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



Freddy Conrad

unread,
Dec 12, 2016, 6:21:01 AM12/12/16
to MIT App Inventor Forum

Thank's for yor patience.

If this is what you mean?  "gr_Pkt_Z2_li" is an image and in the Layoutscreenn its property is set to "Picture none" .  But in this Block I don't know, how to tell the green bar, what Picture should be set to. In the Layoutscreen/  MEDIA   I inserted the wanted picture, but in the Blocksscreen it's not to find.

regards

FreddyConrad

Abraham Getzler

unread,
Dec 12, 2016, 9:17:10 AM12/12/16
to MIT App Inventor Forum
The .Picture attribute wants a purple text block where you have typed the file name of the image file you supplied.
ABG

Freddy Conrad

unread,
Dec 12, 2016, 2:06:41 PM12/12/16
to MIT App Inventor Forum


Am Montag, 12. Dezember 2016 15:17:10 UTC+1 schrieb Abraham Getzler:
The .Picture attribute wants a purple text block where you have typed the file name of the image file you supplied.
ABG


Thank you very much!!

Now it works wunderfull and afterwarts some things are very easy !

regards

freddyConrad
Reply all
Reply to author
Forward
0 new messages