domingo, 24 de março de 2013

Trabalhando com mais do que uma tela...

Digamos surja a necessidade de abrir uma outra tela ,  executar uma ação e voltar ã tela anterior.
Pois bem, tem solução.
Faça o seguinte :

1) No Screen Initialize da Screen1 , monte o bloco assim :
* ou seja , Screen1 abre com o START VALUE = true , então Open a Screen2.

Para voltar de Screen2 , insira no bloco VALUE = false:

Ficou mais fácil , adapte à sua necessidade.

Germinaro

12 comentários:

  1. Tenho uma duvida... se eu tiver mais de uma screen?
    no meu caso eu tenho a Screen 1 ,2 ,3 ,4 ,5
    eu terei que fazer o mesmo passo substituindo o " Screen2" pelo valor de cada tela?

    ResponderExcluir
  2. ola...sim...no open deveras informar o nome da screen....no close,voltara a tela anterior...

    ResponderExcluir
  3. Vlw xD Acesse ai www.appmarketblog.blogspot.com

    ResponderExcluir
  4. tenho outra duvida. se pode-se me adicionar no facebook ou no skype ficaria grato
    facebook https://www.facebook.com/profile.php?id=100001236743181
    Skype: lucasmick2

    ResponderExcluir
  5. Cara, só tenho um problema, sempre que mudo de tela a conexão com o Bluetooth precisa ser refeita, tem uma solução para isso?

    ResponderExcluir
    Respostas
    1. Caro Leandro,

      VEja se resolve seu problema (encontrado num Forum do AppInventor:

      I run some tests using bluetooth + multiple screen, these are my findings:

      1. If you add a BluetoothClient component in Screen1, it is not accessible in Screen2. I mean: to use, for example, BluetoothClient1.Connect in Screen2, you need to add a BluetoothClient component in Screen2 too.

      2. if you connect the BluetoothClient to a device (BluetoothClient1.Connect) in Screen1, then switch to Screen2 and after switch back to Screen1, the Bluetooth is STILL connected to the device (you can use BluetoothClient1.SendBytes in Screen1 without an additional BluetoothClient1.Connect).

      3. The opposite is NOT true: if you connect the BluetoothClient to a device (BluetoothClient1.Connect) in Screen2, then switch to Screen1 and after switch back to Screen2, the Bluetooth is NOT connected to the device anymore (you need to use BluetoothClient1.Connect again before you can use BluetoothClient1.SendBytes).

      4. If you connect the BluetoothClient to a device (BluetoothClient1.Connect) in Screen1, you can not use BluetoothClient1.SendBytes in Screen2 (because it was not connected in Screen2 yet) and you can not use BluetoothClient1.Connect neither (because the device is already connected to BluetoothClient in Screen1 - item2 above). So, to use the BluetoothClient.Connect in Screen2 you need to first disconnect it from device in Screen1.

      5. The opposite is partially true: if you connect the BluetoothClient to a device (BluetoothClient1.Connect) in Screen2, you can not use BluetoothClient1.SendBytes in Screen1 (because it was not connected in Screen1 yet) but you can use BluetoothClient1.Connect to do this (because the device was already disconnected from BluetoothClient in Screen2 when you switched the screens - item3 above).

      With this in mind is possible to manage the situation and find the better way to work... but it would be better if we just connect the Bluetooth in Screen1 and could just use it (without additional BluetoothClient.Connect) in other screens.

      I hope this helps.

      Regards,

      --
      Marcelo Ávila de Oliveira

      Excluir
    2. Ajudou a descobrir que meu problema não tem solução, não posso mudar de screen e permanecer conectado, não no app inventor

      Excluir
  6. Este comentário foi removido pelo autor.

    ResponderExcluir
  7. ola, eu sou novo no appinventor ja construir meu aplicativo por algumas vídeos aulas, mais para fica melhor minha aplicação precisava fazer uma tela screen1 de cadastro de dois valores que subtraindo esses dois valores, mostra o valor em uma label na screen2

    ResponderExcluir
    Respostas
    1. CAro Bruno,

      Publiquei o POST - Passando valores entre Screens , relativo ã sua dúvida..

      Confira..

      abraço,

      Excluir
  8. Caro Bruno:

    Adicione um TinyDB na Screen1 e salve o valor da soma dos 2 valores numa TAG "soma"por exemplo.
    Adicione um TinyDB na Screen2 com o mesmo nome do TinyDb da Screen1 .
    No código da Screen2 , execute um GetValue com a mesma Variável "soma"...
    Testei e de certo...

    OK?

    abraço,

    ResponderExcluir
  9. ola estou com problema na minha screens ..estou com 5 telas quando saio delas mais de 4 vezes meu app para ..como resolvo ..

    ResponderExcluir