03-19-2010 06:23 AM
I am getting some problem with refreshing the screen..
What i am doing is i am generating some checkboxefield instances dynamically depending upon the no. of items in the list. for example if i have 5 items in list then 5 checkboxes are created. This is working very fine. by using the managers screen is showing the checkboxes and listfield items. when i go to another screen to add some items to the list i want on coming back to the original screen when i reload the list, number of instances of the checkboxfield should be increased by the no. of items added and screen should display the new no. of checkboxes and new items of the listfield.
Items are being displayed but the new checkboxes are not created.
Is there any way to refresh the screen so that when i come back to the screen, the no. of fields on the screen must be changed according to the situation.
I hope i am able to explain my problem...Please suggest some solution.
03-19-2010 08:54 AM
I prefer overriding onExposed than onFocus to refresh the screen. I think both get called in a lot of circumstances where the screen does not need to be refreshed so I would minimize the processing in there if the screen dos not need to be refreshed.
Alternatively, and I think in this case better, use a modal invocation of your lower level screen, and then in the processing one return from the screen, you can refresh the current screen. For example:
03-19-2010 12:48 PM
I'm never sure when to use invalidate() and when to use something else. I was messing about with TextBoxFields for another thread and found that if I changed the size of the TextBoxField then calling invalidate() did not force a refresh but calling the MainScreen's updateLayout() did. I usually prefer subtlety to the bigger hammer. Is there a good reference explaining all this?
03-20-2010 05:23 AM
Thanx for replying.. But how can i refresh the screen while staying at the same screen.. e.g. i have some checkboxes on the screen and i want on pressing remove in menu the checkboxes marked as set must be removed from the screen and screen should be refreshed so that it doesn't show the deleted checkboxes anymore. I am not going to any other screen. I have only one screen and want to refresh that screen only.
03-20-2010 10:41 AM
If you remove a Field, the Manager should refresh the Sceen for you. Give it a try and watch what happemns.
With regard to invalidate() verses updateLayout, the way i think about it, invalidate causes a repaint, so no Fields will change in size. If you need to change the layout, then invalidate() will not do it for you.