Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

A general MouseDown Event

Posted on 1998-11-02
Last Modified: 2010-04-06
In a program I'm working on I fugered out a way to make a personal Drage and Drop from scratch. I know that delphi handles D&D but I need more control. The program needs the pointer to pull around a form. but still offsetted from the pointers current postion by 10 X and Y. once that the mousedown event in the component that the user selects from is used and the pointer is draged around the component the form follows but as soon as the pointer leaves the area of the component the form stops. I could make all MouseDown event of the components point to the same code lines but I need it to cross over to another form. Ex. from Form1 to Form2. is there a way that a single MouseDown Event can handle this with out pointing all the other MouseDown events to the one Event?

willing to give points, so examples will be needed...

Question by:PPaul

Expert Comment

ID: 1345499
Do you mean you what to share an event among all the forms?

Author Comment

ID: 1345500
yes I guest... I need the one Procedure to handle forms, the screen, other components.  Just like the Drag & Drop handled by delhpi The pointer dosen't stop when it goes out the the starting component. The reason I need this it so that I can read what is under the pointer and still drage the form...

Example: 3 forms. 2 are shown all the time whill the program is runnung. when the user clicks on an Item in a listbox on form 1 and starts to drage it form 3 is poped up with a copy of the text and/or Icon in it. as the pointer is being drag accross from form 1 to form 2 it has to cross the desktop. The pointer still needs to drage form3 with it accross. Onec in the form 2 area form3 is still showing with the pointer.

I could get every Object MouseDown Event point to the same code but I was wondering if there is a way that this could be cut down to one event that is called with out any of the other objects MouseDown events being used....


Expert Comment

ID: 1345501
But I wonder why you think about mousedown? isn't what you want should be done in OnDragOver?
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


Author Comment

ID: 1345502
eather way... (I tested it...) I would need to make all the components point to the same code.... I would like a way that would do that in one code without pointing all components to the one spot.  

Expert Comment

ID: 1345503
Well, on method I think is to capture the CM_Drag Message, but it is rather complex, I don't know whether it is valuable.

Expert Comment

ID: 1345504
Forget it.. it's not done this way! ..You should read about Message API handling routines instead.
1. You cannot share code directly between forms, because systems like windows NT runs applications in different memory environments.. (DDE could be a solution?)
2. You will have write specific OLE controls overriding the standard form methods, using drag'n'drop capabilities.. (search for dndfiles.zip on share-ware sites to see an example of Drag'n'drop from and to a form application)

Drag'n'drop is far more complex than a WM_MOUSE_DOWN event...

Author Comment

ID: 1345505
Ok then, is there a way in the drag and drop of delphi. to use the X,Y of the mouse during D&D. So that I can make a image move with the pointer????

Accepted Solution

endro earned 200 total points
ID: 1345506
This is one of the solutions (if this is what you meant).

Create a new procedure to handle the event

procedure handle_it(x,y : integer; ... other params);

Suppose you put this procedure to different unit (let's call it unit unHandle), call the unit in both forms, and on OnMouseDown event you can call the procedure.


Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Machine not responding during CopyFile() 3 103
Delphi Form ownership 4 107
Magic Software info 18 138
Convert MS Word document to a PDF file 9 90
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question