How to add eyelid field manager to grid field manager.
I have created a grid layout.Now i want to add an eyelid field manager on top of it.
I have been able to add both of them separately but now am unable to use them together.
Following code was used when i wanted to integrate
_eyelidFieldManager.add(grid);
add(_eyelidFieldManager);
How else can this be accomplished?
I have also tried adding this way
grid.add(_eyelidFieldManager);
add(grid);
But what what i get is the eye lid field manager comes below the grid.I want to superimpose the eyelid on top of grid.So that when i click anywhere on the screen of grid,the eyelid opens.Your help will be appreciated.
EyelidFieldManager has three main methods for adding fields:
addTop(Field f): adds a field to the top eyelid.
addBottom(Field f): adds a field to the bottom eyelid.
add(Field f, int x, int y): adds a field and places it in the specified absolute position. Fields added using this method will remain visible after the lids get closed.
As you can see, EyelidFieldManager extends from AbsoluteFieldManager and this is what makes this class so problematic, as fields added in between the lids must be layed out using absolute coordinates.
In turn, AbsoluteFieldManager extends Manager so it has an additional add(Field f) method, which is overriden to add the field to the bottom eyelid. This is what is happening in your case. You should instead use the third add method listed above and provide absolute coordinates.
Related
I'm trying to make a simple list editor in Dart, with Polymer, but I have some problems.
I will start by showing a screenshot of what it will look like.
design of the app
The left drawer is filled dynamically at run-time (a rest api is used to get the items).
The items are "MLayers" and clicking the button should add the corresponding "Layer" to the right part of the app.
The thing is I can't find a way to do this! I tried to launch a customEvent when the button is clicked but the method responsible of adding the new layer need the layer name (and I can't find a way to add parameters to customEvents...).
What do you recommand?
The structure of the app is:
mainApp
_ Drawer
__ MLayer
__ Layer
I think the class responsible of adding Layers should be the Drawer (in fact it contain the drawer AND the content). The Layer constructor should use the name (or ID) of the MLayer to display corresponding properties (lets say the MLayer "Dense" has properties "name" and "size"; the Layer is in fact an instance, while the MLayer is the maquette).
Thanks for the read!
EDIT: as requested, here's the code
Ok, so I didn't find the right way to do it, so I simply broke encapsulation by adding a property "MLayerDrawer" to my "MLayer" object and calling its method...
I'm still open to suggestions because this clearly isn't the right way to do it, it just work but is really dirty.
How to create fields having multiple attributes(each Field containing multiline texts,image icon,date etc) in an Application.??
What exactly they are called as???
In the BlackBerry Java UI framework, the fundamental class is a Field. A Field might be a TextField or BitmapField or ButtonField.
Managers
If you want to create a field that is a group of fields, you would normally use or create a class that extends Manager. A Manager is a container of field objects, that is responsible for properly laying out (sizing and positioning) the fields it contains.
Also, a Manager is itself a Field in that it extends Field. So, you can have a heirarchy of field objects, and managers. A Manager can contain child Manager objects, which themselves contain low-level fields: buttons, labels, sliders, etc.
You can extend the Manager class yourself, and implement the methods to properly size and layout its children,
protected abstract void sublayout(int width, int height);
public int getPreferredWidth();
public int getPreferredHeight();
or you can use one of the pre-written RIM managers, like VerticalFieldManager, or HoriztonalFieldManager.
VerticalFieldManager, for example, lays out all Field objects that you add() to it, in order, vertically from top to bottom. You can adjust spacing on the child fields by calling setMargin() on each field.
Some other built-in Manager subclasses:
HorizontalFieldManager - lays out child fields horizontally, in the order added, from left to right
FlowFieldManager - lays out child fields horizontally, until horizontal space is full, and then vertically (like the words on a page flow)
AbsoluteFieldManager - lays out child fields at fixed (x,y) screen coordinates
GridFieldManager - lays out child fields in a grid of rows and columns ... like a table
Is it possible to create a customized list field in BB, where each row will have 4 different labels, and a bitmap field, without implementing the drawListRow method?
Since drawListRow uses canvas I want to avoid it. Because, I need to display a browser field in list row. Or is it possible to add label fields in list row?
You probably aren't going to be able to implement this the way you want - try putting more than one BrowserField on a screen at once and you'll soon run into multiple issues. I'd suggest creating a custom Field to act as a row instead, or try and get the desired look n feel using Field Managers.
My requirement is to create a customlistfieldmanager by extending verticalfeildmanager, I am not able to figureout how to do this?
I am not able to understand why my manager has asked me to use this method.
any sort of help is welcomed!
It's possible that he's asked you to do this because of the most limiting factor of a normal ListField: you're stuck with uniform heights.
What you'll need to do is have a parent container that is a scrolling VerticalFieldManager. Inside of that will be custom Managers that can handle the same functionality as the row would in a ListField. It needs to accept focus and fire off an event when it's clicked. You'll also need to keep track of what item number it is, so that when it's clicked it knows how to notify any listeners about which one was selected. Also, the parent VFM will need to be able to keep track of which "row" is currently selected -- in this case which one has focus.
Edit for comment
If you add a NullField into each of them it can accept focus but won't actually show up as anything. To determine if a "row" (the Manager) has focus, you can use getFieldWithFocus() on that Manager and the one that doesn't return null is the row that is selected. You will probably also have to do some custom painting to draw the selection highlight
You will have to dynamically add and remove custom elements from your CustomListFieldManager as you add and remove elements from a VerticalFieldManager.
Your manager asked that because he want you to learn how to handle custom object to understand how to use managers.
My Query is How to access Fields on the stacked screen using Screen Object ?
The exact problem is as follows:
I have one screen which has one text field (ClientName) when user clicks on that field , application will then push a new screen and it will allow the user to search in remote database using MyWebSerivces. and when user selects the one client from the search result ,i want to set the text Field on the previous screen with the text that user has selected on the current screen..
i have tried the pushScreen( new screen("text) ) and that might be the result if i want to do this operation only once but this is not the option for me since there is two more such field which will go to other screen to fetch the data from webservices . and if i every time i push new screen then after every pushscreen operation i will only get one field set with the desired text
This not a blackberry (or any specific programming language) related question. This is a question of application architecture and common sense. If one screen should change a Field of another screen, then just pass a reference of the Field to the screen that will change it.
hi i once had same problem and i did like this:
Screen1
------------------
Client Name | text field |
------------------
When user clicks on this text field or any button you push Screen2
In screen 2 when user selects a particular value then u do this.
1) take a static variable in main class say clientName.
2) set value of this variable.
3) pop active screen
UiApplication.getUiApplication().getActiveScreen();
when this code is called then u come back to Screen1
Now in screen1 a method is called
public void onExposed()
{
//here u can set the text in textfield using the static variable
invalidate(); // for repainting
}
i have found the answer to my question. the solution was there lying in my question but at first i was not able to find it.
solution was very simple
when i wrote i want to use
UiApplication.getUiApplication().getActiveScreen()
that was almost the right way and i was proceeding in right direction but the thing that i was missing was " I was not casting the screen (that i have just retrieved form the stack top ) to its type
only thing i should have done is "should have casted screen to its type.like this
UiApplication.getUiApplication().posScreen(this)
(MyScreen1) UiApplication.getUiApplication().getActiveScreen()
now i am able to access all the fields on the retrieved screen (MyScreen1)
things to keep in mind
make sure u cast the screen to its type only otherwise bb will give u resource not found error
Benifits of using screen on Stack
u can use already created screen from the stack no need to create new one
if u will create new screen it will be stacked in memory and will consume more and more memory even if its of no use ( make habit to pop the screen if it is of no use instead of leaving it on stack))
no need to create any static variable since u will be able to set all the field right away from other screen