Solved

A general MouseDown Event

Posted on 1998-11-02
8
817 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

707 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

13 Experts available now in Live!

Get 1:1 Help Now