Hi
I tried making a Terms and conditions screen wherein the user gets an option to move to the next screen when he has scrolled to the end of the screen.I thought using the ScrollChangeListener would solve my problem and well it did.
I tested it some time back and it worked like a charm.But in the last few days I am unable to get it to work
.I know it sound ridiculous but its not working.Can anybody help me out in this.The problem now is that the listener is not called by the system which implies that it is not getting set properly.
Please hep.Here's the code:
Code:
public TandC( )
{
Font boldFont = Font.getDefault().derive( Font.BOLD );
int fontHeight = Font.getDefault().getHeight();
Font labelFont = Font.getDefault().derive( Font.BOLD,
fontHeight + 4,
Ui.UNITS_px );
Font italics = Font.getDefault().derive( Font.ENGRAVED_EFFECT|Font.ITALIC|Font.JAPANESE_HINT);
//TODO:
LabelField title1 = new LabelField( "mainTitle",
LabelField.FIELD_HCENTER );
title1.setFont( labelFont );
setTitle( title1 );
LabelField title = new LabelField( "title2" ,LabelField.FIELD_HCENTER);
title.setFont( boldFont );
add( title );
//for spacing
add( new LabelField("") );
LabelField title2 = new LabelField( "Terms And Conditions" ,LabelField.FIELD_LEFT);
title2.setFont( boldFont );
add( title2 );
add( new LabelField("") );
LabelField content = new LabelField("a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text a lot of text ", LabelField.FIELD_LEFT );
content.setFont( italics );
add( content );
setScrollListener( new ScrollListener() );
//I have also tried setting this listener to a verticalfield manager which adds the above "lot of text" field and then adds itself to the screen.
}
class ScrollListener implements ScrollChangeListener
{
//Control wont come here.Thats my problem!!!
public void scrollChanged( Manager manager, int newHorizontalScroll,
int newVerticalScroll )
{
if( !m_TandCread
&& ( newVerticalScroll >= ( manager.getVirtualHeight() - manager.getVisibleHeight() ) ) )
{
m_TandCread = true;//signifies if the screen has been scrolled to the bottom.
}
}
}
Please help me out with this