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

  • Home
  • SEARCH
  • 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 90213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:50:17+00:00 2026-05-10T22:50:17+00:00

In Delphi 2007, in a mouse move event, I try to change the mouse

  • 0

In Delphi 2007, in a mouse move event, I try to change the mouse cursor with:

procedure TFr_Board_Display.PaintBox_Proxy_BoardMouseMove(Sender: TObject;   Shift: TShiftState; X, Y: Integer); begin    if left_mouse_button_down then begin       if some_condition then begin       Cursor := crDrag;     end     else begin       Cursor := crNoDrop;     end;   end   else begin     if some_other_condition then begin       Cursor := crHandPoint;     end     else begin       Cursor := crDefault;     end;   end; end; 

for example. However, when the left mouse button is down, and I move the mouse, the cursor doesn’t change to either crDrag or crNoDrop. The code is executed (e.g. Cursor := crDrag;) but the cursor does not change. When the left mouse button is up, and I move the mouse, the cursor changes no problem.

(I originally tried to use some Drag & Drop events and properties, but couldn’t get everything to work the way I wanted.)

Edit: Clarified desired behavior, and formatted code.

Edit: Thank you, Gamecat, but I want the cursor to change when the left mouse button is down and the while the mouse is moving the cursor should change back and forth between crDrag and crNoDrop.

  • 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. 2026-05-10T22:50:18+00:00Added an answer on May 10, 2026 at 10:50 pm

    If you set the mouse cursor in the OnMouseDown and reset it in the OnMouseUp, anything works fine:

    procedure TForm4.FormMouseDown(Sender: TObject; Button: TMouseButton;   Shift: TShiftState; X, Y: Integer); begin   Cursor := crCross; end;  procedure TForm4.FormMouseUp(Sender: TObject; Button: TMouseButton;   Shift: TShiftState; X, Y: Integer); begin   Cursor := crDefault; // Or you can restore a saved cursor. end; 

    If you want the mousecursor to react at the mouse move, use the following:

    procedure TForm4.FormMouseMove(Sender: TObject; Shift: TShiftState; X,   Y: Integer); begin   if ssLeft in Shift then begin     if X<100 then       Screen.Cursor := crCross     else       Screen.Cursor := crHourGlass;   end else     Screen.Cursor := crDefault;  // Or you can restore a saved cursor. end;  procedure TForm4.FormMouseUp(Sender: TObject; Button: TMouseButton;   Shift: TShiftState; X, Y: Integer); begin   Screen.Cursor := crDefault; // Or you can restore a saved cursor. end; 

    The MouseUp is needed, else the cursor won’t change back if it hovers above a control.

    Be sure to use Screen.Cursor everywhere.

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

Sidebar

Related Questions

How do I get the KeyDown event to work in a Delphi (2007) MDI
Every time I try compile a VB project that uses a Delphi (2007) activex,
I'm using Delphi 2007. How can I put a GIF/PNG image on a BitBtn
I have a Windows CGI created with Delphi 2007 using CGIExpert that I need
I made an OCX with Delphi 2007. Now my customer claims that there is
I have a MDI application written in Delphi 2007. If the user exits a
What is the best way to make a Delphi application (Delphi 2007 for Win32)
Does that mean that I can't share a Form between delphi 2007 and 2009?
I have a rather large (freeware) project written with Delphi 2007 which is using
Is it possible to use a .NET DLL in Delphi 2007 for Win32? I've

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.