I am building a blackberry app for BB Curve.I have a verticalfieldmanager where i am adding a Button,i set its extent as 320*22.I have a horizontalfieldmanager where i am adding two editfield and its extent is 296*22.Finally i am adding both these manager into another verticalfieldmanager whose extent i have set as 320*240.i use setBackgroundBitmap(Background bg) to set the background image.But when i set the extent of the main verticalfieldmanager,only the background image is set,but the other two managers where i have added editfield and button are not visible.But when i dont set the extent of the main vertical manager,than the editfield and button are added to the screen,but the background image is not added.So where i am doing wrong?
It looks like you're going to have to play with your extents to make sure that you given the child Managers enough space to layout the Fields. In your sublayout(int width, int height) of the Managers, check what dimensions are getting passed to it. If they are less than the space it needs to layout, it won't be able to display its Fields.
Related
How to design circular buttons in Apple watch? What would be the approach to design a screen like the contacts application of the watch.
I don't know if this is what you want, but you could try this:
-open your Graphic/Design-Application (Photoshop, Gimp or whatever)
-create a circle-button and save the image
-in Xcode, drag a button into your interface
-go to the attributes inspector of the button and set your image at background > image
You can achieve this using group,
Drag group object and drop it in interface builder
set equal height and width to the group
In attribute inspector, set custom radius to half of the height value set.For Eg: if height and width is set as 30, then the radius will be 15. This will give you round shape.
Add color or image based on the need
Add tap gesture to the group and add action to the gesture. Handle stuffs here that are needed to be handled on clicking it
Please, find my answer for your query. I hope that it will help you more.
If you want to design a screen like favorite contact app on apple-watch, then the WWDC video link given in my answer will definitely guide you.
I have designed app with a circular menu which is not exactly same as the apple's favorite app, But it has almost have a circular view with statically.
For that, I have used Groups in horizontal layout for each horizontal item with proper alignment of inside groups.
The nexGTv – Mobile TV for touch phone app has a scrolling horizontal field manager that I want to create in my own app.
It has image buttons at the bottom of the screen, horizontally. These images slide to the right and to left. The initial focus is the horizonal center image, then each image has 10 pixels of padding to the next image. What should i use for this?
I can understand your question, but i can not give you related code but i can tell you the logic behind this. To do this you first set a image at center and set bottom padding 10 pixel then fill images left side and right side. You have to do this in paint method. If you are a Blackberry Developer then you can understand it and try to do it. All the work perform in paint method, by using loops you can do this. This work con not be done by Picture-Scroll-Field because you want middle image with extra padding.
In my app, I am using a manager whose height is controlled by using its sublayout() method. Now when this manager(or any of the fields inside it) receives focus, I am able to increase the manager's height all at once, but i want to make it animate and gradually increase its height. How shall i achieve this?
I am developing for OS 5.0 and above.
Use the timer in the paint method and expand its height every X milliseconds...
I have a requirement for a one-line edit field that can accept text longer than the edit field's width (like a "normal" Windows textbox).
Since the BasicEditField control normally word-wraps its contents, I've implemented this requirement by placing my BasicEditField inside a HorizontalFieldManager that allows horizontal scrolling.
This works in one sense: if I type text longer than the edit field's width, the HFM automatically scrolls to the left (taking the edit field with it) which keeps the cursor visible at the right.
The problem is that the user can swipe right-to-left, which moves the BasicEditField completely off the screen to the left. I want to be able to only scroll left when the BasicEditField's contents are too wide to be shown entirely, and only allow just enough leftward scrolling to keep the cursor visible on the right.
I fought this exact scenario when implementing my own EditField. What's happening is since you allow horizontal scrolling, and an EditField by nature wants to use as much width as it can, you end up with a very wide EditField. I'm copying this from my code, so hopefully it will work for you, but if it doesn't add a comment and I'll try to see if I can help get it working.
EditField edit = new EditField(EditField.NO_NEWLINE | style) {
protected void fieldChangeNotify(int context) {
try{
super.fieldChangeNotify(context);
setExtent(this.getFont().getAdvance(this.getText()) + 10, this.getHeight());
}
catch(Exception e){
//don't recall why I needed this, but it works so I'm hesitant to remove it
}
}
protected void layout(int width, int height) {
super.layout(width, height);
setExtent(this.getFont().getAdvance(this.getText()) + 10, this.getHeight());
}
};
What this will do is progressively make the EditField wider as the text grows. I had this inside of an HFM that grew with it as well, but you might not need that. I did this because if the field grew wider than the screen width, rather than scrolling the entire screen you could let this single Field scroll horizontally. Also, the + 10 is in there because it was clipping the cursor without it. If you would like that as well I can edit this post to include it.
hi I am new to blackberry development..
I am trying to add a vertical scroll bar on the screen, but not able to do that. because I do not know the way.
VerticalScrollManger scroll = new VerticalScrollManager(Manager.VERTICAL_SCROLL);
please give me the solution.
thanks
Things that extends net.rim.device.api.ui.Manager (like a VerticalFieldManager) can have style bits set in the constructor that specify which type(s) of scrolling you want and whether or not the scrollbars (arrows) should be displayed. Put your Field into a manager that has scrolling enabled and set the manager for the screen You need to set the manager containing the component/field that is too large for the screen to have scrolling enabled AND scrollbars drawn to see scroll arrows.
The style bits you want to set are: Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR
If your UI is built on top of the blackberry classes MainScreen or FullScreen, you can use the constructor taking an argument of type long to set the style bits: MainScreen(long style) could be called as MainScreen(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR); to set the style bits for the screen to include scrolling and vertical scroll indicator arrows.
There is an occasional issue that FieldManagers that are fixed size will sometimes not show scroll arrows (but they'll still scroll). See Blackberry VerticalFieldManager with fixed size : Scroll issue if you are concerned about that issue.
If by scrollbars you mean the small blue arrows, then you can get these to display using the method Jessica described above (set style bits VERTICAL_SCROLL and VERTICAL_SCROLLBAR). However, if by scrollbars you are referring to actual bars that indicate the scrolled position (as seen in the Browser app) then you would need to draw these on the manager yourself, as the BlackBerry API doesn't provide you with any way to display them automatically.
To do something like that you'd need to subclass VerticalFieldManager and override the paint method. Use a combination of the screen height (Display.getHeight()), the manager height (getVirtualHeight()) and the scroll position (getVerticalScroll()) to calculate the Y position and height of the bar, and then draw it on the screen using g.drawRect() or something similar.
If you want a fancier-looking scrollbar, take a look at my article in BlackBerry knowledge base:
http://supportforums.blackberry.com/t5/Java-Development/Implementing-a-standard-style-scrollbar-on-a-Blackberry-device/ta-p/504416