Board index » delphi » Only Even Mouse Positions

Only Even Mouse Positions


2007-03-16 02:34:18 AM
delphi199
I am attempting to get the mouse position in a TImage using the following
code:
---------------------
procedure TfWaterFall.imageRGBMouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
(* M o u s e M o v e *)
var
MousePos: integer;
begin
MousePos := X;
----------------------------
For some reason it only reports 'even' mouse positions. If I recompile it
will ony report 'odd' positions. Why would that be.
Using D7
Thanks....... Jim
 
 

Re:Only Even Mouse Positions

James Brown writes:
Quote
I am attempting to get the mouse position in a TImage using the
following code:
---------------------
procedure TfWaterFall.imageRGBMouseMove(Sender: TObject; Shift:
TShiftState; X, Y: Integer);
(* M o u s e M o v e *)
var
MousePos: integer;
begin
MousePos := X;

----------------------------
For some reason it only reports 'even' mouse positions. If I
recompile it will ony report 'odd' positions. Why would that be.
How do you inspect the MousePos variable? Doing that using the IDE with
a breakpoint in the handler is hopeless, the best you can do is log the
position to a control on your form, e.g. add text to a memo or set the
forms caption.
--
Peter Below (TeamB)
Don't be a vampire (slash7.com/pages/vampires),
use the newsgroup archives :
www.tamaracka.com/search.htm
groups.google.com
www.prolix.be
 

Re:Only Even Mouse Positions

Quote
>For some reason it only reports 'even' mouse positions. If I
>recompile it will ony report 'odd' positions. Why would that be.

How do you inspect the MousePos variable? Doing that using the IDE with
a breakpoint in the handler is hopeless, the best you can do is log the
position to a control on your form, e.g. add text to a memo or set the
forms caption.

Thanks Peter. The I tried this this:
----------------------
procedure TfWaterFall.imageRGBMouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
(* M o u s e M o v e *)
var
MousePos: integer;
begin
MousePos := X;
lblMouse.Caption := intToStr(MousePos);
---------------------
but it still only reports even values of X
Any other ideas?
.
 

Re:Only Even Mouse Positions

"James Brown" <XXXX@XXXXX.COM>writes:
Quote

lblMouse.Caption := intToStr(MousePos);
---------------------
but it still only reports even values of X
Call TLabel::Update after setting it is Caption.
~ JD
 

Re:Only Even Mouse Positions

"JD" <XXXX@XXXXX.COM>writes
Quote

Call TLabel::Update after setting it is Caption.
Well - I tried Update and Refresh with no change.
Any other ideas? I am running out of options.
Thanks........ Jim
 

Re:Only Even Mouse Positions

"James Brown" <XXXX@XXXXX.COM>wrote
Quote
I am attempting to get the mouse position in a
TImage using the following code:
procedure T...MouseMove
(Sender: TObject; Shift: TShiftState; X, Y: Integer);
For some reason it only reports 'even' mouse positions. ...
Perhaps the raw scaling for your mouse's output
increments is so course that it is scaled up by two
to get your canvas' X and Y numbers. --JohnH
 

Re:Only Even Mouse Positions

"James Brown" <XXXX@XXXXX.COM>wrote
Quote
I am attempting to get the mouse position in a
TImage using the following code:
procedure T...MouseMove
(Sender: TObject; Shift: TShiftState; X, Y: Integer);
For some reason it only reports 'even' mouse positions. ...
James, Try the following code and you will discover
interesting patterns in missing X values. --JohnH
procedure TForm1.StringGrid1MouseMove
(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
Inc(Hist[x]);
StringGrid1.Cells[(x div 100),(x mod 100)] :=
IntToStr(Hist[x]);
end;
Where you have a form with a TStringGrid and
Hist is an array of 1000 integer elements.
 

Re:Only Even Mouse Positions

James Brown writes:
Quote
>>For some reason it only reports 'even' mouse positions. If I
>>recompile it will ony report 'odd' positions. Why would that be.
>
>How do you inspect the MousePos variable? Doing that using the IDE
>with a breakpoint in the handler is hopeless, the best you can do
>is log the position to a control on your form, e.g. add text to a
>memo or set the forms caption.
>

Thanks Peter. The I tried this this:
----------------------

procedure TfWaterFall.imageRGBMouseMove(Sender: TObject; Shift:
TShiftState; X, Y: Integer);
(* M o u s e M o v e *)
var
MousePos: integer;

begin
MousePos := X;
lblMouse.Caption := intToStr(MousePos);
---------------------
but it still only reports even values of X
Any other ideas?
Has to be something specific to your PC or the way you have set up your
form. I tried to reproduce the problem (BDS 4, Win32) with a simple
TImage set to Autosize= true, with one of the stock bitmaps that come
with Delphi. Shows all mouse positions correctly for me. Try to run
your test program on another PC, if available one using a different
WIndows version, or at least a different mouse driver.
--
Peter Below (TeamB)
Don't be a vampire (slash7.com/pages/vampires),
use the newsgroup archives :
www.tamaracka.com/search.htm
groups.google.com
www.prolix.be
 

Re:Only Even Mouse Positions

"James Brown" <XXXX@XXXXX.COM>wrote
Quote
It turns out that the problem is with the
mouse/mouse driver. I use a MS wireless and
I find that I have to slow down the mouse
movement to allow it to see all the X
positions.
Jim, I presume that you mean "slow" as in
changing the properties in the mouse section
of the control panel to "slower". I notice
that on my Dell 5100, there is a check box
in the mouse properties labeled "enhace
pointer precision" which also makes all
pixels reachable without changing the ratio
of mouse-to-screen movement. --Rgds, JohnH
 

Re:Only Even Mouse Positions

Thanks John(and all) - It turns out that the problem is with the mouse/mouse
driver. I use a MS wireless and I find that I have to slow down the mouse
movement to allow it to see all the X positions.
"John Herbster" <herb-sci1_at_sbcglobal.net>writes
Quote
>For some reason it only reports 'even' mouse positions. ...

Perhaps the raw scaling for your mouse's output
increments is so course that it is scaled up by two
to get your canvas' X and Y numbers. --JohnH