when i click on Buttonfield i want to show Popup screen .everything working fine .but that PopupScreen open by default at the center of the Mainscreen.
i have already try this code.setMargin and setPosstion method to change the possition. but its not working as my requrement .
i want to open that Popupscreen at the top of Mainscreen with Animation(top to bottom).
and another issue is that in this popup screen there is one Edittextfield ..when i click on edittext field keyboard open fine but at that time device Menu button not working and i cant access keyborad hide functionality ..
how to set popup screen at the top of the mainscreen ?
Have you tried overriding the sublayout() method in the popupScreen class ?
protected void sublayout(int width, int height) {
super.sublayout(width, height);
// replace x,y with your values //
setPosition(x, y);
}
HOWEVER, if you are trying to animate the popup screen from top to bottom, you are better off using EyelidFieldManager, it does the animation for you :)
Try:
EyelidFieldManager Sample
EyelidFieldManager API
Related
I searched how to set header and footer in BlackBerry and I found the functions setTitle() and setStatus().
My problem is I have created a class that extends VerticalFieldManager. In VerticalFieldManager, it is not showing me setStatus function as this is function of MainScreen class.
You're right. A VerticalFieldManager does not allow you to setStatus() directly.
It's important to understand the relationship between the classes in the BlackBerry UI framework.
First of all, there are Screen classes. Normally, a Screen will take up the entire device screen. You can have many different Screen classes in your app. Maybe one Screen for a splash image, one screen for a map view, one screen for settings, etc.
Inside your screens, you will often have Manager classes. A VerticalFieldManager is a kind of Manager that arranges its contents top-to-bottom, in the order that you add them. A Manager holds a group of related objects, but it does not have to span the full screen height, or width.
Inside your managers, you will usually have multiple Field objects. A Field is the individual item in the heirarchy. ButtonField, EditField, or BrowserField are all kinds of fields. They will usually be added to managers (containers). Those managers will then usually be added to screens.
So, in your case, I think what you should have is a screen class. In that screen class, you will set the header and footer by calling setTitle() and setStatus(). The content between the header and footer will all be contained in a VerticalFieldManager that you add to the screen. Something like this:
public class MyScreen extends MainScreen {
public MyScreen() {
super(MainScreen.VERTICAL_SCROLL | MainScreen.VERTICAL_SCROLLBAR);
// set a header for this screen
setTitle("My Header / Title");
// screen contents go in the vertical field manager
// NOTE: you can replace VerticalFieldManager with your own class
// that extends Manager, or VerticalFieldManager, if you like
VerticalFieldManager vfm = new VerticalFieldManager();
vfm.add(new LabelField("One"));
vfm.add(new ButtonField("Two", ButtonField.CONSUME_CLICK));
vfm.add(new CheckboxField("Three", true));
add(vfm);
// use a bitmap as a footer
Bitmap footer = Bitmap.getBitmapResource("footer.png");
setStatus(new BitmapField(footer));
}
}
I am trying for hours now to move my dialog in smartGWT, but with no luck.
This is my code:
Dialog dlg = new Dialog();
ListGridRecord[] h = scoringGrid.getRecords();
HLayout chart = new HLayout();
vlayout.addMember(chart);
dlg.addMember(highChart(h));
dlg.moveBy(500, 900);
dlg.setHeight("400px");
dlg.setWidth("700px");
dlg.show();
I also tried: setLeft, setTop, setRect, without any effect.
My dialog always displays at the same location.
Any ideas?
Dialog is a subClass of Window. So you can invoke the method setRect which is inherited.
From the Javadoc:
public void setRect(int left, int top, int width, int height)
// Set all four coordinates, relative to the enclosing context, at once.
If you don't see the change perhaps you would have to redraw in some cases I found it necessary.
I had the same issue. I finally tried calling moveTo() after show(), and it worked.
dlg.show();
dlg.moveTo(400, 500);
moveBy() works this way as well.
I'm not sure WHY this works--I'm guessing show() automatically centers the Dialog and overrides previous placement. However, I don't get the same behavior working with a Window, and I don't see anything in Dialog overriding the show() behavior. But, it worked for me....
I am having trouble with vertical scrolling on a blackberry app.
it works just fine on touch screens, but when scrolling using a track pad, it jumps from being at the top position to being at the bottom position.
Anyone had a similar problem? any idea what i could try?
Here is a snippet from my code. i have a static background image and the fields scroll on top of it:
vertical_main = new VerticalFieldManager(USE_ALL_WIDTH |NO_VERTICAL_SCROLL |USE_ALL_HEIGHT);
vertical_AllTags=new VerticalFieldManager(USE_ALL_WIDTH | VERTICAL_SCROLL);
// i then add all the fields to vertical_AllTags
vertical_main.add(vertical_AllTags);
vertical_main.invalidate();
add(vertical_main);
thanks in advance for your help
EDIT:
The suggestion of giving each field focus was correct. the only other part that needs to be done is when you override the onFocus method for a field, you need to call the super() function so that all the other normal parts of the onFocus method are still called:
protected void onFocus(int direction) {
text_select=true;
invalidate();
super.onFocus(direction);
}
protected void onUnfocus() {
text_select=false;
invalidate();
super.onUnfocus();
}
Thank you so much.
This is common issue in non touch devises for beginners.
if you want to scroll field by field there is two ways
1) you need to give the focus to all fields then it will come field by
field focus down
another way is means you dont need to focus on each and every field
2)just add the NullField after your every field and give focus to all
NullFields then your trackball will bring your screen field by field
This happends beacuse in TrackWheel Scrolling it scrolls up to the next Focused field. I think you are not give any focus between the vertical_AllTags.
You can solved this by using NullField() class. Like...
add(new NullField(Field.FOCUSABLE))
when you add add(new NullField(Field.FOCUSABLE)); you will get the null focus which is not know by you. And you can navigate all the fields like Touch Screen.
You can solve that issue by adding two vertical field manager.. take a look at the code in this post
I am working on a project where I need to display a ListField that takes the top half of the screen when the user clicks on a menu item. It should display on top of the earlier screen. How can I implement it?
Here are my ideas:
Use ListField directly with the above screen size to required screen.
Use PopupScreen with ListField
Use some screensplit functionality to display half of the screen
PopupScreen is best fit for your question. Can you try and post the code that didn't work?
Another option is to use managers to split the screen (higher manager and lower manager) and to hold another two managers: one that will be displayed on click and one that will be used as a pointer to the displayed Manager. Then, when ever the replace event is fired you should call the following function:
void updateManagers(boolean click)
{
if(click)
{
currentManager = afterClickManager;
}
else
{
currrentManager = beforeClickManager;
}
invalidate();
}
Where currentManager is an instance of Manager and afterClickManager & beforeClickManager are instances of some class which extends Manager (no need to be the same class).
Note that you should add currentManager to your screen layout before using the invalidate function.
I have created a class that extends HorizontalFieldManager so that I can display a label and an image on the same line with the label to the left and the image to the right. I want the user to be able to interact with the hfm as if it were a single field. I have everything working (focus, click action, etc) except the menu. When I press the menu button makeMenu and makeContextMenu are not called. How do I make it so that the correct menu shows when the menu button is clicked and focus is on the hfm? Am I going about this the wrong way?
Where do you override makeContextMenu, in the Hfm? You might have to override them in the label and image.
Or, less elegantly, you could just check in the makeMenu() function of your screen if the hfm has focus (or its children) and then add your menu item there.