Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 1 Support › Storage

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #4279

    Heini

    Hi Chris,

    could you please post an example how to use the Storage Item. I would like to save the username and tryed it as follows:

    Scene{
    id: scene
    .....
    
    Storage{
    id: storage
    }
    
    Component.onCompleted{
    var name = storage.getValue("Name");
    }
    }

    Greatings
    Heini

     

    #4280

    Christian
    Felgo Team

    Hi Heini,

    you are using the Storage component correctly. For saving, use the function storage.setValue(“name”, “TestUserName”).

    Alternatively, for storing the username you can also access the settings variable of GameWindow: http://felgo.com/doc/vplay1-gamewindow.html#settings-prop

    Please note that in the docs there is a minor mistake: instead of “userSettings” it should be “settings” in the example code. This issue will be fixed in the next version too.

    Cheers, Chris

    #4308

    Heini

    Hi Chris,

    when i try it the way described in my first post, i get a “Storage is not a type” – error.  MainWindow::settings works for username and highscore, but when i try to save some other data, the data gets only saved temporary. After saving i can call settings.getValue(“test”, data) and the data gets loaded, but when i try the same thing after restarting the app, the return value of getValue is undefined.

    Greetings

    Heini

    #4311

    Christian
    Felgo Team

    Hi Heini,

    you are right, the Storage item is not working correctly as it is not included in the component list. Sorry for that! We fixed it and it will be part of the next update 1.3. Thanks for discovering this bug! In the meantime, you can use the settings variable like explained in the GameWindow doc: http://felgo.com/doc/vplay1-gamewindow.html#settings-prop

     

    From what I see in your code above, you might using the getValue() function incorrectly. To receive the data for a key, call

    var data = settings.getValue(key)

    Cheers, Chris

    #4348

    Heini

    Hi Chris,

    it was a stupid error but not easy to find. The settings.setValue(key, value) function was called from the onValueChanged-handler of the corresponding property. At the app start the property gets initialised with undefined (and saved through the handler). <rolleyes> Now i save the data in another function and it works.

     

    Bye

    Heini

Viewing 5 posts - 1 through 5 (of 5 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded