How to pass check boxes of the screen 1 to screen 2 ?

175 views
Skip to first unread message

Cha Lal

unread,
Feb 19, 2018, 8:56:59 AM2/19/18
to MIT App Inventor Forum
Hello, I need help !!!!

I would like to create a check list.

So in screen 1 you have some things that you can check with the check box and I would like to pass the check box cheked in the screen 2 when we click on a button, is it possible ????

Help me please it's a school project...

SteveJG

unread,
Feb 19, 2018, 9:05:21 AM2/19/18
to MIT App Inventor Forum
Yes, this is possible.  Instead of using multiple screens, it would be VERY EASY to do this using virtual screens (Horizontal or Vertical layouts and switching their Visible property from true to false to show or hide them.  Here is how 


Alternatively you can use a TinyDB.  To do what you want is complex.  You will have to save the checkbox state in Screen1 , then in the Screen2.Initialize block read the checkbox state from the  TinyDB  and assign that state to the 'corresponding' checkbox on Screen2.    Yuk, but you can do it, by why put up with that complexity.

You probably can create you app Cha on a single screen, make the app to appear to have several screens, and be happier.

Regards,
Steve


Cha Lal

unread,
Feb 20, 2018, 8:19:29 AM2/20/18
to MIT App Inventor Forum
Thenks for your answer, but I have to use 2 screens.

So how can I use TinyDB ? How it works ? I've already try but I don"t understand...

Cha Lal

unread,
Feb 20, 2018, 8:38:23 AM2/20/18
to MIT App Inventor Forum
Auto Generated Inline Image 1

SteveJG

unread,
Feb 20, 2018, 8:45:32 AM2/20/18
to mitappinv...@googlegroups.com
"I have to use 2 screens" ... probably not unless you are in a course and that is the assignment.

What did you already try?   If you post your blocks, someone might provide specific advice.

Have you read  
?   If you read it, did you do the exercise and make it work for simply storing data.  What you want to do is more complicated but the TinyDB part is similar.

Here is a tutorial  TinyDB tutorial by Stephen 

Here is a post about someone doing something 'similar' passing data between two screens  https://groups.google.com/forum/#!searchin/mitappinventortest/tinydb%7Csort:date/mitappinventortest/RKIalgZzvpQ/Cq-NtPLeAQAJ  The state of a checkbox could be stored with a tag   CheckBox1    and would contain either false or true    and passed to a similar checkbox on Screen1.

You have not posted  the  images of your two Screens showing the checkboxes you intend to use ; why not do that?   You will need a Screen2  ??? when Screen2.Initialize block to something like           set lave_vaisselleScreen2.Checked to  call TinyDB1.GetVAlue tag Vider le lave-vaisselle   to set the state of the check boxes on Screen2.    You do know you must place a second instance of TinyDB on the Designer in Screen1.     It is the same database but it allows you to share the tags you set on screen1 with screen2.   The blocks you posted 'seem' ok, what you lack are the blocks on Screen2.


Cha Lal

unread,
Feb 20, 2018, 9:02:35 AM2/20/18
to MIT App Inventor Forum
I'm sorry but what shoul I do in screen 2?

Insert a TinyDb but in this screen 2 I have nothing, I would like to "make appear" my checkboxes which are in screen one.

For example : one "make your lessons" is check, the sentence "make your lessons" appear in the screen 2.

I'm sorry I'm app inventor's beginner .. Thanks for your help !!

SteveJG

unread,
Feb 20, 2018, 9:19:05 AM2/20/18
to MIT App Inventor Forum
You  have to put the check boxes you want to see on Screen2 on the Designer, there is no way to make them magically appear.  App Inventor cannot create objects during run time so the developer must place them on a Screen.  The check boxes on screen2 can be identical to the boxes on screen2.   

You are a beginner.  Here are some resources to help you learn 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  .




Reply all
Reply to author
Forward
0 new messages