blackberry JDE 4.7 - TouchEvent Class - difference between getX and getGlobalX - blackberry

In the blackberry JDE 4.7,
under the TouchEvent, there are two similar sounding methods:
getX(int touch) "return mapped x coordinate"
getGlobalX(int touch) "return global x coordindate"
Does anyone know what the difference is between the two? The javadocs talk about mapped vs global but I'm not sure what that means.
Any help poindexter?

getX is the position in your field (button, listfield) and getGlobalX the x-position in your screen.

Like rAyt mentions.
The mapped coordinate is with respect to your current view or field. The global coordinate is with respect to your screen.
This link may help you:
http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&thread.id=36636

Related

How to implement Slide-out menu for iOS Apps

I just wanted to implement slide-out menu like implemented in this snapshot below:
Could anybody guide me how to go for it.
Thanks
V#run
Looks like Patrick's link will give you most of what you want. If you really want the 3D look where the menu appears to be tilted away you'll have to learn how to use Core Animation with transformation matrixes that create perspective. Do a search on "Adding Perspective to Your Animations" in the Xcode help system for info on how to get perspective.
In short, it involves setting the M34 field of a CATransform3D to a small negative value after rotating the layer around the desired axis. (In this case you'd want to rotate around the y axis.)
RESideMenu is a great library that I've used more than once. You can find it on Github here: https://github.com/romaonthego/RESideMenu

Points coordinates in multiple screen CoronaSDK

I'm new to Corona SDK development and I'm looking around to get some documentations and see if this platform is goot to reach my goal.
Let's say that I have a background image in my screen (320X480 for example), and I want to move an object from one point to another. For example I want to move an object from 100,100 to 300,300. In this case, my object follow a line that almost covers the entire width of my screen. But what happens when I run the app on a different screen resolution? For example on a Ful HD screen, moving an object from 100 to 300 on the X axis, it just moves a little.
What I saw from Corona documentations is that multiple screen is supported by providing different image resolutions. But what happens when I have to go through screen coordinates? Do I have to check at runtime for the screen resolution and do all the Math operations to scale my points coordinates? Or is there anything else that I'm missing?
I ask you sorry if I missed something from the doc :(
Usually corona will do all such work for you, if you have added proper config.lua to your project. But I'm doing it in a different way for more precision and for my satisfaction:
In normal case:
-- Your object at point (100,100)
local myObject = display.newRect(0,0,50,50)
myObject.x = 100
myObject.y = 100
-- sample transition
transition.to(myObject,{time=1000,x=300,y=300})
What I'm doing:
-- Create a scale factor for X and Y
local _x = display.contentWidth/320
local _y = display.contentHeight/480
-- Multiply X values with '_x' and Y values with '_y', as below:
local myObject = display.newRect(0,0,50*_x,50*_y)
myObject.x = 100*_x
myObject.y = 100*_y
transition.to(myObject,{time=1000,x=300*_x,y=300*_y})
Note:
While trying the above code, you have to develop your code for iPhone simulator. Hence, I obtained local _x = display.contentWidth/320, where the division factor is the width of the simulator/screen that you are using to build your app. And in local _y = display.contentHeight/480, the division factor is the height of the simulator/screen.
Keep Coding................. :)
It scales it all for you. I'm not sure if it specifically mentions it in the documentation, probably.
I am also newer to Corona (since July) with no previous mobile experience. It has blown me away with what it can do.
Corona does all the work for you. You define your default screen resolution (320x480 for example) and in whatever resolution you want to move from 100 to 300 it will behave equally because corona will treat all screens resolutions as it was 320x480.

Change the origin to the center of object in Google SketchUp(Free version)

As shown in the following, I am trying to move the origin to the center of the bounding box of this 3D object by using its Axes tool. At a result, it seems very hard to find that center because there is not auto-snap to help me move the axes. I am using the free version of Google SketchUp 8 and I do find some handy source code like plug-in to do this for me in Pro version which I don't have.
Could anyone tell know how to perform this to set the origin to the center?
(What plugin did you find that did this only in Pro?)
I happen to have a plugin that does this: http://sketchucation.com/forums/viewtopic.php?t=30508
If you want to do this yourself by code, then the gist of it is:
Get the point for the new origin of the axes. instance.bounds.center
Get the vector from the new origin to the old origin.
In the definition of the group or component, transform all the content using the vector.
For each instance belonging to the definition, apply the inverse transformation.

Drawing a circle on MapView with specifiec radius on Monondroid

I'm trying to draw a circle with specific radius in km (for example 2km) on a MapView at specific lat/lng. I've found some samples:
Creating Custom Overlay on the map
Draw A Circle On Android MapView
Draw circle of certain radius on map view in android
I think first and second of above are useful but these are in Java and I need code for Mono for Android (Monodevelop).
I can't find Projection class in monodroid.
And can't use com.google.android.maps.Projection.
Can somebody help me how to use these codes in monodroid?
com.google.android.maps.Projection is an interface, so it is made available in Mono for Android as Android.GoogleMaps.IProjection to keep with normal C# conventions.
Similarly, where you'd use mapView.getProjection() in Java, in C# it is made available via the Projection property on MapView.
Xamarin has some tutorials on their site that go over how to use these to create custom overlays, so I'd suggest checking them out.

How to set field position on screen at any point on 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.

Resources