How to set field position on screen at any point on blackberry? - blackberry

I am new to blackberry and i want to set one of my Field position to the left corner of screen & another field at right corner of screen at same level but i am unable to do it.how could it be possible?
I also don't want to give coordinate as a hard coded value but want to calculate using screen width & height cause i want to run same application on Torch I & Torch II model of blackberry.
Thanks in advance

Put AbsoulteFieldManager on screen and then you will have ability to set custom positions for your fields with add(field, x, y).
Take a look on this tutorial.

Related

How can I position an a-frame object to bottom left corner of the marker, and make its width equal to the marker's width?

I'm trying to create a basic scene an AR.JS with NFT (so it's not just the basic marker-based tracking; it tracks a custom image) using A-frame to place down and position my objects, but I've noticed that e.g.: if I place a 1*1*1 size box in the scene, it will appear at different places on different devices. And also, if I don't scale it up to like 200, it will appear as a very-very tiny box.
E.g.: If I try to view my scene on my phone, the object appears at the exact center of the marker, but if I check it on a different phone, it will appear almost completely outside the marker. Also, if I check it with a webcam, it will appear yet again in a different place, and even in a different size.
I wonder if there is any option to make the marker images bottom left (or any other) corner the 0 0 0 point, so I can position my objects more precisely, and also set the object's width to equal the marker images width, so I don't have to scale up the object like this.
At this moment there is any option to display a model in the center of the NFT marker. This because AR.js depend on jsartoolkit5 and this last has no yet this feature. But if you know the width, height and dpi you can display the object in the center of the maker with this formula (pseudo code):
obj.position.y = (marker.height / marker.dpi * 2.54 * 10)/2.0;
obj.position.x = (marker.width / marker.dpi * 2.54 * 10)/2.0;
You can acquire width, height and dpi while creating your marker or using the dispFeatureSet display app distributed by the Artoolkit5 SDK you can find binaries here https://github.com/artoolkitx/artoolkit5/releases/tag/5.4.0 or from artookitx website https://www.artoolkitx.org/docs/downloads/

Specific position of WKInterfaceImage alignment (Watch OS 2)

I just bought the Apple Watch and I want to create a super simple game for it.
It is simple enough to only use monochrome color scheme, but advanced enough to have an object moving in real-time.
I am trying to figure out how to position an object on my Apple Watch with Watch OS 2.
I want to place my object somewhere on the screen (anywhere I'd like to) but there are absolutely
no way to do that, I think.
But, in the following library: https://github.com/shu223/watchOS-2-Sampler
the developer can actually animate the alignment of the image so I guess
that itself suggests it should be possible to somehow specify a point of where to position an object.
And the animation is pretty smooth as well.
I have tried to generate frames on-the-fly CGContext which uses Quartz 2D, but it's way too slow and the app on my Apple Watch just crashes.
I don't necessarily think that the watch itself is too weak, but some clever programming should solve my problem, but I just cant figure out how to do it.
As you already said there is no way to directly position an WKInterfaceObject on your watch. You can change the alignment of an object but that leaves exactly 3 positions: left, center and right. Probably not enough for your game.
What you could do: You can set a background image on a WKInterfaceGroup. So you could draw your game objects into an UIImage and set that as background image of that group. That background images can also be animated. So maybe you can draw the movement of your game object into several UIImages and then set those as animated background image.
One way that I have found to have a little more control over where a WKInterfaceObject is on the screen is to add it to a parent WKInterfaceGroup, and center your item (vertically and/or horizontally depending on how you want to move it). Then you can tweak the group's relative height / width (setRelativeHeight and setRelativeWidth) and it's alignment (setVerticalAlignment and setHorizontalAlignment) to get your item positioned where you want.
This doesn't give you the ability to tweak frames or give the item a particular coordinate, but it does give you the ability to programmatically move a WKInterfaceObject anywhere on the screen.
For example if you want your object in the exact center of the screen vertically, you leave the group's relative height to its container as 1, with your item centered. To get the object at 40% from the top, you can change the group's relative height to 0.8 and it's alignment to .Top. If you want it 60% from the top, the relative height would still be 0.8, but the group's vertical alignment should be .Bottom etc.
I know this is kind of a confusing way to have to accomplish this, but this worked for me in getting items positioned exactly how I wanted.

how can i set kivy widgets position platform independently?

I'm writing an application with kivy that scans a network and based on results it generates bunch of widget like labels and buttons or maybe a layout like Gridview.
I'm trying to position them by pos or center_x and center_y attributes. I can position them perfectly on my laptop but when I try my tablet or other devices with different screen sizes everything goes wrong and all widgets change their position.
My question is:Is there a elegant way to position widgets and layouts that pertain their position on any screen size?
P.S:
it's not working even when i maximize the window.
You have many different options here like::
Query the Window size and position your widget relative to the window using percentages instead of absulute values.
Use specific layout that fits the positioning style you need for you widgets.
Recomended
Use pos_hint in combination with your layouts
specify the widget pos using kivy.metrics.dp which gives you device independent pixels or use metrics.sp/cm/mm/in/...

How to set a cross hair icon in exact middle of the camera overlay?

I would think MyImagePicker.frame.center is where I should place the icon (subtract icon.size.width/2 and height /2., but when the picture actually saves, what I thought the cross hair is pointing at is not the middle of the image at all. X seems okay, but Y happens to be some distance off. I can approximate by trial and error, but I would like to be exact.
Help?
The frame actually defines the origin and dimensions of the view in the coordinate system of its superview and is commonly used during layout to adjust the size or position of the view as detailed here.
You most likely want to use MyImagePicker.bounds.size.width / 2 and MyImagePicker.bounds.size.height / 2 to get the actual center of your image picker.
I actually learned this recently by watching the Stanford lecture series on iOS 5 development on iTunes U.

MapField with Points

I want to make a screen where i have to show the map with the all received lat and long. and i want to show this map in 200*200 resolution only.
Can i make the point bitmap as focusable so i can be click on it and show other screen.
How to show more than one location in Blackberry MapField?
hope this link helps you in solving your problem;Do you have any idea how to display a small text box kind of thing when multiple points are selected?

Resources