Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3343342
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:56:37+00:00 2026-05-18T00:56:37+00:00

problem description I’ve got a Delphi component. To set a value, you can click

  • 0

problem description

I’ve got a Delphi component. To set a value, you can click and drag.

However, when you reach the edge of the screen, you can’t go any further. You then need to go back to the component and drag further, which is not very user-friendly.

preferred solution

What I’d like is to have the mouse cursor wrap around the screen if you reach an edge, so you can continue scrolling a value. 3dsmax uses this type of GUI control extensively, and I like how that works.

Alternatively, it would be fine for me if the cursor goes off-screen, but continues to send X/Y coordinates that are out of the screen bounds.

what i have so far

I know that I can get/set the current mouse position via Mouse.CursorPos, and that the screen dimensions are available via Screen.Width and Screen.Height.

The code below does wrap the mousecursor around the way I want to.

procedure TFormXXXX.YYYYMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
var
  LX, LY: Integer;
begin
  LX := Mouse.CursorPos.X;
  if LX < 1 then
    LX := Screen.Width - 1
  else
    if LX>Screen.Width -2 then
      LX := 0;

  LY := Mouse.CursorPos.Y;
  if LY < 1 then
    LY := Screen.Height - 1
  else
    if LY>Screen.Height -2 then
      LY := 0;

  Mouse.CursorPos := Point(LX, LY);
end;

There’s still the problem that I have to “manually” keep track of the wraps to obtain a proper offset from the starting point, but I’ll find a way to solve that.

I just don’t know if this is a proper approach to do this. Maybe somebody has some experience or wise words to say about this…

main question

Is there a tried and tested common approach to this?
Does windows provide stuff to do something like this maybe?

some doubts that I have

  • How will this behave when there are multiple monitors?
  • What happens if the user is connected via a slow (VNC?) connection.. will the cursorposition always reach 0 or the other extreme end of the screen?
  • What will happen if the input control is not a mouse, but a sketchpad or a touchscreen?
  • Is it bad practice to change the mouse position? I can imagine users don’t like my application to mess with their mouse cursor position.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T00:56:38+00:00Added an answer on May 18, 2026 at 12:56 am

    Rather than having a simple linear scale, you could accelerate the change with increasing distance from the control, and have a cutoff where past that it starts incrementing automatically. Basically have it work like dragging to select text does, where the window starts scrolling once the mouse reaches the bottom of a window, even if the mouse stops moving once it reaches that point.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Expanding this question on how I learnt to pass from problem description to code
Uhm I'm not sure if anyone has encountered this problem a brief description is
Ok, so here's the full description of the problem I'm having: I am trying
Given the following xml fragment: <Problems> <Problem> <File>file1</File> <Description>desc1</Description> </Problem> <Problem> <File>file1</File> <Description>desc2</Description> </Problem>
Problem: I have an address field from an Access database which has been converted
Problem: I have two spreadsheets that each serve different purposes but contain one particular
Problem (simplified to make things clearer): 1. there is one statically-linked static.lib that has
Problem: Ajax suggest-search on [ n ] ingredients in recipes. That is: match recipes
Problem: Given a list of strings, find the substring which, if subtracted from the
Problem is described and demonstrated on the following links: Paul Stovell WPF: Blurry Text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.