Open a new screen from selecting a string item in the list picker?

2,565 views
Skip to first unread message

lab...@gmail.com

unread,
Mar 31, 2014, 2:45:28 PM3/31/14
to mitappinv...@googlegroups.com

Hi there,

I need to be able to click on a button, and have the app show me three options (option 1, option 2, option 3) ...when the user clicks on one of these options, a new screen will open.  Each option is connected to a different screen.  I used the list picker element in the (designer screen), then added "Option 1, Option 2, Option 3" into the Elementsfromstring field.  However when I use the app and click on the designated button, the three options appear in the form of a list (good), then I also enabled each Option (1-3) so they can be clicked on (good), but when I do click on then, a new screen should open and it does not, and instead returns back to original screen that list button is on (bad).

I have the blocks set up so that when ListPicker1.BeforePicking + ListPicker1.Enabled to true + call ListPicker1.Open.  Then I also have when ListPicker1.AfterPicking do + open another screen screenName "Option_1".   I have this whole process copied for Option 2 and 3.  Where am I going wrong? 

Thanks for your assistance!

Taifun

unread,
Mar 31, 2014, 2:57:44 PM3/31/14
to mitappinv...@googlegroups.com, lab...@gmail.com
you might want to provide a screenshot of your relevant blocks
Taifun

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


lab...@gmail.com

unread,
Mar 31, 2014, 3:08:31 PM3/31/14
to mitappinv...@googlegroups.com, lab...@gmail.com
Here is a screen shot of the blocks set up I described....Swap out 'Option_1' for 'Profile_1'....and on through Option 2 and 3 respectively.
Screen Shot 2014-03-31 at 3.06.45 PM.png

Enis

unread,
Mar 31, 2014, 3:23:44 PM3/31/14
to
Right off the bat, I'll tell you that you can only have ONE listpicker1.afterpicking and ONE listpicker1.beforepicking.  You can't have several.  You have to handle all the possible choices in the single afterpicking block.

Taifun

unread,
Mar 31, 2014, 3:32:43 PM3/31/14
to mitappinv...@googlegroups.com, lab...@gmail.com
you said, you added the 3 options in the designer, in this case, you can reomve all the Listpicker.BeforePicking events 
and as Enis said, put your logic into one listpicker.afterpicking event
Taifun

lab...@gmail.com

unread,
Mar 31, 2014, 7:02:44 PM3/31/14
to mitappinv...@googlegroups.com, lab...@gmail.com

Ok so I deleted the before events and the extra after events.  The attached screen shot shows how when an item is selected, it will open the corresponding screen (which works)....however, I need to associate similar commands for two other profiles still.  Remember that in the designer, I specified Profile 1, Profile 2, Profile 3 in the strings field...which generates the list with these three profiles...however at the moment, only the first profile can be clicked on and opens a new screen.  I need the last two profiles to be clickable so that their corresponding screens with open.

Thank you!
Screen Shot 2014-03-31 at 6.59.00 PM.png

SteveJG

unread,
Apr 1, 2014, 9:49:18 AM4/1/14
to mitappinv...@googlegroups.com

Consider using a Control block within ListPicker1.AfterPicking.
It appears you could use an   If .. then else If block

In pseudo-code this would be like this:

If  Profile1  is true
then
  open another screen screenName    Profile_1

else if Profile2 is true
then
 open another screen screenName    Profile_2

else if Probile3 is true
then
   open another screen screenName    Profile_3


I expect you probably do not need to set      set ListPicker1.enabled to true         and also ListPicker1.Open 
unless you need them for other reasons.

Try some blocks and let us know how it is working.

Have fun with ur coding.

Regards,
Steve

Taifun

unread,
Apr 1, 2014, 7:01:08 PM4/1/14
to mitappinv...@googlegroups.com

Taifun

bj.t...@googlemail.com

unread,
Apr 23, 2014, 3:39:46 PM4/23/14
to mitappinv...@googlegroups.com, lab...@gmail.com
Hello & sorry my english ... Google has translated :-)
The typhoon love again - thank you that you have helped me already with your image on. (ListPicker)

My problem is the designation of the Screens "B_Klasse" for example.
It looks in the list then funny. Can you write it differently?
for example, "B-Class"

I once appended with the screen, so you know what I mean.

Thank you already times

Greetings Björn


Taifun

unread,
Apr 23, 2014, 4:00:29 PM4/23/14
to mitappinv...@googlegroups.com, lab...@gmail.com, bj.t...@googlemail.com
Screen names only can contain letters, numbers and underscores and must start with a letter...
It seems to be, that you are trying to create several screens... why that?
this is not necessary...  you can do a lot with only 1 screen  and some logic
probably it helps to read chapter 19 - 21 in Dave's book http://www.appinventor.org/projects to get an idea how to do DRY programming with App Inventor https://en.wikipedia.org/wiki/Don%27t_repeat_yourself

Enis

unread,
Apr 23, 2014, 4:25:56 PM4/23/14
to mitappinv...@googlegroups.com, lab...@gmail.com, bj.t...@googlemail.com
Björn:

Make a list of the actual screen names
, then use the friendly names for the list that you display, and the corresponding item from the list of actual screen names to open your screen...


bj.t...@googlemail.com

unread,
Apr 23, 2014, 5:27:47 PM4/23/14
to mitappinv...@googlegroups.com, lab...@gmail.com
Hi typhoon,
yes it should be different screens. There are various vehicle manufacturers and vehicle types to be created as an overview. In the various tables may then select certain options, such as the cockpit or the tire.

I'm unfortunately in things even total beginners. While reading a lot of it, but without having learned it right, it's really hard.

@Enis - hast Du den Text in deutsch übersetzt? Kommst Du aus dem deutschsprachigen Raum?

Taifun

unread,
Apr 23, 2014, 5:36:17 PM4/23/14
to mitappinv...@googlegroups.com, lab...@gmail.com, bj.t...@googlemail.com
yes, I understand, for example you create an app which displays 100 images, a beginner would create 100 screens, each screen = 1 image
but that is not how programming works: you better create 1 screen as template, store your data in lists, add some logic and 1 screen will do it...
Taifun

bj.t...@googlemail.com

unread,
Apr 23, 2014, 5:42:33 PM4/23/14
to mitappinv...@googlegroups.com, lab...@gmail.com
Thanks for the link :-) I will definitely read me through.
So if I understand correctly, I can run almost anything on a screen. View image yes or no. Table View yes or no. Or I understand it wrong now?

Enis

unread,
Apr 23, 2014, 5:51:09 PM4/23/14
to mitappinv...@googlegroups.com, lab...@gmail.com, bj.t...@googlemail.com
Leider keine Bjorn! Ich denke, Taifun tat! Ich spreche nur Englisch und musste eine externe Übersetzer zu verwenden, um Ihre Notiz zu lesen!

bj.t...@googlemail.com

unread,
Apr 23, 2014, 6:05:10 PM4/23/14
to mitappinv...@googlegroups.com, lab...@gmail.com
@ Enis
Oh ok. :-) I thought that you speak German because of the translation, which I had seen. But is not bad, as long as one can interpret the translation of Google yet.
Reply all
Reply to author
Forward
0 new messages