2017년 4월 3일 월요일

Using spinner to select new screens?!


I am trying to create a test app which has 3 screens, each screen with its own player/sound that starts as soon as the screen is opened. I simply want to be able to select any of the three screens from the spinner, but am finding it increasingly difficult. I have scoured the web for tutorials on the spinner and most of them only contain basic info that I already know. Can anyone help? I've attached my blocks screen, and I'm sure it is just the case of missing blocks! 





--
and most of them only contain basic info that I already know
so if you already know the basic info, why don't you use the Spinner.AfterSelecting block together with the Spinner.Selection or Spinner.SelectionIndex to find out what has been selected?

-- 
Thanks for your reply, Taifun. Sorry, my screenshot didn't include all my blocks. I have tried using the spinner.afterselecting block, but I am struggling to link the Spinner.SelectionIndex and Spinner.selection to specific screens. I have only managed to make the entire spinner (when clicked) go to a different screen.

I should also qualify that when I say 'basic info', I mean really basic. I have yet to find a tutorial that covers spinner selection >>>multiple screens. 

--
I should also qualify that when I say 'basic info', I mean really basic. I have yet to find a tutorial that covers spinner selection >>>multiple screens. 
Do the tutorials to learn the basics of 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. 

in your case you can for example use the SelectionIndex like this
if Spinnner.SelectionIndex = 1
then open another screen Screen1
else if Spinner.SelectionIndex = 2
then open another screen Screen2
etc

alternatively use the Spinner.Selection

-- 
I did make the mistake of choosing to do some tutorials and not all, so I will work on them next.

As for the selection.index, is the attached correct? The spinner is still unresponsive with those commands, am I missing a line?

ps. The correct file is now attached



--
I prepared a small spinner example for you
to open another screen, just add the open another screen block...

--
Many thanks for this, Taifun. In addition to the tutorial, this kind of help is priceless for beginner app developers.

--

댓글 없음:

댓글 쓰기