Managing Control Values Between Windows

You must Login before you can answer or comment on any questions.

Greetings,

I'm working on on app where the user will be presented with a list of pictures. Each picture has an associated label and progress bar.

When the user clicks on a picture, a new window will open up with a bigger view of the picture and a button to like the picture. When this button is clicked, I would like the progress bar associated with the picture in the previous window to be updated. How can I go about implementing this?

Side note: I see this being done in the Google+ app for Android where if I open a post and +1 it, the button changes within the post view as well as within my stream view, all without refreshing the stream.

Thanks.

2 Answers

Hi,Kevin Sheppard

I think you need to make function for that on click event close that window and call that function which is created in previous window and put your progress code for update inside that function.Best luck

— answered 9 months ago by Nitin Chavda
answer permalink
6 Comments
  • Thanks for the response, Nitin, but I'm not quite sure I understand the instructions fully. I understand up to the part where you say that I have to close the window when the picture is clicked. After that i'm not sure...

    — commented 9 months ago by Kevin Sheppard

  • Okay, create Ti.App.FireEvent and put your window refresh code inside that function and put that in your previous window and when you go inside other window and click close that window and calll FireEvent which is located in your previous window.Hope you are getting me.

    — commented 9 months ago by Nitin Chavda

  • Now I understand. Thanks a lot!

    One last thing though, since there are multiple progress bars on the initial screen, how can I target and update the specific progress bar associated with the picture that the user is "liking"?

    — commented 9 months ago by Kevin Sheppard

  • Show 3 more comments

After doing some fiddling, I was able to mock up a small JS application to demonstrate (and solve) my question. You can find it here: http://jsfiddle.net/kshep92/XZMXm/2/

In the app, a series of buttons are created using a loop. These buttons will represent my pictures. As each button is created, it creates a click handler, which creates another button. This sub-button represents the window I want opened. When the sub-button is created, it is given a click handler which changes the label of its parent button and only its parent button. This will represent the updating of the progress bar when the button in the other window is clicked.

The example code is not perfect, but it sure helped me get a good start on wrapping my head around the concept.

Thanks Nitin for all your help!

Your Answer

Think you can help? Login to answer this question!