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
Super Contributor
Achin
Posts: 425
Registered: ‎01-02-2013
My Device: BOLD 9900
My Carrier: sdvsdvsd

swipe screen with wipe transitions

here is my screen shot pic, now what i want is when i swipe left or right with trackpad ,for example-when i swipe left with trackpad , another screen will be pushed with wipe transition.
here is my code- when i swipe first time the screen will be swiped with wipe transition and after that the simulator will be hanged and it does not show any error in console.can u help me,,

public final class MyScreen extends MainScreen
{
/*
* the navigation movement has variables as
dx and dy
if (dx == -1) for left movement
if (dx == 1) for right movement
if (dy == -1) for down movement
if (dy == 1) for up movement8530.png
*/
int counter = 0;
LabelField labl = new LabelField("The screen closes automatically in two seconds");
private Screen secondaryScreen;


public MyScreen()
{
// Set the displayed title of the screen
//setTitle("touch gestures");
add(labl);

try {
secondaryScreen = new FullScreen();
secondaryScreen.setBackground(BackgroundFactory.createSolidBackground(Color.WHITE));

LabelField labelField = new LabelField("Set the displayed title of the screen\nThe screen closes automatically in two seconds");
secondaryScreen.add(labelField);

TransitionContext transition = new TransitionContext(TransitionContext.TRANSITION_WIPE);
transition.setIntAttribute(TransitionContext.ATTR_DURATION, 500);
transition.setIntAttribute(TransitionContext.ATTR_DIRECTION,TransitionContext.DIRECTION_LEFT);
transition.setIntAttribute(TransitionContext.ATTR_STYLE,TransitionContext.STYLE_PUSH);

UiEngineInstance engine = Ui.getUiEngineInstance();
engine.setTransition(null, secondaryScreen, UiEngineInstance.TRIGGER_PUSH,transition);

engine.setTransition(secondaryScreen, null, UiEngineInstance.TRIGGER_POP, transition);



} catch (Exception e) {
// TODO Auto-generated catch block
System.out.println("error"+e.getMessage());
e.printStackTrace();
}



}

protected boolean navigationMovement(int dx,int dy,int status,int time)
{
try
{

if(dx > 0)
{
UiApplication.getUiApplication().invokeLater(new Runnable() {

public void run() {
// TODO Auto-generated method stub
UiApplication.getUiApplication().pushScreen(secondaryScreen);
}
});

//counter++;
//labl.setText("counter="+counter);
//System.out.println("="+counter);
}
if(dx < 0)
{

UiApplication.getUiApplication().invokeLater(new Runnable() {

public void run() {
// TODO Auto-generated method stub

}
});

//counter--;
//labl.setText("counter="+counter);
//System.out.println("="+counter);
}
if(dy < 0)
{
System.out.println("UP : ");
// Dialog.alert("UP : ");
}
if(dy > 0)
{
System.out.println("DOWN : ");
//Dialog.alert("DOWN");
}
this.invalidate();
}
catch(Exception e)
{
System.out.println("WError:"+e.getMessage());
}
return true;
}
}

Please use plain text.
Developer
peter_strange
Posts: 19,599
Registered: ‎07-14-2008
My Device: Not Specified

Re: swipe screen with wipe transitions

It would be useful for you to give more information than just this:

"the simulator will be hanged"

 

Here are some questions that you might like to answer. 

Can you still get to the task switcher by pressing and holding the BlackBerry Menu key?  Do you actually see the second screen?  Have you tried pressing ESC to close the screen? This text "The screen closes automatically in two seconds" suggests the screen will close automatically, but where is the code to do that?

 

Also have you tried pushing the same screen without using a transition, to see if it is the screen or the transition that is causing the problem?

Please use plain text.
Super Contributor
Achin
Posts: 425
Registered: ‎01-02-2013
My Device: BOLD 9900
My Carrier: sdvsdvsd

Re: swipe screen with wipe transitions

if u look at screen shot ,my requirenent is that when i made a swipe that will look like the text is moving (like wipe transition), i'm very confused that how can i create effect.

Please use plain text.
Developer
peter_strange
Posts: 19,599
Registered: ‎07-14-2008
My Device: Not Specified

Re: swipe screen with wipe transitions

That is not what you asked about on this Thread.  Can we resolve the hanging problem on this Thread and you can ask your new question on a new Thread?

Please use plain text.
Super Contributor
Achin
Posts: 425
Registered: ‎01-02-2013
My Device: BOLD 9900
My Carrier: sdvsdvsd

Re: swipe screen with wipe transitions

yes, we can solve our hanging problem on this thread, my requirement is that just to move the text with swipe of trackpad, as like wipe transtition , means the text is moving from left to right, plz can u can u help me..?

Please use plain text.
Developer
peter_strange
Posts: 19,599
Registered: ‎07-14-2008
My Device: Not Specified

Re: swipe screen with wipe transitions

If you want to get just the text in the middle moving sideways, then the only official way to do this using standard BB controls that I am aware off, is to have that part contain a HorizontalFieldManager.  Then you add the two "page Fields" that will each create the full Screen you want to the HFM.  These "page Fields" will typically be VerticalFieldManagers, which you constrain (using sublayout) to be the width of the screen.  Then the trackpad movement will move focus horizontally and thus move focus from one of your 'pages' to the next and this will scroll in.

 

There are lots of complications with this process so there is usually a bit of work involved after you get the scrolling working.    But that is where to start.

 

And no I don't have a sample that I can give you. Even if I did, I suspect cut/pasting code in to your application would not be appropriate in this case, as I am sure that anything I supply would not match what you need exactly, in which case you will need to understand how it works.  So you might as well develop it yourself. 

 

Can I suggest you start by creating a simple standalone application that has one MainScreen and try to create this effect using standard components in that MainScreen.  I suspect that you will have issues with this in which case, having a small self contained test screen will mean that you can easily show us some small bits of code using standard components.  When you have this working with standard components in a test screen the way you want, then take the understanding you have gained and apply it to your main application. 

 

 

Please use plain text.
Super Contributor
Achin
Posts: 425
Registered: ‎01-02-2013
My Device: BOLD 9900
My Carrier: sdvsdvsd

Re: swipe screen with wipe transitions

can i use animation except transition to move the text in label on every swipe left or right.
Please use plain text.
Developer
peter_strange
Posts: 19,599
Registered: ‎07-14-2008
My Device: Not Specified

Re: swipe screen with wipe transitions

I am not sure I understand that question. 

 

If you have a HorizontalFieldManager, that contains Fields which are (in total) wider than the screen and are focusable, then moving the focus from one Field to another (which the trackpad will do) will scroll the Fields on to the Screen if they are hidden. 

 

If these are LabelFields, then the effect is that the text will scroll across the screen. 

 

Is that what you want?

Please use plain text.
Super Contributor
Achin
Posts: 425
Registered: ‎01-02-2013
My Device: BOLD 9900
My Carrier: sdvsdvsd

Re: swipe screen with wipe transitions

yes, u almost got my point.i mean to say when the value will be changed form my swipe the text will look like it is moving like wipe transition effect
Please use plain text.
Developer
peter_strange
Posts: 19,599
Registered: ‎07-14-2008
My Device: Not Specified

Re: swipe screen with wipe transitions

OK, get you now.  No this is not wipe, it is slide.  There is no easy way to do wipe without a load of effort and complications.  . 

Please use plain text.