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
Contributor
maheshqtech
Posts: 43
Registered: ‎11-24-2011
My Device: Perl

How to refresh the form in blackberry

[ Edited ]

Hi,

 

I developed a custome calendar , from my MenuScreen I call the custome calendar and select the date then I close the calendar screen and come back to the MenuScreen that time I call one function of menuscreen on that I read the xml file it goes ok

 

But the label field on form dose not get the updated values on menuscreen.  I use the invalidate() method but it not work. on menuscreen

 

 

How can I refresh the form on the selection of date from calendar screen

 

Sorry for bad english

 

Thanks In advance

Mahesh

Developer
Dionysus
Posts: 152
Registered: ‎07-28-2011
My Device: Bold 9900

Re: How to refresh the form in blackberry

It will help us to help you if you post a code snippet of what you are trying to do.

Contributor
maheshqtech
Posts: 43
Registered: ‎11-24-2011
My Device: Perl

Re: How to refresh the form in blackberry

//constructor of  menus Screen

public MenuScreen_new()
{
super(NO_HORIZONTAL_SCROLL|NO_VERTICAL_SCROLL);

CalenderComp = new CalenderModule(MainContext);
//get Uid , uname , upass from login page
uids=LoginScreen.strId;
unames = LoginScreen.strUname;
upasswords = LoginScreen.strPassword;

System.out.println("ID Value:- "+uids+" User name:- "+unames+" Password:- "+upasswords);




vPerson = new Vector();
vInformation = new Vector();

vStartTime= new Vector();
vCompanyName= new Vector();
vId= new Vector();
vMeetingType= new Vector();


Image_Create();

try
{

firstFF = FontFamily.forName("Times New Roman");// BBMillbank
firstFont = firstFF.getFont(Font.BOLD, 16);
secondFF = FontFamily.forName("Arial");// BBMillbank
fontUnderLine = secondFF.getFont(Font.UNDERLINED, 16);
}
catch(Exception e)
{
System.out.println("Error "+e);
}

if(ddFlag==false)
{
strDate=CalenderComp.curDate;
SOP("Date From Calendar :- "+CalenderComp.curDate);
// ReadXML();
// Draw_Summary();

}
ReadXML();
Draw_Summary();


}

 

Draw_Summary(); function will draw the componenet on the screen

 

 

//call the calendar screen on click of a label field

else if(fValue==lblToday)
{
Dialog.alert("Call Calender");
vPerson = null;
vInformation = null;

vStartTime= null;
vCompanyName= null;
vId= null;
vMeetingType= null;
strCname=null;
strDate=null;

// nullComponenet();
UiApplication.getUiApplication().pushModalScreen(CalenderComp);
}

Above method just invoke the caledar not close the menuscreen . When I come back from calendar it will show againe same as previous not show any changes

 

 

//calendar screen 

TargetContext.GetCalenderDate(DateSelected);
TargetContext.RefreshForm();
CurrContext.close();

 

//calling function on menuscreen are:-

public void GetCalenderDate(String DateSelected){
//DateButton.setLabel(DateSelected);
vPerson = new Vector();
vInformation = new Vector();

vStartTime= new Vector();
vCompanyName= new Vector();
vId= new Vector();
vMeetingType= new Vector();
//strDate=DateSelected;

ddFlag=true;
if(ddFlag==true)
{

strDate=CalenderComp.change_Date;
ReadXML();

}


}

public void RefreshForm()
{
invalidate();
}

 

the value of strDate will be append on label field but it can't be updated

Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: How to refresh the form in blackberry

invalidate does not update any values, it just issues a repaint.
you have to use setText on labels etc to update the screen with new values.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Contributor
maheshqtech
Posts: 43
Registered: ‎11-24-2011
My Device: Perl

Re: How to refresh the form in blackberry

I use your solution but it not work

 

can u give me ur id so I mail u my hole code

Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: How to refresh the form in blackberry

a few things:
don't do xml processing and other possibly blocking things on the event thread.
see
http://supportforums.blackberry.com/t5/Java-Development/What-is-the-Event-Thread/ta-p/446865

i am not interested in receiving your whole code. if you use "my solution" please post an updated snippet (not the whole code).
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter