Recent

Author Topic: Setting mouse position  (Read 12424 times)

MarsTeam

  • New Member
  • *
  • Posts: 11
Setting mouse position
« on: January 25, 2011, 01:43:13 am »
Hello, I'm doing some OpenGL stuff and I would need to set mouse position to center of screen. Any idea how to change Mouse's x,y ?
 Thanks

MarsTeam

  • New Member
  • *
  • Posts: 11
Re: Setting mouse position
« Reply #1 on: January 25, 2011, 11:41:28 am »
Anyone ? Is there really no way to set it ? I'm not using GLUT by the way.

garlar27

  • Hero Member
  • *****
  • Posts: 652
Re: Setting mouse position
« Reply #2 on: January 25, 2011, 02:24:49 pm »
Try using MouseAndKeyInput component. You might need to install it, and add it to your project by Add/New Requirement from the Project Inspector.

I've never used it with mouse, so I can't help you much with this.

bonmario

  • Sr. Member
  • ****
  • Posts: 346
Re: Setting mouse position
« Reply #3 on: January 25, 2011, 06:41:36 pm »
Hello, I'm doing some OpenGL stuff and I would need to set mouse position to center of screen. Any idea how to change Mouse's x,y ?
 Thanks


Code: [Select]
Mouse.CursorPos.X:=50;
Mouse.CursorPos.Y:=100;

Hi, Mario

MarsTeam

  • New Member
  • *
  • Posts: 11
Re: Setting mouse position
« Reply #4 on: January 25, 2011, 11:05:18 pm »
Error; Argument cannot be assigned to.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Setting mouse position
« Reply #5 on: January 26, 2011, 01:57:20 am »
Mouse.CursorPos is a record type, therefore it can't be assigned directly. Use this code instead:
Code: Delphi  [Select][+][-]
  1. var
  2.   MousePos: TPoint;
  3. ...
  4.   MousePos.X := ... ;
  5.   MousePos.Y := ... ;
  6.   Mouse.CursorPos := MousePos;
  7.  

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2583
Re: Setting mouse position
« Reply #6 on: January 26, 2011, 09:58:57 pm »
Or Mouse.CursorPos := Point(x,y);
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

 

TinyPortal © 2005-2018