I have a problem with the command MOUSESTATE in my iPhone. The return value is always zero for the top of the screen, where the coverage and the battery are shown. Could this be a bug?.
I dont think that area is part of the screen, so no, it isn't a bug.
Do you mean that the digitizer does not cover that area?
If you mean the iOS status bar, you'd mean the opengles area about 0,0 to 320,20 which should be fine.
I refer specifically to the status bar. The digitizer doesn't work.
What is a digitizer ?
Actually it is a full screen, so should cover everything as matchy said. So it could be a bug...
The digitizer is the touch-screen area.
"Digitizer" is a generic term that could be used to describe the keyboard or microphone also.
Please post sample code to describe your problem!
By digitizer he's referring to the touch layer of the screen that converts your touches to co-ordinates.
Everything I've coded for the iPhone detects the whole screen from 0,0 to 320,480.
Sounds like there must be a bug somewhere in the code.
Or possibly a faulty device. The iPhone screen sometimes will lose sensitivity on certain horizontal bands of the touchscreen,.
Easiest thing would be to write some code to test the state of your touches,
GLOBAL TouchX[], TouchY[], TouchB1[]
DIM TouchX[5]; DIM TouchY[5]; DIM TouchB1[5]
GLOBAL i, dummy
SETSCREEN 320,480,TRUE
SYSTEMPOINTER TRUE
LIMITFPS 30
WHILE TRUE
FOR i=0 TO 4
SETACTIVEMOUSE i
MOUSESTATE TouchX[i],TouchY[i],TouchB1[i],dummy
PRINT "x:"+TouchX[i]+" y:"+TouchY[i]+" b:"+TouchB1[i],16,i*32
NEXT
SHOWSCREEN
WEND
iphones has no such thing as calibrations right?...just a shot.
Let's do a test. Download the application "Snowland Free" of our friend ampos. The operation is very simple, you place in your finger on the screen and start falling snow. If you put your finger on the status bar you will see that the snow does not fall exactly at the point where you place your finger, but the snow is offset from it.
Could anyone test it with a Touchpad Stylus Pen in order to be more precise?
Msx, I think this is something about the iPhone, or how Ampos made the code.
In example is you touch the screen on some position, and leave the touch, the Glbasic, "memorize" this position, but if you touch, in your case the icon where is the batery and another icons, Glbasic I suppose, understand the touch, but the value turn to 0,0. Perhaps is something of you device, I don´t very sure about this. If I have time, I make youer test, and comment here.
Kinds Regards,
Iván J.
PS: Make a simple test, put the coordinates on the Screen, and you will be seure, where runs wells or where have the fail, if in the icon, you have coorcinates and make something extrage is glbasic, if not, I think is something about device or another thing.
Here's some code to visually test the touch screen
SETSCREEN 320,480,TRUE
SYSTEMPOINTER TRUE
LIMITFPS 30
GLOBAL TouchX[],TouchY[],TouchZ[],TouchB1[]
DIM TouchX[5]
DIM TouchY[5]
DIM TouchZ[5]
DIM TouchB1[5]
GLOBAL i,dummy
WHILE TRUE
FOR i=0 TO 4
SETACTIVEMOUSE i
MOUSESTATE TouchX[i],TouchY[i],TouchB1[i],dummy
IF TouchB1[i]=1
DRAWRECT TouchX[i]-32,TouchY[i]-32,64,64,RGB(255,255,255)
ENDIF
NEXT
SHOWSCREEN
WEND
I do not think that example is useful because the problem is that the zero of the digitizer screen does not match the zero of the graphical display . Your example will draw the square where it thinks you has touched but this is not meant to work properly.
Quote from: msx on 2011-May-25
I do not think that example is useful because the problem is that the zero of the digitizer screen does not match the zero of the graphical display . Your example will draw the square where it thinks you has touched but this is not meant to work properly.
Then check my previous post where I wrote code to print up the x,y co-ordinates of each touch and the button/touch status.
http://www.glbasic.com/forum/index.php?topic=6326.msg50522#msg50522 (http://www.glbasic.com/forum/index.php?topic=6326.msg50522#msg50522)
The problem is that when touching with your finger covering large areas can not assure that this bug exists.
Okay, one more attempt
You say the iPhone is not picking up any detection in the top part of the screen,
where the status bar for signal coverage and battery are shown.
This code example splits the screen into 30 strips of 16 pixels and detects when you are touching inside one of the strips.
If there is a problem with your touch screen then you will not be able touch the first strip.
Let us know how it responds.
GLOBAL TouchX[], TouchY[], TouchB1[]
DIM TouchX[5]
DIM TouchY[5]
DIM TouchB1[5]
GLOBAL Zone[]
DIM Zone[30]
GLOBAL i, dummy
SETSCREEN 320,480,TRUE
SYSTEMPOINTER TRUE
LIMITFPS 30
WHILE TRUE
FOR i=0 TO 4
SETACTIVEMOUSE i
MOUSESTATE TouchX[i],TouchY[i],TouchB1[i],dummy
IF TouchB1[i]
Zone[ASR(TouchY[i],4)]=1
ENDIF
NEXT
FOR i=0 TO 29
DRAWLINE 0,i*16,320,i*16,RGB(255,255,255)
IF Zone[i]=1
DRAWRECT 0,i*16,320,16,RGB(255,255,255)
ENDIF
Zone[i]=0
NEXT
SHOWSCREEN
WEND
Here you have a little test I did, you will observe that the touch screen behaves differently according to the area.
My app on TV!
The code I use is
IF mouse.x=0 THEN mouse.x=1
IF mouse.x>479 THEN mouse.x=479
x=mouse.x+RND(6)-3;y=mouse.y+RND(3)-1
IF x<1 THEN x=1
IF x>478 THEN x=478
IF y<1 THEN y=1
IF y>318 THEN y=318
perhaps my program is not the best for testing, but it is a thing I noted yesterday:
The X (perhaps the Y too) coordinate only start showing values when X>20 (or a number similar, not tested really) but if you move the mouse/finger to the left it can answer values <20.
You have to start not-near the left border, but then you can move to the left with no problem.
Quote from: ampos on 2011-May-26
The X (perhaps the Y too) coordinate only start showing values when X>20 (or a number similar, not tested really) but if you move the mouse/finger to the left it can answer values <20.
You have to start not-near the left border, but then you can move to the left with no problem.
something more or less similar to wacom tablets behavior. After tracking the pen, they can even track it a little outside the tablet/screen area.
It's kind of how a capacitive digitiser works,
as it's reading fingers, which aren't as precise as a resistive touch stylus,
it works out from what information it gets of the blob that is a finger to chose a point.
And according to ampos' code, it's acting as it should.
As far as I can tell there is no problem with your device or GLBasic,
it's just how it is with a capacitive touch screen.