Solved

A general MouseDown Event

Posted on 1998-11-02
8
822 Views
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...

Thanks
PPaul
0
Comment
Question by:PPaul
8 Comments
 
LVL 4

Expert Comment

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

Author Comment

by:PPaul
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....

0
 
LVL 4

Expert Comment

by:dwwang
ID: 1345501
But I wonder why you think about mousedown? isn't what you want should be done in OnDragOver?
0
 

Author Comment

by:PPaul
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.  
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 4

Expert Comment

by:dwwang
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.
0
 
LVL 3

Expert Comment

by:williams2
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...
0
 

Author Comment

by:PPaul
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????
0
 

Accepted Solution

by:
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);
begin
  .
  .
end;

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.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

910 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now