Results 1 to 4 of 4
  1.    #1  
    Hello all, I've been working on an app and I've run into a snag, or more accurately two snags.

    1) I need to know how to force webOS to reload an image every time it loads a scene, and code for a refresh button that I could put on the scene would be awesome. Basically my app has an image that is updated on my web server. The image's name does not change, but what it looks like does. Right now it is pretty inconsistent when the image is updated, and that is a major problem for my app.

    2) I was using Menu Panels to switch between scenes in my app, but now there are just too many scenes for a dropdown menu (over 100). What I need is a search box that will take me to a scene. For example, if the user types "cat" into the search box it will push the scene to "cat-scene.html". Also if they type "dog" into the search box, and I don't have a scene named "dog-scene.html" then I would need it to go do a predetermined page or just throw up some text along the lines of "scene does not exist".

    I'm going to be playing with some of the examples in the dev kit to see if I can get the search box to work, but I don't have a clue where to start with the image reloading issue.

    Any help on either, or both, issues would be great. In fact, any advice would be helpful.

    Thanks
  2. #2  
    Im not 100% sure, but hopefully this will give you an idea of how to get started with the image problem.

    I havent had to setup pics in such a way your describing but if your able to make something like

    this.imageModel = { set up image here };

    this.controller.modelChanged(this.imageModel);

    that will refresh the model and make the changed to the new image

    as for the second issue i think you need to rethink the structure of your app, handling over 100 scenes must be insane what if you need to make a change in each one..

    should be able to make a few .json files or just one will all the info feeding it to the scene dynamically
    Check out GetMeVino!
  3. #3  
    So....

    1) Put this.controller.modelChanged(this.imageModel) in your activate function. (the one before setup... I think), I forget the actual name. But essentially, everytime you reload the page, it will check what the image is. If you really want a refresh button, then just put that line in the handler of the refresh button. I think it should work...

    2) Wow... 100 scenes... That's a little... intense... If you have a new scene with just one or two changes from the previous scene, think about making dynamic div elements instead. You shouldn't need a new scene just for a picture change or whatnot...

    However, if you REALLY, desperately feel the need to have a billion scenes, what you CAN do, is something like this:

    Make a textbox which takes in the user's input (i.e. search box).

    Take the value that the user puts in call it "newscene" or whatever, and then pass it into a handler when the user hits submit or th esearch button. This search string can then get passed into the newScene function:

    Code:
    newscene = 'cat'; //this is just to clarify my point, newscene shouldn't be defined, it 
                             //should come from the user
    
    this.controller.stageController.pushScene(newscene);
    Personally, I'm not really sure what kind of error that throws up if it doesn't exist, but try something like this after that line:

    Code:
    if (!this.controller.stageController.pushScene(newscene)) {
         showErrorDialog(); // Again, this doesn't actually do anything, define an error
                                  // function that will popup a dialog box saying "Error, does not
                                  // exist" or something to that effect...
    }
    Also, if you don't want to deal with errors and the user putting in something that doesn't exist, what you COULD do is hardcode a list of all your scenes and just make it a drop down list (listSelector). This will confine the user to only the scenes that actually exist, and the instant they pick the name of the scene, it could go directly to the scene instead of waiting for a submit button.

    Good Luck!
  4.    #4  
    Sweet guys, and thanks. I will try out those ideas this weekend and see if I can get things moving forward again.

    ----

    Yeah, the massive scenes are a bad idea. I have it set up dynamically on the web, in fact the image itself is dynamic. That's why the webOS browser doesn't always reload it. It uses the cached version most of the time, so the image reload issue is massive for me.

    Basically the app monitors a server status feed, so if the server is down a frantic user may want to check it every couple of minutes... hence the refresh button.

    I've already set it up using a list to select from, but that gets tedious when your server is near the end of the list. I also tried simple buttons for each server, but again it was a little annoying... I will likely give the user the option of a search box and/or dropdown list. And will eventually set it up so they can save their server and just go directly to it.

    Thanks guys. I have a ton of work to do on this, but the advice you gave will save this mojo noob quite a bit of trial and error.
    Last edited by rsstites; 09/26/2009 at 08:39 PM.

Posting Permissions