Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 24
Registered: ‎01-12-2010
My Device: Storm2 9550
My Carrier: Telus
Accepted Solution

Issues with clearing the screen

Hello all

 

I'm developing an application where I wish to, upon an action such as a buttonPress, clear the screen of it's current content and redraw the entire screen. The current content is drawn inside a GridManager that draws the screen as expected. 

 

Originally I found in my searches that invalidate was supposed to meet what I needed, however I believe I'm doing something wrong that I cannot isolate. I've tried calling it as part of the gridmanager object to no avail, same with calling invalidate by itself. Is there a way that invalidate should be called to do what I wish, or is invalidate the incorrect tool to use in the first place?

Developer
Posts: 222
Registered: ‎11-11-2009
My Device: Storm

Re: Issues with clearing the screen

i was not clear, can you please brief in detail and show your code snippet?

with regards,
Vignesh J

-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Don't forget to mark your post as solved if you get the answer and dont forget to give kudos if the answer is useful for you.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Developer
Posts: 24
Registered: ‎01-12-2010
My Device: Storm2 9550
My Carrier: Telus

Re: Issues with clearing the screen

Here is the code in question, where I am trying to clear the screen and redraw:

 

 

		invalidate();

		gridFieldManager = new GridFieldManager(4, 0);
		
		for (int i = 0; i < currentBlockValues.length; i++) {
			if (i == blankIndex) {
				currentBlockValues[i] = 0;
				cNew = new CustomButtonField(" ", Color.WHITE, Color.LIGHTGREY, Color.YELLOW, Color.GREEN, 0);
			} else {
				currentBlockValues[i] = i+1;				
				cNew = new CustomButtonField(i+1+"", Color.WHITE, Color.LIGHTGREY, Color.YELLOW, Color.GREEN, 0);				
			}

			gridFieldManager.add(cNew);
			cNew.setChangeListener(this);
		}
		add(gridFieldManager);

 

 

Developer
Posts: 222
Registered: ‎11-11-2009
My Device: Storm

Re: Issues with clearing the screen

sorry to say, now also i was not clear and not able to get clear view of you code snippet. but i am assuming that in your screen you having a GridFieldManager which hold some fields. when you are trying to click a button in that screen, it should remove all the components from the screen and has add them once again. is it so? if so, i having a quick question to ask, are you trying to reset the values in the components before trying to redraw them?

with regards,
Vignesh J

-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Don't forget to mark your post as solved if you get the answer and dont forget to give kudos if the answer is useful for you.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Developer
Posts: 24
Registered: ‎01-12-2010
My Device: Storm2 9550
My Carrier: Telus

Re: Issues with clearing the screen

yes what I'm doing is to take input based upon the button clicked, and then have the screen cleared, and then redrawn with the new input factored into the layout of new order of things.

Developer
Posts: 192
Registered: ‎01-12-2010
My Device: Bold
My Carrier: ZAIN

Re: Issues with clearing the screen

Dear ,

Please see below the code to delete the manager this is the only way you can clear the screen

void check(Manager m)
	{
		Manager mTab = m.getManager();
		if ( mTab != null ) {
			mTab.delete(m);
			}
	}

 just pass the Manager name and it will be cleared

then you can check using managerName != null and u can do the processing

 

 

rgds

Nadir

Developer
Posts: 222
Registered: ‎11-11-2009
My Device: Storm

Re: Issues with clearing the screen

"then have the screen cleared, and then redrawn with the new input factored into the layout of new order of things."

   @1 - are you trying to remove the field components from the screen (including the Manager) and then trying to new components (ie., new fields and manager) as a new layout. if so why cant you have seperate screen to show seperate layout

   @2 - are you trying to reset the data available in the components within the screen. if so reset the data (like .setText ("") ) for each components is much enough, you no need to remove (clear) and add all the components once again (redraw)

with regards,
Vignesh J

-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Don't forget to mark your post as solved if you get the answer and dont forget to give kudos if the answer is useful for you.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Developer
Posts: 24
Registered: ‎01-12-2010
My Device: Storm2 9550
My Carrier: Telus

Re: Issues with clearing the screen

Tried this out and with a bit of working (for example not casting it to gridmanager) it looks ot be a possible solution. Thanks to both of you for your replies, it's very much appriciated!